using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsHR_EmpEngageRequestBill:DBUtility.ClsXt_BaseBill { public Model.ClsHR_EmpEngageRequestBillMain omodel = new Model.ClsHR_EmpEngageRequestBillMain(); public List DetailColl = new List(); public ClsHR_EmpEngageRequestBill() { base.MvarItemKeySub = "HR_EmpEngageRequestBillSub"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey="HR_EmpEngageRequestBillMain"; base.MvarReportTitle = "入职申请"; base.BillType = "2301"; base.HBillSubType = "2301"; } #region 固定代码 ~ClsHR_EmpEngageRequestBill() { DetailColl = null; } #endregion 自定义方法 //修改单据 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { try { // oCn.BeginTran(); //更新主表 oCn.RunProc("UpDate HR_EmpEngageRequestBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //固定赋值=============== ",HDate='" + omodel.HDate + "'" + ",HYear='" + omodel.HYear.ToString() + "'" + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + ",HRemark='" + omodel.HRemark + "'" + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + ",HUpDateDate=getdate()" + //======================================== ",HName='" + omodel.HName + "'" + ",HSex='" + omodel.HSex + "'" + ",HMarr='" + omodel.HMarr + "'" + ",HBirthday='" + omodel.HBirthday + "'" + ",HAge=" + omodel.HAge.ToString() + ",HBlighty='" + omodel.HBlighty + "'" + ",HNation='" + omodel.HNation + "'" + ",HBlightyType='" + omodel.HBlightyType + "'" + ",HGovStatus='" + omodel.HGovStatus + "'" + ",HBloodType='" + omodel.HBloodType + "'" + ",HStature='" + omodel.HStature + "'" + ",HAvoird='" + omodel.HAvoird + "'" + ",HKnowLev='" + omodel.HKnowLev + "'" + ",HProTitleID='" + omodel.HProTitleID + "'" + ",HWantPay=" + omodel.HWantPay.ToString() + ",HGradSchool='" + omodel.HGradSchool + "'" + ",HGradDate='" + omodel.HGradDate + "'" + ",HEngLev='" + omodel.HEngLev + "'" + ",HCompLev='" + omodel.HCompLev + "'" + ",HSpec='" + omodel.HSpec + "'" + ",HEmail='" + omodel.HEmail + "'" + ",HNowAdd='" + omodel.HNowAdd + "'" + ",HHomeAdd='" + omodel.HHomeAdd + "'" + ",HIDCard='" + omodel.HIDCard + "'" + ",HPostalCode='" + omodel.HPostalCode + "'" + ",HLinkPhone='" + omodel.HLinkPhone + "'" + ",HOldCompany='" + omodel.HOldCompany + "'" + ",HInsuranceStatus=" + Convert.ToString(omodel.HInsuranceStatus ? 1 : 0) + ",HInsuranceDate='" + omodel.HInsuranceDate + "'" + ",HInsuranceNo='" + omodel.HInsuranceNo + "'" + ",HContractBDate='" + omodel.HContractBDate + "'" + ",HContractYear=" + omodel.HContractYear.ToString() + ",HContractEDate='" + omodel.HContractEDate + "'" + ",HJobCardEDate='" + omodel.HJobCardEDate + "'" + ",HJobCardNo='" + omodel.HJobCardNo + "'" + ",HCheckCardEDate='" + omodel.HCheckCardEDate + "'" + ",HStayCardEDate='" + omodel.HStayCardEDate + "'" + ",HHealthCardEDate='" + omodel.HHealthCardEDate + "'" + ",HArchivesNo='" + omodel.HArchivesNo + "'" + " where HInterID=" + lngBillKey.ToString()); //删除关联 DeleteRelation(ref sReturn, lngBillKey); //删除子表 DeleteBillSub(lngBillKey); //插入子表 omodel.HInterID = lngBillKey; foreach (Model.ClsHR_EmpEngageRequestBillSub oSub in DetailColl) { oCn.RunProc("Insert into HR_EmpEngageRequestBillSub " + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + ") "); } // //foreach (Model.ClsHR_EmpEngageRequestBillSub oSub in DetailColl) //{ // Ds = oCn.RunProcReturn("exec h_p_HR_EmpEngageRequestBill_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 AddBill(ref string sReturn) { try { //得到mainid omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); //若MAINDI重复则重新获取 oCn.BeginTran(); //主表 oCn.RunProc("Insert Into HR_EmpEngageRequestBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + ",HName,HSex,HMarr,HBirthday,HAge" + ",HBlighty,HNation,HBlightyType,HGovStatus,HBloodType"+ ",HStature,HAvoird,HKnowLev,HProTitleID,HWantPay" + ",HGradSchool,HGradDate,HEngLev,HCompLev,HSpec" + ",HEmail,HNowAdd,HHomeAdd,HIDCard,HPostalCode" + ",HLinkPhone,HOldCompany,HInsuranceStatus,HInsuranceDate,HInsuranceNo" + ",HContractBDate,HContractYear,HContractEDate,HJobCardEDate,HJobCardNo" + ",HCheckCardEDate,HStayCardEDate,HHealthCardEDate,HArchivesNo" + ") " + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + ",'" + omodel.HName + "','" + omodel.HSex + "','" + omodel.HMarr + "','" + omodel.HBirthday + "'," + omodel.HAge.ToString() + ",'" + omodel.HBlighty + "','" + omodel.HNation + "','" + omodel.HBlightyType + "','" + omodel.HGovStatus + "','" + omodel.HBloodType + "'" + ",'" + omodel.HStature + "','" + omodel.HAvoird + "','" + omodel.HKnowLev + "','" + omodel.HProTitleID + "'," + omodel.HWantPay.ToString() + ",'" + omodel.HGradSchool + "','" + omodel.HGradDate + "','" + omodel.HEngLev + "','" + omodel.HCompLev + "','" + omodel.HSpec + "'" + ",'" + omodel.HEmail + "','" + omodel.HNowAdd + "','" + omodel.HHomeAdd + "','" + omodel.HIDCard + "','" + omodel.HPostalCode + "'" + ",'" + omodel.HLinkPhone + "','" + omodel.HOldCompany + "'," + Convert.ToString(omodel.HInsuranceStatus ? 1 : 0) + ",'" + omodel.HInsuranceDate + "','" + omodel.HInsuranceNo + "'" + ",'" + omodel.HContractBDate + "'," + omodel.HContractYear.ToString() + ",'" + omodel.HContractEDate + "','" + omodel.HJobCardEDate + "','" + omodel.HJobCardNo + "'" + ",'" + omodel.HCheckCardEDate + "','" + omodel.HStayCardEDate + "','" + omodel.HHealthCardEDate + "','" + omodel.HArchivesNo + "'" + ") "); //插入子表 foreach (Model.ClsHR_EmpEngageRequestBillSub oSub in DetailColl) { oCn.RunProc("Insert into HR_EmpEngageRequestBillSub " + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + ") "); } // //foreach (Model.ClsHR_EmpEngageRequestBillSub oSub in DetailColl) //{ // Ds = oCn.RunProcReturn("exec h_p_HR_EmpEngageRequestBill_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 HR_EmpEngageRequestBillMain Where HInterID=" + lngBillKey.ToString(), "HR_EmpEngageRequestBillMain"); if(Ds.Tables[0].Rows.Count==0) { sReturn = "单据未找到!"; return false; } //固定赋值=========================================== omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim(); omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); //======================================================== omodel.HName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HName"]); omodel.HSex = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSex"]); omodel.HMarr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMarr"]); omodel.HBirthday = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBirthday"]); omodel.HAge = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HAge"]); omodel.HBlighty = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBlighty"]); omodel.HNation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HNation"]); omodel.HBlightyType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBlightyType"]); omodel.HGovStatus = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HGovStatus"]); omodel.HBloodType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBloodType"]); omodel.HStature = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HStature"]); omodel.HAvoird = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAvoird"]); omodel.HKnowLev = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HKnowLev"]); omodel.HProTitleID = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProTitleID"]); omodel.HWantPay = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HWantPay"]); omodel.HGradSchool = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HGradSchool"]); omodel.HGradDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HGradDate"]); omodel.HEngLev = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEngLev"]); omodel.HCompLev = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCompLev"]); omodel.HSpec = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSpec"]); omodel.HEmail = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEmail"]); omodel.HNowAdd = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HNowAdd"]); omodel.HHomeAdd = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HHomeAdd"]); omodel.HIDCard = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HIDCard"]); omodel.HPostalCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HPostalCode"]); omodel.HLinkPhone = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkPhone"]); omodel.HOldCompany = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOldCompany"]); omodel.HInsuranceStatus = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HInsuranceStatus"]); omodel.HInsuranceDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HInsuranceDate"]); omodel.HInsuranceNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInsuranceNo"]); omodel.HContractBDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HContractBDate"]); omodel.HContractYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HContractYear"]); omodel.HContractEDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HContractEDate"]); omodel.HJobCardEDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HJobCardEDate"]); omodel.HJobCardNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HJobCardNo"]); omodel.HCheckCardEDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HCheckCardEDate"]); omodel.HStayCardEDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HStayCardEDate"]); omodel.HHealthCardEDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HHealthCardEDate"]); omodel.HArchivesNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HArchivesNo"]); // //循环 DataSet DsSub ; DsSub = oCn.RunProcReturn("Select * from HR_EmpEngageRequestBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "HR_EmpEngageRequestBillSub"); DetailColl.Clear();//清空 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { Model.ClsHR_EmpEngageRequestBillSub oSub = new Model.ClsHR_EmpEngageRequestBillSub(); // 固定赋值=============================================== oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); //=================================================== DetailColl.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //录入 public bool InPutBill(Int64 lngBillKey, ref string sReturn) { try { oCn.RunProc("exec h_p_Gy_Employee_Add " + lngBillKey.ToString()); sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } } }