1
yhj
2024-07-24 5e5d945e91568b973faa27d8ab0bcef99fc4a6c5
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
#region
 
using System.Data;
using CSFrameworkV5.Common;
using CSFrameworkV5.Core;
using CSFrameworkV5.DataAccess;
using CSFrameworkV5.Interfaces.Bridge;
using CSFrameworkV5.Models;
using CSFrameworkV5.WebRef;
 
#endregion
 
namespace CSFrameworkV5.Business
{
    public class bllDocNoRule : bllBaseDataDict
    {
        private IBridge_DocNoRule _Bridge;
 
        public bllDocNoRule()
        {
            _KeyFieldName = sys_DocNoRule.__KeyName; //主键字段
            _SummaryTableName = sys_DocNoRule.__TableName; //表名
            _DataDictBridge =
                BridgeFactory.CreateDataDictBridge(typeof(sys_DocNoRule));
            _Bridge = CreateBridge();
        }
 
        public bool CheckNoExistsEx(string DBID, string docCode)
        {
            return _Bridge.CheckNoExistsEx(DBID, docCode);
        }
 
        private IBridge_DocNoRule CreateBridge()
        {
            if (BridgeFactory.IsADODirect) //直连模式
                return new dal_DocNoRule(Loginer.CurrentUser);
 
            if (BridgeFactory.IsWCFBridge) return new WCF_DocNoRule();
 
            if (BridgeFactory.BridgeType != BridgeType.ADODirect)
                throw new CustomException("请使用ADO-Direct模式测试!");
 
            return null;
        }
 
        public void CreateDataBinder(string DBID, string keyValue)
        {
            _DataBinder = GetDataByKey(DBID, keyValue);
        }
 
        public bool Delete(string DBID, string keyValue)
        {
            return _Bridge.Delete(DBID, keyValue);
        }
 
        public DataTable GetDataByKey(string DBID, string keyValue)
        {
            return _Bridge.GetDataByKey(DBID, keyValue);
        }
 
        public DataTable GetSummaryData(string DBID, bool resetCurrent)
        {
            var data = _Bridge.GetData(DBID);
            SetDefault(data);
            if (resetCurrent) _SummaryTable = data;
 
            return data;
        }
 
        public bool UpdateToDB(string DBID)
        {
            _DataBinder.Rows[0].EndEdit();
            UpdateDetailCommonValue(_DataBinder);
 
            return _Bridge.UpdateToDB(DBID, _DataBinder);
        }
    }
}