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 DetailColl = new List(); 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); // } //} } }