You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Import/DAL/Comm/MsChFeeDAL.cs

715 lines
32 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text;
using DSWeb.Areas.Import.Models.Comm;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace DSWeb.Areas.Import.DAL.Comm
{
public class MsChFeeDAL
{
#region 查询费用数据
static public List<MsChFee> GetDataList(string strCondition,string USERID)
{
return GetDataList(strCondition, "", USERID);
}
static public List<MsChFee> GetDataList(string strCondition,string sort,string USERID)
{
//20160617 增加对机密费用的支持
var isopen = MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", USERID);
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append("GId,PaymentGID,BsNo,FeeStatus,");
strSql.Append("(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=ch_fee.FeeStatus) as FeeStatus_Ref");
strSql.Append(",FeeType,");
strSql.Append("(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99020 and EnumValueID=ch_fee.FeeType) as FeeType_Ref");
strSql.Append(",FeeName,");
strSql.Append("FeeName as FeeName_Ref");
strSql.Append(",FeeDescription,CustomerType,CustomerName,");
strSql.Append("(select top 1 CustName from vMsTruckClient where CustName=ch_fee.CustomerName) as CustomerName_Ref");
strSql.Append(",Unit,UnitPrice,Quantity,Amount,Currency,ExChangerate,Reason");
strSql.Append(",Remark,Commissionrate,Settlement,Invoice,OrderAmount,OrderInvoice,SubmitDate");
strSql.Append(",(select showname from [user] where gid=ch_fee.Auditoperator) Auditoperator,AuditDate,EnteroPerator,EnterDate,DebitNo,IsDebit");
strSql.Append(",IsOpen,case IsOpen when '0' then '否' when 1 then '是' else '' end IsOpen_Ref");
strSql.Append(",IsAdvancedpay,Sort,IsInvoice,FeeFrt,IsCrmOrderFee,AuditStatus,InvoiceNum");
strSql.Append(",ChequeNum,WmsOutBsNo,accdate,voucherno");
strSql.Append(",(select ShowName from [user] where GID=ch_fee.EnteroPerator) as OpName");
strSql.Append(",dbo.F_SettlementDate(gid,1) SettlementDate ");
strSql.Append(",CARGO_GID,(select name from import_cargo where gid=CARGO_GID) CARGO_NAME ");
strSql.Append(" from ch_fee ");
if (strCondition.Trim() != String.Empty)
{
if (isopen == false)
{
strSql.Append(" where " + strCondition + " and (ISOPEN=0 or EnteroPerator='" + USERID + "')");
}else
strSql.Append(" where " + strCondition );
}
else {
strSql.Append(" where (ISOPEN=0 or EnteroPerator='" + USERID + "')");
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}else
{
strSql.Append(" order by sort" );
}
return SetData(strSql);
}
private static List<MsChFee> SetData(StringBuilder strSql)
{
var bodyList = new List<MsChFee>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
MsChFee data = new MsChFee();
#region Set DB data to Object
data.GId = Convert.ToString(reader["GId"]);
data.PaymentGID = Convert.ToString(reader["PaymentGID"]);
data.BsNo = Convert.ToString(reader["BsNo"]);
data.FeeStatus = Convert.ToDecimal(reader["FeeStatus"]);
data.FeeStatus_Ref = Convert.ToString(reader["FeeStatus_Ref"]);
data.FeeType = Convert.ToDecimal(reader["FeeType"]);
data.FeeType_Ref = Convert.ToString(reader["FeeType_Ref"]);
data.FeeName = Convert.ToString(reader["FeeName"]);
data.FeeName_Ref = Convert.ToString(reader["FeeName_Ref"]);
data.FeeDescription = Convert.ToString(reader["FeeDescription"]);
data.CustomerType = Convert.ToString(reader["CustomerType"]);
data.CustomerName = Convert.ToString(reader["CustomerName"]);
data.CustomerName_Ref = Convert.ToString(reader["CustomerName_Ref"]);
data.Unit = Convert.ToString(reader["Unit"]);
data.UnitPrice = Convert.ToDecimal(reader["UnitPrice"]);
data.Quantity = Convert.ToDecimal(reader["Quantity"]);
data.Amount = Convert.ToDecimal(reader["Amount"]);
data.Currency = Convert.ToString(reader["Currency"]);
data.ExChangerate = Convert.ToDecimal(reader["ExChangerate"]);
data.Reason = Convert.ToString(reader["Reason"]);
data.Remark = Convert.ToString(reader["Remark"]);
data.Commissionrate = Convert.ToDecimal(reader["Commissionrate"]);
data.Settlement = Convert.ToDecimal(reader["Settlement"]);
if (reader["Invoice"] != DBNull.Value)
data.Invoice = Convert.ToDecimal(reader["Invoice"]);
data.OrderAmount = Convert.ToDecimal(reader["OrderAmount"]);
data.OrderInvoice = Convert.ToDecimal(reader["OrderInvoice"]);
if (reader["SubmitDate"] != DBNull.Value)
data.SubmitDate = Convert.ToDateTime(reader["SubmitDate"]);
data.Auditoperator = Convert.ToString(reader["Auditoperator"]);
if (reader["AuditDate"] != DBNull.Value)
data.AuditDate = Convert.ToDateTime(reader["AuditDate"]);
data.EnteroPerator = Convert.ToString(reader["EnteroPerator"]);
if (reader["EnterDate"] != DBNull.Value)
data.EnterDate = Convert.ToDateTime(reader["EnterDate"]);
data.DebitNo = Convert.ToString(reader["DebitNo"]);
data.IsDebit = Convert.ToString(reader["IsDebit"]);
data.IsOpen = Convert.ToString(reader["IsOpen"]);
data.IsOpen_Ref = Convert.ToString(reader["IsOpen_Ref"]);
data.IsAdvancedpay = Convert.ToString(reader["IsAdvancedpay"]);
data.Sort = Convert.ToString(reader["Sort"]);
data.IsInvoice = Convert.ToString(reader["IsInvoice"]);
data.FeeFrt = Convert.ToString(reader["FeeFrt"]);
data.IsCrmOrderFee = Convert.ToString(reader["IsCrmOrderFee"]);
data.AuditStatus = Convert.ToDecimal(reader["AuditStatus"]);
data.InvoiceNum = Convert.ToString(reader["InvoiceNum"]);
data.ChequeNum = Convert.ToString(reader["ChequeNum"]);
data.WmsOutBsNo = Convert.ToString(reader["WmsOutBsNo"]);
data.ACCDATE = Convert.ToString(reader["ACCDATE"]);
data.VOUCHERNO = Convert.ToString(reader["VOUCHERNO"]);
data.OpName = Convert.ToString(reader["OpName"]);
data.CARGO_GID = Convert.ToString(reader["CARGO_GID"]);
data.CARGO_NAME = Convert.ToString(reader["CARGO_NAME"]);
#endregion
bodyList.Add(data);
}
reader.Close();
}
return bodyList;
}
#endregion
#region 提交申请
// 根据handle类型执行更新操作更新费用信息ch_fee.feestatus和工作流运行表WorkFlowDo信息
// 费用状态值 费用状态主要有11个状态,分别为审核通过STATUS=0录入状态STATUS=1提交审核STATUS=2申请修改 (STATUS=3)
// 取消申请(STATUS=5)驳回提交STATUS=6驳回申请STATUS=7部分结算STATUS=8结算完毕STATUS=9
internal static DBResult Audit(int newStatus, List<MsChFee> chfeeList,string USERID,string CanDo)
{
var result = new DBResult();
var NewStatusList = new List<NewStatusmb>();
result.Data = NewStatusList;
foreach (var chFee in chfeeList)
{
var status = chFee.FeeStatus;
var canAudit = true;
if (newStatus == 2)
{
canAudit = status == 1 || status == 6;
}
else if (newStatus == 0)
{
canAudit = status == 2 || status == 10;
}
else if (newStatus == 6)
{
canAudit = status == 0 || status == 2;
}
else if (newStatus == 8 || newStatus == 9)
{
canAudit = status == 0 ;
}
else if (newStatus == 10)
{
canAudit = status == 0 || status == 1 || status == 2;
}
if (!canAudit)
{
result.Success = false;
if (newStatus == 2)
result.Message = "只有在'录入状态'和'驳回提交'状态下才能进行 提交审核 操作";
else if (newStatus == 0)
{
result.Message = "只有在‘提交审核’状态下才能进行 审核通过 操作";
}
else if (newStatus == 6)
{
result.Message = "只有在‘审核通过’或‘提交审核’状态下才能进行 驳回提交 操作";
}
else if (newStatus == 8 || newStatus == 9)
{
result.Message = "只有在‘审核通过’状态下才能进行 结算 操作";
}
else if (newStatus == 10)
{
result.Message = "只有在‘审核通过’或‘提交审核’或‘录入状态’状态下才能进行 提交融资 操作";
}
return result;
}
}
var feeBsNoList = new List<string>();
foreach (var msChFee in chfeeList)
{
var bsNo = msChFee.BsNo;
if (!feeBsNoList.Contains(bsNo))
{
feeBsNoList.Add(bsNo);
}
}
Database db = DatabaseFactory.CreateDatabase();
//费用名称,结算对象,金额,币别,汇率。
if (newStatus != 6)
{
foreach (var chFee in chfeeList)
{
if (chFee.FeeName == "" || chFee.CustomerName == "" || chFee.Amount == 0 || chFee.Currency == "" || chFee.ExChangerate == 0)
{
result.Success = false;
result.Message = "费用名称,结算对象,金额,币别,汇率都必须填写。";
return result;
}
/*
if ((chFee.Currency=="RMB" && chFee.ExChangerate!=1) || (chFee.Currency!="RMB" && chFee.ExChangerate==1) )
{
result.Success = false;
result.Message = "币别或汇率异常";
return result;
}*/
}
}
var feeGIdList = new List<string>();
foreach (var msChFee in chfeeList)
{
var GId = msChFee.GId;
if (!feeGIdList.Contains(GId))
{
feeGIdList.Add(GId);
}
}
//费用已生成凭证后不允许驳回。
foreach (var GId in feeGIdList)
{
if (newStatus == 6)
{
string sql = string.Empty;
sql = "select case when ISVOU=1 or (ACCDATE<>'' and accdate is not null) ";
sql = sql + " then 1 else 0 end FeeStatus from ch_fee where bsno like '%XXH%' and Gid=@gid";
var cmdFeeStatus = db.GetSqlStringCommand(sql);
db.AddInParameter(cmdFeeStatus, "@gid", DbType.String, GId);
var feeStatus = Convert.ToString(db.ExecuteScalar(cmdFeeStatus));
if (feeStatus == "1")
{
result.Success = false;
result.Message = "费用已经锁定或已生成凭证,不允许驳回或撤回";
return result;
}
}
if (newStatus == 6)
{
string sql = string.Empty;
sql = " select isnull(count(*),0) from ch_fee_do where FEEID=@gid and (isdeleted is null or isdeleted=0) ";
sql = sql + " and CATEGORY in (4,5,6) ";
//sql = sql + " and (BILLNO like '%AC%' or BILLNO like '%AD%' or BILLNO like '%IA%') ";
var cmdFeeStatus = db.GetSqlStringCommand(sql);
db.AddInParameter(cmdFeeStatus, "@gid", DbType.String, GId);
var feeStatus = Convert.ToInt32(db.ExecuteScalar(cmdFeeStatus));
if (feeStatus >0)
{
result.Success = false;
result.Message = "费用已经进入申请流程,不允许驳回或撤回";
return result;
}
}
}
//申请流程,不允许驳回或撤回。
foreach (var msChFee in chfeeList)
{
var GId = msChFee.GId;
var feetype = msChFee.FeeType;
if (feetype==1)
{
string sql = string.Empty;
sql = "select count(cfd.gid) _count from ch_fee c ";
sql = sql + "left join ch_fee_do cfd on cfd.feeid=c.gid ";
sql = sql + " left join ch_fee_recvapplication cfp on cfp.applicant=cfd.gid ";
sql = sql + " where c.gid='" + GId + "' ";
sql = sql + " and (cfd.isdeleted<>1 or cfd.isdeleted is null) ";
var cmdFeeStatus = db.GetSqlStringCommand(sql);
db.AddInParameter(cmdFeeStatus, "@gid", DbType.String, GId);
var _count = Convert.ToInt16(db.ExecuteScalar(cmdFeeStatus));
if (_count > 0)
{
result.Success = false;
result.Message = "费用已经处于收费申请流程,不允许驳回或撤回";
return result;
}
}
if (feetype == 2)
{
string sql = string.Empty;
sql = "select count(cfd.gid) _count from ch_fee c ";
sql = sql + "left join ch_fee_do cfd on cfd.feeid=c.gid ";
sql = sql + " left join ch_fee_payapplication cfp on cfp.applicant=cfd.gid ";
sql = sql + " where c.gid='" + GId + "' ";
sql = sql + " and (cfd.isdeleted<>1 or cfd.isdeleted is null) ";
var cmdFeeStatus = db.GetSqlStringCommand(sql);
db.AddInParameter(cmdFeeStatus, "@gid", DbType.String, GId);
var _count = Convert.ToInt16(db.ExecuteScalar(cmdFeeStatus));
if (_count > 0)
{
result.Success = false;
result.Message = "费用已经处于付费申请流程,不允许驳回或撤回";
return result;
}
//msChFee
if (newStatus == 2 && msChFee.Currency!="RMB"&&(msChFee.FeeName=="预付款"||msChFee.FeeName=="尾款"||msChFee.FeeName=="购货款"))
{
InsertRecord(msChFee,USERID);
}
if (newStatus == 6 && msChFee.Currency != "RMB" && (msChFee.FeeName == "预付款" || msChFee.FeeName == "尾款" || msChFee.FeeName == "购货款"))
{
DeleteRecord(msChFee.GId);
}
}
}
//20150727 增加逻辑
/*6
1
a.
b.
c.
2
a.
b.
c. */
/*newstatus=2
* newstatus0
()
* truenewstatu0
*/
/*20150930
*
*
-1
*
*/
const string selectSql = "select FeeStatus from ch_fee where gid=@gid";
var _T_update = "update ch_fee set FeeStatus=@FeeStatus, Auditdate=getdate() where gid=@gid";
if (newStatus==0)
{
_T_update = "update ch_fee set FeeStatus=@FeeStatus,Auditoperator=@Auditoperator, Auditdate=getdate() where gid=@gid";
}
//const string updateSql = const string _T_update;
const string enumSql =
"select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=@EnumValueID";
using (DbConnection connection = db.CreateConnection())
{
connection.Open();
try
{
result.Success = true;
foreach (var msChFee in chfeeList)
{
try
{
DbTransaction transaction = connection.BeginTransaction();
var cmdSelect = db.GetSqlStringCommand(selectSql);
db.AddInParameter(cmdSelect, "@gid", DbType.String, msChFee.GId);
var feeStatus = db.ExecuteScalar(cmdSelect, transaction);
var _newStatus = 1;
var canpass = false;
// if (CanDo != "True" && newStatus == 2) {
if (newStatus == 2) {
/////////////
//canpass = CanPass(msChFee);
///////////////
//if (canpass)
//{
_newStatus = 0;
//}
//else {
// _newStatus = newStatus;
//}
}
else _newStatus = newStatus;
var canRetract = true;
if (CanDo != "True" && msChFee.FeeStatus == 0 && newStatus == 6)
{
_newStatus = 6;
}
var cmdEnum = db.GetSqlStringCommand(enumSql);
db.AddInParameter(cmdEnum, "@EnumValueID", DbType.Int32, _newStatus);
var newStatusRef = Convert.ToString(db.ExecuteScalar(cmdEnum));
var newstatusItem = new NewStatusmb();
newstatusItem.NewStatus =Convert.ToString(_newStatus);
newstatusItem.NewStatusRef = newStatusRef;
NewStatusList.Add(newstatusItem);
if (feeStatus == null)
{
throw new MsChFeeDealException("'" + msChFee.FeeName + "'数据还没有保存,不想允许提交,请保存后重试!");
}
if (Convert.ToInt32(feeStatus) != msChFee.FeeStatus)
{
throw new MsChFeeDealException("'"+msChFee.FeeName+"'费用状态已经改变,不想允许提交,请刷新后重试!");
}
var cmdUpdate = db.GetSqlStringCommand(_T_update);
db.AddInParameter(cmdUpdate, "@FeeStatus", DbType.Int32, _newStatus);
db.AddInParameter(cmdUpdate, "@gid", DbType.String, msChFee.GId);
if (_newStatus==0)
{
db.AddInParameter(cmdUpdate, "@Auditoperator", DbType.String, USERID);
}
db.ExecuteNonQuery(cmdUpdate, transaction);
transaction.Commit();
}
catch (Exception e)
{
//transaction.Rollback();
result.Success = false;
if (e is MsChFeeDealException)
result.Message = e.Message;
else
result.Message = "执行提交发生未知错误,请重试";
}
if (result.Success == false) {
break;
}
result.Message = "提交成功";
result.Data = NewStatusList;
}
}
finally
{
connection.Close();
}
}
return result;
}
private static void SetBillFeeStatus(
string bsNo,
string feeOpStatus,
string updateBsBillSql,
string updatePcBillSql,
Database db,
DbTransaction transaction)
{
string sql = string.Empty;
if (bsNo.StartsWith("TMSBS"))
{
sql = updateBsBillSql;
}
else
{
sql = updatePcBillSql;
}
var cmdUpdate = db.GetSqlStringCommand(sql);
db.AddInParameter(cmdUpdate, "@FeeOpStatus", DbType.String, feeOpStatus); //驳回
db.AddInParameter(cmdUpdate, "@gid", DbType.String, bsNo);
db.ExecuteNonQuery(cmdUpdate, transaction);
}
private static int GetFeeStatusRecordCount(Database db, string bsNo, int feeStatus, DbTransaction transaction)
{
var cmdRejectCount = db.GetSqlStringCommand("select count(*) from ch_fee where BsNo=@BsNo and FeeStatus=@FeeStatus");
db.AddInParameter(cmdRejectCount, "@BsNo", DbType.String, bsNo);
db.AddInParameter(cmdRejectCount, "@FeeStatus", DbType.Int32, feeStatus);
var rejectCount = Convert.ToInt32(db.ExecuteScalar(cmdRejectCount, transaction));
return rejectCount;
}
#region 判断费用是否符合自动通过原则
static public Boolean CanPass(MsChFee msChFee)
{ //合同信息/商品信息
var strSql = new StringBuilder();
strSql.Append("select isnull(( select sum(amount) from ch_fee where feename in(" );
strSql.Append(" select name from code_fee where FEEGROUP=(select FEEGROUP from code_fee where name='" + msChFee .FeeName+ "')");
strSql.Append( " ) and feetype=1 and feestatus in(0,8,9,10,11)");
strSql.Append(" and bsno='" + msChFee.BsNo + "'),0) ys" );
strSql.Append(" ,isnull(( select sum(amount) from ch_fee where feename in(");
strSql.Append(" select name from code_fee where FEEGROUP=(select FEEGROUP from code_fee where name='" + msChFee.FeeName + "')");
strSql.Append(" ) and feetype=2 and feestatus in(0,8,9,10,11)");
strSql.Append(" and bsno='" + msChFee.BsNo + "'),0) yf" );
strSql.Append(" ,isnull((select feegroup from code_fee where name='" + msChFee.FeeName+ "' ),'') feegroup");
Database db = DatabaseFactory.CreateDatabase();
var ys = new Decimal();
var yf = new Decimal();
var feegroup = "其他";
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
#region Set DB data to Object
ys = Convert.ToDecimal(reader["ys"]);
yf = Convert.ToDecimal(reader["yf"]);
if (Convert.ToString(reader["feegroup"]) != "")
{
feegroup = Convert.ToString(reader["feegroup"]);
}
#endregion
}
reader.Close();
}
if (feegroup == "融资款" /*|| feegroup == "货款"*/) {
return false;
}
else
if (msChFee.FeeType == 1)
{
if (ys + Convert.ToDecimal(msChFee.Amount) * Convert.ToDecimal(msChFee.ExChangerate) >= yf - 1)
{
return true;
}
else return false;
}
else if (ys >= yf + Convert.ToDecimal(msChFee.Amount) * Convert.ToDecimal(msChFee.ExChangerate) - 1)
{
return true;
}
else {
return false;
}
}
static public Boolean CanRetract(MsChFee msChFee)
{ //合同信息/商品信息
//判断是否允许一条费用撤回提交
var strSql = new StringBuilder();
strSql.Append("select isnull(( select sum(amount) from ch_fee where feename in(");
strSql.Append(" select name from code_fee where FEEGROUP=(select FEEGROUP from code_fee where name='" + msChFee.FeeName + "')");
strSql.Append(" ) and feetype=1 and feestatus in(0,8,9,10,11)");
strSql.Append(" and bsno='" + msChFee.BsNo + "'),0) ys");
strSql.Append(" ,isnull(( select sum(amount) from ch_fee where feename in(");
strSql.Append(" select name from code_fee where FEEGROUP=(select FEEGROUP from code_fee where name='" + msChFee.FeeName + "')");
strSql.Append(" ) and feetype=2 and feestatus in(0,8,9,10,11)");
strSql.Append(" and bsno='" + msChFee.BsNo + "'),0) yf");
strSql.Append(" ,isnull((select feegroup from code_fee where name='" + msChFee.FeeName + "' ),'') feegroup");
Database db = DatabaseFactory.CreateDatabase();
var ys = new Decimal();
var yf = new Decimal();
var feegroup = "其他";
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
#region Set DB data to Object
ys = Convert.ToDecimal(reader["ys"]);
yf = Convert.ToDecimal(reader["yf"]);
if (Convert.ToString(reader["feegroup"]) != "")
{
feegroup = Convert.ToString(reader["feegroup"]);
}
#endregion
}
reader.Close();
}
return true;
}
#endregion
#endregion
#region 查询应收/实收(现金帐目)
static public List<MsChFeeDo> GetChFeeDo(string condition)
{
var strSql = new StringBuilder();
strSql.Append(" select fd.gid,f.bsno,f.customername,f.feeid,f.feename,fd.Doamount,f.feetype, ");
strSql.Append("(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99020 and EnumValueID=f.FeeType) as FeeType_Ref");
strSql.Append(" fd.createtime from ch_fee_do fd ");
strSql.Append(" left join ch_fee f on f.gid=fd.feeid ");
if (condition.Trim() != String.Empty)
{
strSql.Append(" where " + condition);
}
else
{ strSql.Clear(); }//防止无参数调用
return SetChFeeDo(strSql);
}
private static List<MsChFeeDo> SetChFeeDo(StringBuilder strSql)
{
var bodyList = new List<MsChFeeDo>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
MsChFeeDo data = new MsChFeeDo();
#region Set DB data to Object
data.Gid = Convert.ToString(reader["Gid"]);
data.bsno = Convert.ToString(reader["bsno"]);
data.customername = Convert.ToString(reader["customername"]);
data.feeid = Convert.ToString(reader["feeid"]);
data.feename = Convert.ToString(reader["feename"]);
data.Doamount = Convert.ToString(reader["Doamount"]);
data.feetype = Convert.ToString(reader["feetype"]);
data.createtime = Convert.ToString(reader["createtime"]);
#endregion
bodyList.Add(data);
}
reader.Close();
}
return bodyList;
}
#endregion
static private int InsertRecord ( MsChFee msChFee, string USERID )
{
var strSql = new StringBuilder();
strSql.Append(" delete from Import_Payment where gid='" + msChFee.GId + "' ");
strSql.Append(" Insert into Import_Payment (gid,amount,CURRENCY,op,buyer,seller,remark,CREATETIME,PAYTIME,FEENAME) ");
strSql.Append(" (select cf.gid ,cf.AMOUNT,cf.currency,'" + USERID + "',M.buyer,cf.CUSTOMERNAME,'',getdate() createtime,null,cf.FEENAME ");
strSql.Append(" from ch_fee cf left join import_main m on m.contractno=cf.BSNO where cf.gid='" + msChFee.GId + "') ");
var _count = 0;
Database db = DatabaseFactory.CreateDatabase();
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
return _count;
}
static private int DeleteRecord(string Feeid)
{
var strSql = new StringBuilder();
strSql.Append(" delete from import_payment where gid='" + Feeid + "' ");
var _count = 0;
Database db = DatabaseFactory.CreateDatabase();
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
return _count;
}
}
internal class MsChFeeDealException : Exception
{
internal MsChFeeDealException(string message)
: base(message)
{
}
}
}