|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsCodeFeeSetList;
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsCodeFeeSetList
|
|
|
|
|
{
|
|
|
|
|
public class MsCodeFeeSetListDAL
|
|
|
|
|
{
|
|
|
|
|
static public List<CodeFeeSetList> GetDataList (string strCondition,int start,int limit,string sort = null )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(@"SELECT * from (SELECT row_number() over (");
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by A.CREATETIME DESC,A.GID");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
strSql.Append(@"A.GID,
|
|
|
|
|
A.FEECODE,
|
|
|
|
|
A.NAME,
|
|
|
|
|
A.DEFAULTCURR,
|
|
|
|
|
A.DESCRIPTION,
|
|
|
|
|
ISSEA,
|
|
|
|
|
ISAIR,
|
|
|
|
|
ISTRUCKING,
|
|
|
|
|
ISTRUCKINGFIXED,
|
|
|
|
|
ISWMS,
|
|
|
|
|
ISADVANCEDPAY,
|
|
|
|
|
ISOPEN,
|
|
|
|
|
ISINVOICE,
|
|
|
|
|
DEFAULTUNIT,ISNULL((case A.DEFAULTUNIT
|
|
|
|
|
when 1 then '单票' when 2 then '重量'
|
|
|
|
|
when 3 then '尺码' when 4 then '计费吨'
|
|
|
|
|
when 5 then 'TEU' when 6 then '净重'
|
|
|
|
|
when 7 then '总价' when 8 then '计价重量'
|
|
|
|
|
when 9 then '箱型' when 10 then 'CBM'
|
|
|
|
|
when 11 then 'BILL' end),'') DEFAULTUNITREF,
|
|
|
|
|
DEFAULTDEBIT,ISNULL((case A.DEFAULTDEBIT
|
|
|
|
|
when 1 then '船公司' when 2 then '订舱代理'
|
|
|
|
|
when 3 then '场站' when 4 then '车队'
|
|
|
|
|
when 5 then '委托单位' when 6 then '报关行'
|
|
|
|
|
when 7 then '代理' when 8 then '航空公司'
|
|
|
|
|
when 9 then '发货人' when 10 then '收货人'
|
|
|
|
|
when 11 then '通知人' when 0 then '其他' end),'') DEFAULTDEBITREF,
|
|
|
|
|
DEFAULTCREDIT,ISNULL((case A.DEFAULTCREDIT
|
|
|
|
|
when 1 then '船公司' when 2 then '订舱代理'
|
|
|
|
|
when 3 then '场站' when 4 then '车队'
|
|
|
|
|
when 5 then '委托单位' when 6 then '报关行'
|
|
|
|
|
when 7 then '代理' when 8 then '航空公司'
|
|
|
|
|
when 9 then '发货人' when 10 then '收货人'
|
|
|
|
|
when 11 then '通知人' when 12 then '船代'
|
|
|
|
|
when 13 then '码头' when 0 then '其他' end),'') DEFAULTCREDITREF,A.CREATEUSER,
|
|
|
|
|
B.SHOWNAME as CREATEUSERREF,
|
|
|
|
|
A.CREATETIME ,
|
|
|
|
|
A.FEEGROUP,A.FEEFRT,A.TAXRATE,A.DUITYPE,A.GOODNAME ");
|
|
|
|
|
strSql.Append(@"FROM code_fee as A
|
|
|
|
|
INNER JOIN [user] as B
|
|
|
|
|
ON A.CREATEUSER = B.GID ");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where 1=1 and " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(@")as t ");
|
|
|
|
|
strSql.Append(string.Format("where t.num>={0} and t.num<={1} ",start,start+limit));
|
|
|
|
|
|
|
|
|
|
return SetData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public string GetDataListStr(string strCondition, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(@"SELECT A.GID,
|
|
|
|
|
A.FEECODE,
|
|
|
|
|
A.NAME,
|
|
|
|
|
A.DEFAULTCURR,
|
|
|
|
|
A.DESCRIPTION,
|
|
|
|
|
ISSEA,
|
|
|
|
|
ISAIR,
|
|
|
|
|
ISTRUCKING,
|
|
|
|
|
ISTRUCKINGFIXED,
|
|
|
|
|
ISWMS,
|
|
|
|
|
ISADVANCEDPAY,
|
|
|
|
|
ISOPEN,
|
|
|
|
|
ISINVOICE,
|
|
|
|
|
DEFAULTUNIT,ISNULL((case A.DEFAULTUNIT
|
|
|
|
|
when 1 then '单票' when 2 then '重量'
|
|
|
|
|
when 3 then '尺码' when 4 then '计费吨'
|
|
|
|
|
when 5 then 'TEU' when 6 then '净重'
|
|
|
|
|
when 7 then '总价' when 8 then '计价重量'
|
|
|
|
|
when 9 then '箱型' when 10 then 'CBM'
|
|
|
|
|
when 11 then 'BILL' end),'') DEFAULTUNITREF,
|
|
|
|
|
DEFAULTDEBIT,ISNULL((case A.DEFAULTDEBIT
|
|
|
|
|
when 1 then '船公司' when 2 then '订舱代理'
|
|
|
|
|
when 3 then '场站' when 4 then '车队'
|
|
|
|
|
when 5 then '委托单位' when 6 then '报关行'
|
|
|
|
|
when 7 then '代理' when 8 then '航空公司'
|
|
|
|
|
when 9 then '发货人' when 10 then '收货人'
|
|
|
|
|
when 11 then '通知人' when 0 then '其他' end),'') DEFAULTDEBITREF,
|
|
|
|
|
DEFAULTCREDIT,ISNULL((case A.DEFAULTCREDIT
|
|
|
|
|
when 1 then '船公司' when 2 then '订舱代理'
|
|
|
|
|
when 3 then '场站' when 4 then '车队'
|
|
|
|
|
when 5 then '委托单位' when 6 then '报关行'
|
|
|
|
|
when 7 then '代理' when 8 then '航空公司'
|
|
|
|
|
when 9 then '发货人' when 10 then '收货人'
|
|
|
|
|
when 11 then '通知人' when 12 then '船代'
|
|
|
|
|
when 13 then '码头' when 0 then '其他' end),'') DEFAULTCREDITREF,A.CREATEUSER,
|
|
|
|
|
B.SHOWNAME as CREATEUSERREF,
|
|
|
|
|
A.CREATETIME ,
|
|
|
|
|
A.FEEGROUP,A.FEEFRT,A.TAXRATE,A.DUITYPE,A.GOODNAME ");
|
|
|
|
|
strSql.Append(@"FROM code_fee as A
|
|
|
|
|
INNER JOIN [user] as B
|
|
|
|
|
ON A.CREATEUSER = B.GID ");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where 1=1 and " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by A.CREATETIME DESC,A.GID");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return strSql.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public int getTotalCount ( string strCondition )
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select count(*) from code_fee as A inner join [user] as B on A.createuser=B.gid ");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where 1=1 and " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
int cnt=0;
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
cnt = Convert.ToInt32(reader[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cnt;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public CodeFeeSetList GetData(string condition)
|
|
|
|
|
{
|
|
|
|
|
CodeFeeSetList data = null;
|
|
|
|
|
var list = GetDataList(condition,0,1);
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
data = list[0];
|
|
|
|
|
|
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
data = new CodeFeeSetList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<CodeFeeSetList> SetData ( StringBuilder strSql )
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<CodeFeeSetList>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
CodeFeeSetList data = new CodeFeeSetList();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
|
|
data.FEECODE = Convert.ToString(reader["FEECODE"]);
|
|
|
|
|
data.NAME = Convert.ToString(reader["NAME"]);
|
|
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);
|
|
|
|
|
data.DEFAULTCURR = Convert.ToString(reader["DEFAULTCURR"]);
|
|
|
|
|
if (reader["ISSEA"] != DBNull.Value)
|
|
|
|
|
data.ISSEA = Convert.ToBoolean(reader["ISSEA"]);//状态
|
|
|
|
|
if (reader["ISAIR"] != DBNull.Value)
|
|
|
|
|
data.ISAIR = Convert.ToBoolean(reader["ISAIR"]);//状态
|
|
|
|
|
if (reader["ISTRUCKING"] != DBNull.Value)
|
|
|
|
|
data.ISTRUCKING = Convert.ToBoolean(reader["ISTRUCKING"]);//状态
|
|
|
|
|
if (reader["ISTRUCKINGFIXED"] != DBNull.Value)
|
|
|
|
|
data.ISTRUCKINGFIXED = Convert.ToBoolean(reader["ISTRUCKINGFIXED"]);//状态
|
|
|
|
|
if (reader["ISWMS"] != DBNull.Value)
|
|
|
|
|
data.ISWMS = Convert.ToBoolean(reader["ISWMS"]);//状态
|
|
|
|
|
if (reader["ISADVANCEDPAY"] != DBNull.Value)
|
|
|
|
|
data.ISADVANCEDPAY = Convert.ToBoolean(reader["ISADVANCEDPAY"]);//状态
|
|
|
|
|
if (reader["ISOPEN"] != DBNull.Value)
|
|
|
|
|
data.ISOPEN = Convert.ToBoolean(reader["ISOPEN"]);//状态
|
|
|
|
|
if (reader["ISINVOICE"] != DBNull.Value)
|
|
|
|
|
data.ISINVOICE = Convert.ToBoolean(reader["ISINVOICE"]);//状态
|
|
|
|
|
|
|
|
|
|
data.DEFAULTUNIT = Convert.ToString(reader["DEFAULTUNIT"]);
|
|
|
|
|
data.DEFAULTDEBIT = Convert.ToString(reader["DEFAULTDEBIT"]);
|
|
|
|
|
data.DEFAULTCREDIT = Convert.ToString(reader["DEFAULTCREDIT"]);
|
|
|
|
|
data.DEFAULTUNITREF = Convert.ToString(reader["DEFAULTUNITREF"]);
|
|
|
|
|
data.DEFAULTDEBITREF = Convert.ToString(reader["DEFAULTDEBITREF"]);
|
|
|
|
|
data.DEFAULTCREDITREF = Convert.ToString(reader["DEFAULTCREDITREF"]);
|
|
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
|
|
data.CREATEUSERREF = Convert.ToString(reader["CREATEUSERREF"]);
|
|
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
|
|
data.FEEGROUP = Convert.ToString(reader["FEEGROUP"]);
|
|
|
|
|
data.FEEFRT = Convert.ToString(reader["FEEFRT"]);
|
|
|
|
|
data.TAXRATE = Convert.ToString(reader["TAXRATE"]);
|
|
|
|
|
data.DUITYPE = Convert.ToString(reader["DUITYPE"]);
|
|
|
|
|
data.GOODNAME = Convert.ToString(reader["GOODNAME"]);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
public static DBResult Modify(CodeFeeSetList headdata, CodeFeeSetList modifydata, string companyid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
string errstr = "";
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var strSql2 = new StringBuilder();
|
|
|
|
|
strSql2.Append("update ch_fee set [FEENAME]=@NEWFEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql2.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate2 =
|
|
|
|
|
db.GetSqlStringCommand(strSql2.ToString());
|
|
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate2, "@NEWFEENAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate2, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
|
|
|
|
var strSql3 = new StringBuilder();
|
|
|
|
|
strSql3.Append("update ch_fee_do set [FEENAME]=@NEWFEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql3.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate3 =
|
|
|
|
|
db.GetSqlStringCommand(strSql3.ToString());
|
|
|
|
|
cmdupdate3.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate3, "@NEWFEENAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate3, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate3, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql4 = new StringBuilder();
|
|
|
|
|
strSql4.Append("update code_fee_templatedetail set [FEENAME]=@NEWFEENAME,FEECODE=@FEECODE ");
|
|
|
|
|
|
|
|
|
|
strSql4.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate4 =
|
|
|
|
|
db.GetSqlStringCommand(strSql4.ToString());
|
|
|
|
|
cmdupdate4.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate4, "@NEWFEENAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate4, "@FEECODE", DbType.String, modifydata.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate4, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate4, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql5 = new StringBuilder();
|
|
|
|
|
strSql5.Append("update code_fee_templatedetail_auto set [FEENAME]=@NEWFEENAME,FEECODE=@FEECODE ");
|
|
|
|
|
|
|
|
|
|
strSql5.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate5 =
|
|
|
|
|
db.GetSqlStringCommand(strSql5.ToString());
|
|
|
|
|
cmdupdate5.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate5, "@NEWFEENAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate5, "@FEECODE", DbType.String, modifydata.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate5, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate5, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql6 = new StringBuilder();
|
|
|
|
|
strSql6.Append("update code_fee_template_agentdetail set [FEENAME]=@NEWFEENAME,FEECODE=@FEECODE,FEEENAME=@FEEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql6.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate6 =
|
|
|
|
|
db.GetSqlStringCommand(strSql6.ToString());
|
|
|
|
|
cmdupdate6.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@NEWFEENAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@FEECODE", DbType.String, modifydata.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@FEEENAME", DbType.String, modifydata.DESCRIPTION);
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate6, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql7 = new StringBuilder();
|
|
|
|
|
strSql7.Append("update code_excel_impformat_fee set [FEENAME]=@NEWFEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql7.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate7 =
|
|
|
|
|
db.GetSqlStringCommand(strSql7.ToString());
|
|
|
|
|
cmdupdate7.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate7, "@NEWFEENAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate7, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate7, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("update code_fee set FEECODE=@FEECODE,[NAME]=@NEWNAME,[DESCRIPTION]=@DESCRIPTION ");
|
|
|
|
|
|
|
|
|
|
strSql.Append(" where [NAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate =
|
|
|
|
|
db.GetSqlStringCommand(strSql.ToString());
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate, "@FEECODE", DbType.String, modifydata.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate, "@NEWNAME", DbType.String, modifydata.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate, "@DESCRIPTION", DbType.String, modifydata.DESCRIPTION);
|
|
|
|
|
db.AddInParameter(cmdupdate, "@NAME", DbType.String, headdata.NAME);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "修改出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "修改成功";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static DBResult Reapeat(string oldfeename, string newfeename, string companyid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
string errstr = "";
|
|
|
|
|
int i = 0;
|
|
|
|
|
var newfee = GetData("[NAME]='"+ newfeename + "'");
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var strSql2 = new StringBuilder();
|
|
|
|
|
strSql2.Append("update ch_fee set [FEENAME]=@NEWFEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql2.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate2 =
|
|
|
|
|
db.GetSqlStringCommand(strSql2.ToString());
|
|
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate2, "@NEWFEENAME", DbType.String, newfeename);
|
|
|
|
|
db.AddInParameter(cmdupdate2, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
|
|
|
|
var strSql3 = new StringBuilder();
|
|
|
|
|
strSql3.Append("update ch_fee_do set [FEENAME]=@NEWFEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql3.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate3 =
|
|
|
|
|
db.GetSqlStringCommand(strSql3.ToString());
|
|
|
|
|
cmdupdate3.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate3, "@NEWFEENAME", DbType.String, newfeename);
|
|
|
|
|
db.AddInParameter(cmdupdate3, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate3, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql4 = new StringBuilder();
|
|
|
|
|
strSql4.Append("update code_fee_templatedetail set [FEENAME]=@NEWFEENAME,FEECODE=@FEECODE ");
|
|
|
|
|
|
|
|
|
|
strSql4.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate4 =
|
|
|
|
|
db.GetSqlStringCommand(strSql4.ToString());
|
|
|
|
|
cmdupdate4.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate4, "@NEWFEENAME", DbType.String, newfee.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate4, "@FEECODE", DbType.String, newfee.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate4, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate4, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql5 = new StringBuilder();
|
|
|
|
|
strSql5.Append("update code_fee_templatedetail_auto set [FEENAME]=@NEWFEENAME,FEECODE=@FEECODE ");
|
|
|
|
|
|
|
|
|
|
strSql5.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate5 =
|
|
|
|
|
db.GetSqlStringCommand(strSql5.ToString());
|
|
|
|
|
cmdupdate5.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate5, "@NEWFEENAME", DbType.String, newfee.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate5, "@FEECODE", DbType.String, newfee.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate5, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate5, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql6 = new StringBuilder();
|
|
|
|
|
strSql6.Append("update code_fee_template_agentdetail set [FEENAME]=@NEWFEENAME,FEECODE=@FEECODE,FEEENAME=@FEEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql6.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate6 =
|
|
|
|
|
db.GetSqlStringCommand(strSql6.ToString());
|
|
|
|
|
cmdupdate6.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@NEWFEENAME", DbType.String, newfee.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@FEECODE", DbType.String, newfee.FEECODE);
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@FEEENAME", DbType.String, newfee.DESCRIPTION);
|
|
|
|
|
db.AddInParameter(cmdupdate6, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate6, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql7 = new StringBuilder();
|
|
|
|
|
strSql7.Append("update code_excel_impformat_fee set [FEENAME]=@NEWFEENAME ");
|
|
|
|
|
|
|
|
|
|
strSql7.Append(" where [FEENAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate7 =
|
|
|
|
|
db.GetSqlStringCommand(strSql7.ToString());
|
|
|
|
|
cmdupdate7.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate7, "@NEWFEENAME", DbType.String, newfee.NAME);
|
|
|
|
|
db.AddInParameter(cmdupdate7, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate7, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("delete from code_fee ");
|
|
|
|
|
|
|
|
|
|
strSql.Append(" where [NAME]=@NAME ");
|
|
|
|
|
|
|
|
|
|
var cmdupdate =
|
|
|
|
|
db.GetSqlStringCommand(strSql.ToString());
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdupdate, "@NAME", DbType.String, oldfeename);
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "修改出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "修改成功!";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool GetFeeCount(string FEENAME)
|
|
|
|
|
{
|
|
|
|
|
var isfee = false;
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("Select count(*) as count ");
|
|
|
|
|
strSql.Append(" from ch_fee ");
|
|
|
|
|
strSql.Append(" where FEENAME='" + FEENAME + "'");
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
var evData = Convert.ToInt32(reader["count"]);
|
|
|
|
|
if (evData > 0) { isfee = true; };
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return isfee;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool GetCodeFeeCount(string strCondition)
|
|
|
|
|
{
|
|
|
|
|
var isfee = false;
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("Select count(*) as count ");
|
|
|
|
|
strSql.Append(" from code_fee ");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
var evData = Convert.ToInt32(reader["count"]);
|
|
|
|
|
if (evData > 0) { isfee = true; };
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return isfee;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|