using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsGy_CusNumberRelation_Ctl : DBUtility.ClsGy_Base_Ctl
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//原代码 用于 替换子项目
|
public string HOldNumber;
|
public List<Model.ClsGy_CusNumberRelation_Model> DetailColl = new List<Model.ClsGy_CusNumberRelation_Model>();
|
|
|
|
//反审核
|
public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
oCn.RunProc(" Update Gy_CusNumberRelation set HChecker='',HCheckDate=null Where HItemID=" + lngBillKey.ToString());
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//审核
|
public bool CheckBill(Int64 lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
oCn.RunProc(" Update Gy_CusNumberRelation set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate='" + DBUtility.ClsPub.GetServerDate(-1) + "' Where HItemID=" + lngBillKey.ToString());
|
//
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
|
//新增
|
public override bool AddNew()
|
{
|
|
try
|
{
|
oCn.BeginTran();
|
//插入子表
|
foreach (Model.ClsGy_CusNumberRelation_Model oSub in DetailColl)
|
{
|
oCn.RunProc("Insert into Gy_CusNumberRelation " +
|
" (HInterID,HEntryID,HBeginDate,HEndDate" +
|
",HRemark,HMaker,HMakeDate,HUsed" +
|
",HCusID,HMaterID,HCusRelationNumber" +
|
",HCusRelationName,HBarCodeCheckTypeID)" +
|
" values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBeginDate.ToShortDateString() + "','" + oSub.HEndDate.ToShortDateString() + "'" +
|
",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) +
|
", " + oSub.HCusID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HCusRelationNumber + "'" +
|
",'" + oSub.HCusRelationName + "'," + oSub.HBarCodeCheckTypeID.ToString() + ") ");
|
}
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//修改
|
public override bool ModifyByID(Int64 sItemID)
|
{
|
try
|
{
|
oCn.BeginTran();
|
DeleteByID(sItemID); //删除记录
|
//插入表
|
foreach (Model.ClsGy_CusNumberRelation_Model oSub in DetailColl)
|
{
|
oCn.RunProc("Insert into Gy_CusNumberRelation " +
|
" (HInterID,HEntryID,HBeginDate,HEndDate" +
|
",HRemark,HMaker,HMakeDate,HUsed" +
|
",HCusID,HMaterID,HCusRelationNumber" +
|
",HCusRelationName,HBarCodeCheckTypeID)" +
|
" values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBeginDate.ToShortDateString() + "','" + oSub.HEndDate.ToShortDateString() + "'" +
|
",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) +
|
", " + oSub.HCusID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HCusRelationNumber + "'" +
|
",'" + oSub.HCusRelationName + "'," + oSub.HBarCodeCheckTypeID.ToString() + ") ");
|
}
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//显示单据
|
public bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet DsSub = new DataSet();
|
DsSub = oCn.RunProcReturn("Select * from Gy_CusNumberRelation Where HitemID=" + lngBillKey.ToString(), "Gy_CusNumberRelation");
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsGy_CusNumberRelation_Model oSub = new Model.ClsGy_CusNumberRelation_Model();
|
oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
|
oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
|
oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]);
|
oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]);
|
oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
|
oSub.HMaker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaker"]);
|
oSub.HMakeDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMakeDate"]);
|
oSub.HChecker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HChecker"]);
|
oSub.HCheckDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCheckDate"]);
|
oSub.HUsed = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HUsed"]);
|
//-----------------------------------------------------------------------------------
|
oSub.HCusID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCusID"]);
|
oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
|
oSub.HCusRelationNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCusRelationNumber"]);
|
oSub.HCusRelationName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCusRelationName"]);
|
oSub.HBarCodeCheckTypeID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HBarCodeCheckTypeID"]);
|
|
DetailColl.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//构造函数
|
public ClsGy_CusNumberRelation_Ctl()
|
{
|
MvarItemKey = "Gy_CusNumberRelation";
|
MvarReportTitle = "客户代码对应表资料";
|
}
|
}
|
}
|