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.
591 lines
26 KiB
C#
591 lines
26 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using DSWeb.MvcShipping.Models.MsCodeFeeTemplateAuto;
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using HcUtility.Comm;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsCodeFeeTemplateAuto
|
|
{
|
|
public class MsCodeFeeTempldateAutoDAL
|
|
{
|
|
#region Inquery DataList
|
|
|
|
static public List<CodeFeeTemplateAuto> GetDataList(string strCondition, string userid, string usercode, string orgcode, string sort = null)
|
|
{
|
|
|
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, orgcode);
|
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
{
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strCondition = strCondition + " and " + rangstr;
|
|
}
|
|
else
|
|
{
|
|
strCondition = rangstr;
|
|
}
|
|
}
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT ");
|
|
strSql.Append("GID,OPTYPE,FEETYPE,NAME,[DESCRIPTION],CREATEUSER,CREATETIME");
|
|
strSql.Append(",MODIFIEDUSER,MODIFIEDTIME,REMARK,CORPID,CONDITION,BGNDATE,ENDDATE,FEEGROUP,ISDEF,CLASS");
|
|
strSql.Append(",(CASE FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF");
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=96200 and EnumValueID=code_fee_template_auto.OPTYPE) as OPTYPEREF");
|
|
strSql.Append(",(select ShowName from [user] where GID=code_fee_template_auto.CREATEUSER) as CREATEUSERREF");
|
|
strSql.Append(",ISPUBLIC,ISSTOP");
|
|
strSql.Append(" from code_fee_template_auto ");
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" where " + strCondition);
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql.Append(" order by " + sortstring);
|
|
}
|
|
else {
|
|
strSql.Append(" order by CREATETIME DESC");
|
|
|
|
}
|
|
return SetData(strSql);
|
|
}
|
|
|
|
static public CodeFeeTemplateAuto GetData(string condition, string userid, string usercode, string orgcode)
|
|
{
|
|
CodeFeeTemplateAuto data = null;
|
|
var list = GetDataList(condition,userid,usercode,orgcode);
|
|
if (list.Count > 0)
|
|
data = list[0];
|
|
|
|
if (data == null)
|
|
{
|
|
data = new CodeFeeTemplateAuto();
|
|
data.CREATEUSER = userid;
|
|
data.CORPID = orgcode;
|
|
|
|
}
|
|
|
|
return data;
|
|
}
|
|
|
|
|
|
private static List<CodeFeeTemplateAuto> SetData(StringBuilder strSql)
|
|
{
|
|
var headList = new List<CodeFeeTemplateAuto>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
CodeFeeTemplateAuto data = new CodeFeeTemplateAuto();
|
|
#region Set DB data to Object
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
data.OPTYPE = Convert.ToString(reader["OPTYPE"]);
|
|
data.FEETYPE = Convert.ToInt16(reader["FEETYPE"]);
|
|
data.OPTYPEREF = Convert.ToString(reader["OPTYPEREF"]);
|
|
data.FEETYPEREF = Convert.ToString(reader["FEETYPEREF"]);
|
|
data.NAME = Convert.ToString(reader["NAME"]);
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
data.CREATEUSERREF = Convert.ToString(reader["CREATEUSERREF"]);
|
|
if (reader["CREATETIME"] != DBNull.Value)
|
|
data.CREATETIME = Convert.ToDateTime(reader["CREATETIME"]);
|
|
data.ISPUBLIC = Convert.ToString(reader["ISPUBLIC"]);
|
|
data.ISDEF = Convert.ToString(reader["ISDEF"]);
|
|
data.ISSTOP = Convert.ToString(reader["ISSTOP"]);
|
|
data.FEEGROUP = Convert.ToString(reader["FEEGROUP"]);
|
|
if (reader["BGNDATE"] != DBNull.Value)
|
|
data.BGNDATE = Convert.ToDateTime(reader["BGNDATE"]).ToString("yyyy-MM-dd");
|
|
if (reader["ENDDATE"] != DBNull.Value)
|
|
data.ENDDATE = Convert.ToDateTime(reader["ENDDATE"]).ToString("yyyy-MM-dd");
|
|
if (reader["CLASS"] != DBNull.Value)
|
|
data.CLASS = Convert.ToInt32(reader["CLASS"]);
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
#endregion
|
|
|
|
static public string GetDataListStr(string strCondition, string userid, string usercode, string orgcode, string sort = null)
|
|
{
|
|
|
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, orgcode);
|
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
{
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strCondition = strCondition + " and ((" + rangstr + ") or ISPUBLIC='是')";
|
|
}
|
|
else
|
|
{
|
|
strCondition = " ((" + rangstr + ") or ISPUBLIC='是')";
|
|
}
|
|
}
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT ");
|
|
strSql.Append("GID,OPTYPE,FEETYPE,NAME,[DESCRIPTION],CREATEUSER,CREATETIME");
|
|
strSql.Append(",MODIFIEDUSER,MODIFIEDTIME,REMARK,CORPID,BGNDATE,ENDDATE,FEEGROUP,ISDEF,CLASS");
|
|
strSql.Append(",(CASE FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF");
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=96200 and EnumValueID=code_fee_template_auto.OPTYPE) as OPTYPEREF");
|
|
strSql.Append(",(select ShowName from [user] where GID=code_fee_template_auto.CREATEUSER) as CREATEUSERREF");
|
|
strSql.Append(",ISPUBLIC,ISSTOP");
|
|
strSql.Append(" from code_fee_template_auto ");
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" where " + strCondition);
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql.Append(" order by " + sortstring);
|
|
}
|
|
else
|
|
{
|
|
strSql.Append(" order by NAME");
|
|
|
|
}
|
|
return strSql.ToString();
|
|
}
|
|
|
|
|
|
|
|
#region 明细表
|
|
|
|
static public List<CodeFeeTemplateDetailAuto> GetBodyList(string strCondition, string sort = null)
|
|
{
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT ");
|
|
strSql.Append("GID,TEMPLATEID,FEENAME,CUSTOMERNAME,CLIENT,UNIT");
|
|
strSql.Append(",CURRENCY,UNITPRICE,REMARK,SORT,CREATEUSER,CREATETIME,EXCHANGERATE,ISCTN,TAXRATE,TAXUNITPRICE,TAX,ACCTAXRATE");
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=96201 and EnumValueID=code_fee_templatedetail_auto.CLIENT) as CLIENTREF");
|
|
strSql.Append(",(case ISCTN when 1 then '是' else '否' end) as ISCTNREF,ISINVOICE,ISADVANCEDPAY,FEEFRT,SALECORP,FEEDESCRIPTION,UNITPRICEDESCRPTION ");
|
|
strSql.Append(" from code_fee_templatedetail_auto ");
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" where " + strCondition);
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql.Append(" order by " + sortstring);
|
|
}
|
|
else
|
|
{
|
|
strSql.Append(" order by SORT ");
|
|
}
|
|
|
|
return SetBodyData(strSql);
|
|
}
|
|
|
|
private static List<CodeFeeTemplateDetailAuto> SetBodyData(StringBuilder strSql)
|
|
{
|
|
var bodyList = new List<CodeFeeTemplateDetailAuto>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
CodeFeeTemplateDetailAuto data = new CodeFeeTemplateDetailAuto();
|
|
#region Set DB data to Object
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
data.TEMPLATEID = Convert.ToString(reader["TEMPLATEID"]);
|
|
if (reader["UNITPRICE"] != DBNull.Value)
|
|
data.UNITPRICE = Convert.ToDecimal(reader["UNITPRICE"]);
|
|
if (reader["EXCHANGERATE"] != DBNull.Value)
|
|
data.EXCHANGERATE = Convert.ToDecimal(reader["EXCHANGERATE"]);
|
|
if (reader["TAXRATE"] != DBNull.Value)
|
|
data.TAXRATE = Convert.ToDecimal(reader["TAXRATE"]);
|
|
if (reader["TAX"] != DBNull.Value)
|
|
data.TAX = Convert.ToDecimal(reader["TAX"]);
|
|
data.FEENAME = Convert.ToString(reader["FEENAME"]);
|
|
data.FEEDESCRIPTION = Convert.ToString(reader["FEEDESCRIPTION"]);
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
if (reader["CLIENT"] != DBNull.Value)
|
|
data.CLIENT = Convert.ToString(reader["CLIENT"]);
|
|
data.CLIENTREF = Convert.ToString(reader["CLIENTREF"]);
|
|
data.UNIT = Convert.ToString(reader["UNIT"]);
|
|
data.CURRENCY = Convert.ToString(reader["CURRENCY"]);
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
if (reader["SORT"] != DBNull.Value)
|
|
data.SORT = Convert.ToInt16(reader["SORT"]);
|
|
data.FEEFRT = Convert.ToString(reader["FEEFRT"]);
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
if (reader["ISCTN"] != DBNull.Value)
|
|
data.ISCTN = Convert.ToBoolean(reader["ISCTN"]);
|
|
data.ISCTNREF = Convert.ToString(reader["ISCTNREF"]);
|
|
if (reader["ISINVOICE"] != DBNull.Value)
|
|
data.ISINVOICE = Convert.ToBoolean(reader["ISINVOICE"]);
|
|
if (reader["ISADVANCEDPAY"] != DBNull.Value)
|
|
data.ISADVANCEDPAY = Convert.ToBoolean(reader["ISADVANCEDPAY"]);
|
|
data.SALECORP = Convert.ToString(reader["SALECORP"]);
|
|
if (reader["TAXUNITPRICE"] != DBNull.Value)
|
|
data.TAXUNITPRICE = Convert.ToDecimal(reader["TAXUNITPRICE"]);
|
|
if (reader["ACCTAXRATE"] != DBNull.Value)
|
|
data.ACCTAXRATE = Convert.ToDecimal(reader["ACCTAXRATE"]);
|
|
data.UNITPRICEDESCRPTION = Convert.ToString(reader["UNITPRICEDESCRPTION"]);
|
|
#endregion
|
|
|
|
bodyList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
|
|
return bodyList;
|
|
}
|
|
|
|
static public List<CodeFeeTemplateCondition> GetConditList(string strCondition, string sort = null)
|
|
{
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT ");
|
|
strSql.Append("c.GID,c.TEMPLATEID,c.FIELDNAME,c.FIELDCONDIT,c.FIELDVALUE,c.CREATEUSER,c.CREATETIME");
|
|
strSql.Append(",q.FIELDCNAME,q.FIELDTYPE");
|
|
strSql.Append(" from code_fee_template_condition c ");
|
|
strSql.Append(" left join sys_queryfield_setting q on (q.FORMNAME='MsCodeFeeTemplateAutoEdit' and q.FIELDNAME=c.FIELDNAME) ");
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" where " + strCondition);
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql.Append(" order by " + sortstring);
|
|
}
|
|
else
|
|
{
|
|
strSql.Append(" order by CREATETIME ");
|
|
}
|
|
|
|
return SetConditData(strSql);
|
|
}
|
|
|
|
private static List<CodeFeeTemplateCondition> SetConditData(StringBuilder strSql)
|
|
{
|
|
var bodyList = new List<CodeFeeTemplateCondition>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
CodeFeeTemplateCondition data = new CodeFeeTemplateCondition();
|
|
#region Set DB data to Object
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
data.TEMPLATEID = Convert.ToString(reader["TEMPLATEID"]);
|
|
data.FIELDNAME = Convert.ToString(reader["FIELDNAME"]);
|
|
data.FIELDCONDIT = Convert.ToString(reader["FIELDCONDIT"]);
|
|
data.FIELDVALUE = Convert.ToString(reader["FIELDVALUE"]);
|
|
data.FIELDTYPE = Convert.ToString(reader["FIELDTYPE"]);
|
|
data.FIELDCNAME = Convert.ToString(reader["FIELDCNAME"]);
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
#endregion
|
|
|
|
bodyList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
|
|
return bodyList;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static DBResult SaveDetail(CodeFeeTemplateAuto headData, List<CodeFeeTemplateDetailAuto> bodyList, List<CodeFeeTemplateCondition> conditList, string userid)
|
|
{
|
|
var result = new DBResult();
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (var conn = db.CreateConnection())
|
|
{
|
|
conn.Open();
|
|
var tran = conn.BeginTransaction();
|
|
|
|
try
|
|
{
|
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand("delete from code_fee_templatedetail_auto where TEMPLATEID='" + headData.GID + "'");
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
var cmdInsert =
|
|
db.GetSqlStringCommand(
|
|
@"insert into code_fee_templatedetail_auto (GID,TEMPLATEID,FEENAME,CUSTOMERNAME,CLIENT,UNIT,CURRENCY,UNITPRICE,REMARK,SORT,CREATEUSER,CREATETIME,EXCHANGERATE,ISCTN,ISINVOICE,ISADVANCEDPAY,FEEFRT,TAXRATE,TAX,SALECORP,TAXUNITPRICE,ACCTAXRATE,FEEDESCRIPTION,UNITPRICEDESCRPTION)
|
|
values (@GID,@TEMPLATEID,@FEENAME,@CUSTOMERNAME,@CLIENT,@UNIT,@CURRENCY,@UNITPRICE,@REMARK,@SORT,@CREATEUSER,@CREATETIME,@EXCHANGERATE,@ISCTN,@ISINVOICE,@ISADVANCEDPAY,@FEEFRT,@TAXRATE,@TAX,@SALECORP,@TAXUNITPRICE,@ACCTAXRATE,@FEEDESCRIPTION,@UNITPRICEDESCRPTION) ");
|
|
|
|
if (bodyList != null)
|
|
{
|
|
foreach (var enumValue in bodyList)
|
|
{
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
db.AddInParameter(cmdInsert, "@GID", DbType.String, Guid.NewGuid().ToString());
|
|
db.AddInParameter(cmdInsert, "@TEMPLATEID", DbType.String,headData.GID);
|
|
db.AddInParameter(cmdInsert, "@FEENAME", DbType.String, enumValue.FEENAME);
|
|
db.AddInParameter(cmdInsert, "@CUSTOMERNAME", DbType.String, enumValue.CUSTOMERNAME);
|
|
db.AddInParameter(cmdInsert, "@CLIENT", DbType.String, enumValue.CLIENT);
|
|
db.AddInParameter(cmdInsert, "@UNIT", DbType.String, enumValue.UNIT);
|
|
db.AddInParameter(cmdInsert, "@CURRENCY", DbType.String, enumValue.CURRENCY);
|
|
db.AddInParameter(cmdInsert, "@UNITPRICE", DbType.Decimal, enumValue.UNITPRICE);
|
|
db.AddInParameter(cmdInsert, "@REMARK", DbType.String, enumValue.REMARK);
|
|
db.AddInParameter(cmdInsert, "@SORT", DbType.Int32, enumValue.SORT);
|
|
db.AddInParameter(cmdInsert, "@CREATEUSER", DbType.String, userid);
|
|
db.AddInParameter(cmdInsert, "@CREATETIME", DbType.String, DateTime.Now.ToString());
|
|
db.AddInParameter(cmdInsert, "@EXCHANGERATE", DbType.Decimal, enumValue.EXCHANGERATE);
|
|
db.AddInParameter(cmdInsert, "@ISCTN", DbType.Boolean, enumValue.ISCTN);
|
|
db.AddInParameter(cmdInsert, "@ISINVOICE", DbType.Boolean, enumValue.ISINVOICE);
|
|
db.AddInParameter(cmdInsert, "@ISADVANCEDPAY", DbType.Boolean, enumValue.ISADVANCEDPAY);
|
|
db.AddInParameter(cmdInsert, "@FEEFRT", DbType.String, enumValue.FEEFRT);
|
|
db.AddInParameter(cmdInsert, "@TAXRATE", DbType.Decimal, enumValue.TAXRATE);
|
|
db.AddInParameter(cmdInsert, "@TAX", DbType.Decimal, enumValue.TAX);
|
|
db.AddInParameter(cmdInsert, "@SALECORP", DbType.String, enumValue.SALECORP);
|
|
db.AddInParameter(cmdInsert, "@TAXUNITPRICE", DbType.Decimal, enumValue.TAXUNITPRICE);
|
|
db.AddInParameter(cmdInsert, "@ACCTAXRATE", DbType.Decimal, enumValue.ACCTAXRATE);
|
|
db.AddInParameter(cmdInsert, "@FEEDESCRIPTION", DbType.String, enumValue.FEEDESCRIPTION);
|
|
db.AddInParameter(cmdInsert, "@UNITPRICEDESCRPTION", DbType.String, enumValue.UNITPRICEDESCRPTION);
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
}
|
|
}
|
|
|
|
var cmdDeleteCondit = db.GetSqlStringCommand("delete from code_fee_template_condition where TEMPLATEID='" + headData.GID + "'");
|
|
db.ExecuteNonQuery(cmdDeleteCondit, tran);
|
|
|
|
var cmdInsertCondit =
|
|
db.GetSqlStringCommand(
|
|
@"insert into code_fee_template_condition (GID,TEMPLATEID,FIELDNAME,FIELDCONDIT,FIELDVALUE,CREATEUSER,CREATETIME)
|
|
values (@GID,@TEMPLATEID,@FIELDNAME,@FIELDCONDIT,@FIELDVALUE,@CREATEUSER,@CREATETIME) ");
|
|
|
|
if (conditList != null)
|
|
{
|
|
foreach (var enumValue in conditList)
|
|
{
|
|
cmdInsertCondit.Parameters.Clear();
|
|
|
|
db.AddInParameter(cmdInsertCondit, "@GID", DbType.String, Guid.NewGuid().ToString());
|
|
db.AddInParameter(cmdInsertCondit, "@TEMPLATEID", DbType.String, headData.GID);
|
|
db.AddInParameter(cmdInsertCondit, "@FIELDNAME", DbType.String, enumValue.FIELDNAME);
|
|
db.AddInParameter(cmdInsertCondit, "@FIELDCONDIT", DbType.String, enumValue.FIELDCONDIT);
|
|
db.AddInParameter(cmdInsertCondit, "@FIELDVALUE", DbType.String, enumValue.FIELDVALUE);
|
|
db.AddInParameter(cmdInsertCondit, "@CREATEUSER", DbType.String, userid);
|
|
db.AddInParameter(cmdInsertCondit, "@CREATETIME", DbType.String, DateTime.Now.ToString());
|
|
db.ExecuteNonQuery(cmdInsertCondit, tran);
|
|
}
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
tran.Rollback();
|
|
|
|
result.Success = false;
|
|
result.Message = "保存出现错误,请重试或联系系统管理员"+e.Message;
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
result.Success = true;
|
|
result.Message = "保存成功";
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
public static DBResult DeleteDetail(CodeFeeTemplateAuto headData)
|
|
{
|
|
var result = new DBResult();
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (var conn = db.CreateConnection())
|
|
{
|
|
conn.Open();
|
|
var tran = conn.BeginTransaction();
|
|
|
|
try
|
|
{
|
|
|
|
var cmd = db.GetSqlStringCommand("delete from code_fee_template_auto where GID='" + headData.GID + "'");
|
|
db.ExecuteNonQuery(cmd, tran);
|
|
var cmdDelete = db.GetSqlStringCommand("delete from code_fee_templatedetail_auto where TEMPLATEID='" + headData.GID + "'");
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
tran.Commit();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
tran.Rollback();
|
|
|
|
result.Success = false;
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
result.Success = true;
|
|
result.Message = "保存成功";
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public static List<FeeUnit> GetFeeUnit(string strCondition)
|
|
{
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT CTN from code_ctn");
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" where " + strCondition);
|
|
}
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
var evList = new List<FeeUnit>();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
FeeUnit Data = new FeeUnit();
|
|
Data.UNIT = Convert.ToString(reader["CTN"]);
|
|
evList.Add(Data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
var data = new FeeUnit();
|
|
data.UNIT = "单票";
|
|
evList.Add(data);
|
|
var data1 = new FeeUnit();
|
|
data1.UNIT = "重量";
|
|
evList.Add(data1);
|
|
var data2 = new FeeUnit();
|
|
data2.UNIT = "尺码";
|
|
evList.Add(data2);
|
|
var data3 = new FeeUnit();
|
|
data3.UNIT = "TEU";
|
|
evList.Add(data3);
|
|
var data4 = new FeeUnit();
|
|
data4.UNIT = "箱型";
|
|
evList.Add(data4);
|
|
var data5 = new FeeUnit();
|
|
data5.UNIT = "CBM";
|
|
evList.Add(data5);
|
|
var data6 = new FeeUnit();
|
|
data6.UNIT = "BILL";
|
|
evList.Add(data6);
|
|
var data7 = new FeeUnit();
|
|
data7.UNIT = "件数";
|
|
evList.Add(data7);
|
|
var data8 = new FeeUnit();
|
|
data8.UNIT = "车";
|
|
evList.Add(data8);
|
|
var data9 = new FeeUnit();
|
|
data9.UNIT = "自然箱";
|
|
evList.Add(data9);
|
|
var data10 = new FeeUnit();
|
|
data10.UNIT = "小时";
|
|
evList.Add(data10);
|
|
var data13 = new FeeUnit();
|
|
data13.UNIT = "天";
|
|
evList.Add(data13);
|
|
var data11 = new FeeUnit();
|
|
data11.UNIT = "个";
|
|
evList.Add(data11);
|
|
var data12 = new FeeUnit();
|
|
data12.UNIT = "计费吨";
|
|
evList.Add(data12);
|
|
|
|
return evList;
|
|
}
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
public static string GetRangDAStr(string tb, string userid, string usercode, string orgcode)
|
|
{
|
|
string str = "";
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT ");
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE ");
|
|
strSql.Append(" from VW_User_Authority ");
|
|
strSql.Append(" where [NAME]='modCodeFeeTemplateSet' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
string visiblerange = "4";
|
|
string operaterange = "4";
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
break;
|
|
}
|
|
reader.Close();
|
|
}
|
|
if (visiblerange == "4")
|
|
{
|
|
str = "1=2";
|
|
}
|
|
else if (visiblerange == "3")
|
|
{
|
|
if (tb == "index")
|
|
{
|
|
str = " CREATEUSER='" + userid + "'";
|
|
}
|
|
else
|
|
{
|
|
str = " UPPER(CORPID)='" + orgcode + "'";
|
|
}
|
|
}
|
|
else if (visiblerange == "2")
|
|
{
|
|
if (tb == "index")
|
|
{
|
|
str = " UPPER(CORPID)='" + orgcode + "'";
|
|
}
|
|
else
|
|
{
|
|
str = " UPPER(CORPID)='" + orgcode + "'";
|
|
}
|
|
|
|
}
|
|
else if (visiblerange == "1")
|
|
{
|
|
str = " UPPER(CORPID)='" + orgcode + "'";
|
|
}
|
|
|
|
return str;
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
}
|
|
}
|