啊鑫
2024-07-09 0552fcc8cb73fc3021e2915129f55a42ed3f20e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#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);
        }
 
        /// <summary>
        ///     刪除
        /// </summary>
        /// <param name="FormFullName"></param>
        /// <param name="MenuName"></param>
        /// <returns></returns>
        public bool Delete(string FormFullName, string MenuName)
        {
            return _MyBridge.Delete(Loginer.CurrentUser.Account, FormFullName,
                MenuName);
        }
 
        /// <summary>
        ///     是否存在
        /// </summary>
        /// <param name="FormFullName"></param>
        /// <param name="MenuName"></param>
        /// <returns></returns>
        public bool Exist(string FormFullName, string MenuName)
        {
            return _MyBridge.Exist(Loginer.CurrentUser.Account, FormFullName,
                MenuName);
        }
 
        /// <summary>
        ///     获得当前用户自定义常用功能列表
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        public DataTable GetCurrentCustomAction()
        {
            return GetCustomAction(Loginer.CurrentUser.Account);
        }
 
        public DataTable GetCurrentRowIndexAOrderID(int maxRows, int maxCols)
        {
            return _MyBridge.GetRowIndexAOrderID(Loginer.CurrentUser.Account,
                maxRows, maxCols);
        }
 
        /// <summary>
        ///     根据账户名称获得自定义常用功能列表
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        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);
        }
 
        /// <summary>
        ///     添加
        /// </summary>
        /// <param name="FormFullName"></param>
        /// <param name="MenuName"></param>
        /// <returns></returns>
        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);
        }
    }
}