#region using System; using System.Data; using CSFrameworkV5.Common; using CSFrameworkV5.Core; using CSFrameworkV5.DataAccess; using CSFrameworkV5.Interfaces; using CSFrameworkV5.Models; using CSFrameworkV5.WebRef.SystemModule; #endregion /*========================================== * 程序说明: UserCustomAction的业务逻辑层 * 作者姓名: * 创建日期: 2013-07-17 05:45:50 * 最后修改: 2013-07-17 05:45:50 * * 注: 本代码由ClassGenerator自动生成 * 版权所有 *==========================================*/ namespace CSFrameworkV5.Business { public class bllUserCustomAction : bllBaseDataDict { public const int BTN_COLS = 6; //配置界面-最多可配置的列数 public const int BTN_ROWS = 6; //配置界面-最多可配置的行数 private IBridge_CustomModule _MyBridge; //桥接/策略接口 public bllUserCustomAction() { _KeyFieldName = sys_UserCustomAction.__KeyName; //主键字段 _SummaryTableName = sys_UserCustomAction.__TableName; //表名 _WriteDataLog = true; //是否保存日志 _DataDictBridge = BridgeFactory.CreateDataDictBridge( typeof(sys_UserCustomAction)); _MyBridge = CreateBridge(); } private IBridge_CustomModule CreateBridge() { if (BridgeFactory.IsADODirect) return new dalUserCustomAction(Loginer.CurrentUser); if (BridgeFactory.IsWCFBridge) return new WCF_UserCustomAction(); throw new CustomException(BridgeFactory.UNKNOW_BRIDGE_TYPE); } /// /// 刪除 /// /// /// /// public bool Delete(string FormFullName, string MenuName) { return _MyBridge.Delete(Loginer.CurrentUser.Account, FormFullName, MenuName); } /// /// 是否存在 /// /// /// /// public bool Exist(string FormFullName, string MenuName) { return _MyBridge.Exist(Loginer.CurrentUser.Account, FormFullName, MenuName); } /// /// 获得当前用户自定义常用功能列表 /// /// /// public DataTable GetCurrentCustomAction() { return GetCustomAction(Loginer.CurrentUser.Account); } public DataTable GetCurrentRowIndexAOrderID(int maxRows, int maxCols) { return _MyBridge.GetRowIndexAOrderID(Loginer.CurrentUser.Account, maxRows, maxCols); } /// /// 根据账户名称获得自定义常用功能列表 /// /// /// public DataTable GetCustomAction(string Account) { return _MyBridge.GetCustomAction(Account); } public DataTable GetMenuItems() { return _MyBridge.GetMenuItems(); } public DataTable GetRowIndexAOrderID(string Account, int maxRows, int maxCols) { return _MyBridge.GetRowIndexAOrderID(Account, maxRows, maxCols); } /// /// 添加 /// /// /// /// public bool InsertData(string FormFullName, string MenuName, string ButtonName) { var tmp = GetCurrentRowIndexAOrderID(BTN_ROWS, BTN_COLS); if (tmp == null || tmp.Rows.Count == 0) throw new Exception("已不能再添加!!可能数量已经达到最大!"); var dt = CommonData.GetEmptyTable(Globals.DEF_SYSTEM_DBID, sys_UserCustomAction.__TableName); var Row = dt.NewRow(); Row[sys_UserCustomAction.RowID] = Globals.NewRowID(); Row[sys_UserCustomAction.Account] = Loginer.CurrentUser.Account; Row[sys_UserCustomAction.FormFullName] = FormFullName; Row[sys_UserCustomAction.MenuName] = MenuName; Row[sys_UserCustomAction.ButtonName] = ButtonName; Row[sys_UserCustomAction.SizeW] = 0; Row[sys_UserCustomAction.SizeH] = 0; Row[sys_UserCustomAction.RowIndex] = tmp.Rows[0]["RowIndex"]; Row[sys_UserCustomAction.OrderID] = tmp.Rows[0]["OrderID"]; dt.Rows.Add(Row); return base.Update(dt); } public bool ResetCustomActions(string Account) { return _MyBridge.ResetCustomActions(Account); } } }