yangle
2023-05-24 b129762a4bb5ec2cde5edf16bc9cbda57c73587d
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
 
namespace DAL
{
    public  class ClsXt_ModuleParameter:DBUtility.ClsXt_BaseBill
    {
        public Model.ClsXt_ModuleParameterMain omodel = new Model.ClsXt_ModuleParameterMain();
        public List<Model.ClsXt_ModuleParameterSub> DetailColl = new List<Model.ClsXt_ModuleParameterSub>();
 
        public ClsXt_ModuleParameter()
        {
            base.MvarItemKeySub = "Xt_ModuleParameterSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey="Xt_ModuleParameterMain";
            base.MvarReportTitle="模块参数设置";
            base.BillType = "8002";
            base.HBillSubType = "8002";
 
        }
 
        #region 固定代码
 
        ~ClsXt_ModuleParameter()
        {
            DetailColl = null;
        }
       
        #endregion   自定义方法
        //修改单据
        
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Xt_ModuleParameterMain   " +
                "(HInterID,HBillType,HUserID,HModuleName,HFreezeCol" +
                ",HFontSize,HHeadHeight,HContextHeight,HSortFlag,HSelTotal" +
                ") " +
                " values( " + omodel.HInterID.ToString() + ",'" + omodel.HBillType + "','" + omodel.HUserID.ToString () + "','" + omodel.HModuleName + "'," + omodel.HFreezeCol.ToString() +
                ", " + omodel.HFontSize.ToString() + "," + omodel.HHeadHeight.ToString() + "," + omodel.HContextHeight.ToString() + ",'" + omodel.HSortFlag + "','" + omodel.HSelTotal + "'" +
                ")");
                //插入子表
                foreach (Model.ClsXt_ModuleParameterSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Xt_ModuleParameterSub " +
                      " (HInterID,HEntryID,HCellName,HHideFlag,HDuiQi" +
                      ",HDecimal,HEditFlag" +
                      ") values("+ omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCellName + "'," + Convert.ToString(oSub.HHideFlag ? 1 : 0) + ",'" + oSub.HDuiQi.ToString() + "'" +
                      "," + oSub.HDecimal.ToString() + ",'" + oSub.HEditFlag + "'" +
                      ") ");
                }
                //
                //foreach (Model.ClsXt_ModuleParameterSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Xt_ModuleParameter_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                //
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Xt_ModuleParameterMain Where HInterID=" + lngBillKey.ToString(), "Xt_ModuleParameterMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
              
                //========================================================
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HUserID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUserID"]);
                omodel.HModuleName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HModuleName"]);
                omodel.HFreezeCol = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HFreezeCol"]);
                omodel.HFontSize = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HFontSize"]);
                omodel.HHeadHeight = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HHeadHeight"]);
                omodel.HContextHeight = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HContextHeight"]);
                omodel.HSortFlag = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSortFlag"]);
                omodel.HSelTotal = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSelTotal"]);
                //
                
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Xt_ModuleParameterSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Xt_ModuleParameterSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsXt_ModuleParameterSub oSub = new Model.ClsXt_ModuleParameterSub();
                    // 固定赋值===============================================
                   
                    //===================================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HCellName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCellName"]);
                    oSub.HHideFlag = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HHideFlag"]);
                    oSub.HDuiQi = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDuiQi"]);
                    oSub.HEditFlag = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HEditFlag"]);
                    oSub.HDecimal = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDecimal"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
 
        //审核
        //public bool CheckBill(Int64 lngBillKey, ref string sReturn)
        //{
 
        //    try
        //    {
        //        string HChecker = DBUtility.ClsPub.CurUserName;
        //        string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
        //        oCn.RunProc(" Update Xt_ModuleParameterMain set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
        //        oCn.RunProc("exec h_p_Gy_Employee_Update " + lngBillKey.ToString());
        //        sReturn = "";
        //        return true;
        //    }
        //    catch (Exception e)
        //    {
        //        sReturn = e.Message;
        //        throw (e);
        //    }
        //}
       
        
    }
 
}