using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace BLL
|
{
|
public class ClsGy_MaxNum_Ctl:DBUtility.ClsGy_Base_Ctl
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//原代码 用于 替换子项目
|
public string HOldNumber;
|
public ClsGy_MaxNum_Model oModel = new ClsGy_MaxNum_Model();
|
//新增
|
public bool AddNew( ref string sReturn)
|
{
|
try
|
{
|
//是否重复单据类型
|
//if (HavBillCode(oModel.BillCode))
|
//{
|
// sReturn = "单据类型重复!";
|
// return false;
|
//}
|
oCn.BeginTran();
|
oCn.RunProc("Insert into " + MvarItemKey + " " +
|
" (BillCode,WhCode,KjYear,Period,NowNumber) " +
|
" Values('" + oModel.BillCode + "','" + oModel.WhCode + "'," + oModel.KjYear.ToString() + "," + oModel.Period.ToString() + "," + oModel.NowNumber.ToString() +
|
")", ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
sReturn = "保存成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
sReturn = "保存失败!";
|
throw (e);
|
}
|
}
|
|
//修改
|
public bool ModifyByID(string sItemID)
|
{
|
try
|
{
|
oCn.BeginTran();
|
oCn.RunProc("Update " + MvarItemKey + " set " +
|
" WhCode='" + oModel.WhCode + "'" +
|
",BillCode='" + oModel.BillCode + "'" +
|
",KjYear=" + oModel.KjYear.ToString() +
|
",Period=" + oModel.Period.ToString() +
|
",NowNumber=" + oModel.NowNumber.ToString() + " Where BillCode='" + sItemID + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//重复单据类型
|
public bool HavBillCode(string sItemID)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select BillCode from " + MvarItemKey + " Where BillCode = '" + sItemID + "'", MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
oModel.BillCode = Convert.ToString(DS.Tables[0].Rows[0]["BillCode"]);
|
return true;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
//删除
|
public bool DeleteByCode(string sCode, string sWhCode)
|
{
|
try
|
{
|
oCn.RunProc("Delete from " + MvarItemKey + " where BillCode='" + sCode + "'and WhCode='" + sWhCode + "'", ref Pub_Class.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
//构造函数
|
public ClsGy_MaxNum_Ctl()
|
{
|
MvarItemKey = "Gy_MaxNum";
|
MvarReportTitle = "单据内码规则表设置";
|
oModel = new ClsGy_MaxNum_Model();
|
}
|
}
|
}
|