using System; using System.Collections.Generic; using System.Text; using System.Data; using Model; namespace DAL { public class ClsOA_EmpMinMessage:DBUtility.ClsXt_BaseBill { public Model.ClsOA_EmpMinMessage omodel = new Model.ClsOA_EmpMinMessage(); public ClsOA_EmpMinMessage() { base.MvarItemKeySub = ""; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey = "OA_EmpMinMessage"; base.MvarReportTitle="个人微讯"; base.BillType = "4528"; base.HBillSubType = "4528"; } #region 固定代码 ~ClsOA_EmpMinMessage() { //DetailColl = null; } #endregion 自定义方法 //修改单据 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { try { // oCn.BeginTran(); //更新主表 oCn.RunProc("UpDate OA_EmpMinMessage set " + ",HDate='" + omodel.HDate.ToShortDateString() + "'" + ",HSendMan='" + omodel.HSendMan + "'" + ",HReceiveMan='" + omodel.HReceiveMan + "'" + ",HDescription='" + omodel.HDescription + "'" + ",HBillType='" + omodel.HBillType + "'" + ",HBillStatus='" + omodel.HBillStatus.ToString() + ",HReadFlag='" + Convert.ToString(omodel.HReadFlag ? 1 : 0) + ",HSystemFlag='" + Convert.ToString(omodel.HSystemFlag ? 1 : 0) + " where HItemID=" + lngBillKey.ToString()); 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 OA_EmpMinMessage " + "(HDate,HSendMan,HReceiveMan,HDescription" + ",HBillType,HBillStatus,HReadFlag,HSystemFlag" + ") " + " values('" + omodel.HDate + "','" + omodel.HSendMan + "','" + omodel.HReceiveMan + "','" + omodel.HDescription + "'" + ",'" + omodel.HBillType + "'," + omodel.HBillStatus.ToString() + "," + Convert.ToString(omodel.HReadFlag ? 1 : 0) +","+ Convert.ToString(omodel.HSystemFlag ? 1 : 0) + ") "); 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 OA_EmpMinMessage Where HItemID=" + lngBillKey.ToString(), "OA_EmpMinMessage"); if (Ds.Tables[0].Rows.Count == 0) { sReturn = "单据未找到!"; return false; } //固定赋值=========================================== omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); omodel.HBillStatus = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBillStatus"]); omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); omodel.HDescription = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDescription"]); omodel.HSendMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSendMan"]); omodel.HReceiveMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveMan"]); omodel.HReadFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HReadFlag"]); omodel.HSystemFlag = DBUtility.ClsPub.isBool( Ds.Tables[0].Rows[0]["HSystemFlag"]); sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } } }