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/CRM/CRMClientQuotationInfo.aspx.cs

650 lines
31 KiB
C#

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using JsonHelper;
using DSWeb.Models;
using DSWeb.EntityDA;
using DSWeb.Log;
using DSWeb.Authority;
namespace DSWeb.CRM
{
public partial class CRMClientQuotationInfo : PageBase
{
private string recvJSON;
private string payJSON;
private string strUserID;
private int iImportTemplateDetailType;
private string strCacheName;
private string strCompanyID;//公司GID
private string strShowName;//用户显示名
private string strDeptName;//部门名称
private bool bEnable;//是否可操作
RangeDA RangeDA = new RangeDA();
protected void Page_Load(object sender, EventArgs e)
{
this.h_IsFeeGain.Value = "1";
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
//
if (Request.QueryString["hdenabled"] != null)
{
bEnable = Request.QueryString["hdenabled"].ToString().Trim().ToLower().Equals("false") ? false : true;
hdEnabled.Value = bEnable ? "1" : "0";
}
else
{
bEnable = true;
hdEnabled.Value = bEnable ? "1" : "0";
}
//
if (Request.QueryString["id"] != null)
{
ViewState["GID"] = Request.QueryString["id"].ToString().Trim();
this.hdGID.Value = ViewState["GID"].ToString().Trim();
}
if (Request.QueryString["type"] != null)
{
iImportTemplateDetailType = int.Parse(Request.QueryString["type"].ToString());
if (iImportTemplateDetailType == 3)
{
iImportTemplateDetailType = 1;
}
else if (iImportTemplateDetailType == 4)
{
iImportTemplateDetailType = 2;
}
}
else
{
iImportTemplateDetailType = 0;
}
if (Request.QueryString["handle"] != null)
{
ViewState["strHandleType"] = Request.QueryString["handle"].ToString();
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
}
if (Request.QueryString["cachename"] != null)
{
strCacheName = Request.QueryString["cachename"].ToString();
}
//
if (!IsPostBack)
{
if (ViewState["strHandleType"].ToString().Trim() != "")
{
if (Request.QueryString["clientgid"] != null && Request.QueryString["clientgid"].ToString().Trim() != "")
{
UnicodeEncoding unicode = new UnicodeEncoding();
this.hdCLIENTGID.Value = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["clientgid"].ToString().Trim())));
T_ALL_DA T_ALL_DA = new T_ALL_DA();
this.hd_comboSHORTNAME.Value = T_ALL_DA.GetStrSQL("SHORTNAME", "select SHORTNAME from crm_info_client where gid='" + this.hdCLIENTGID.Value.Trim() + "'");
this.hdISCLIENTGID.Value = this.hdCLIENTGID.Value.Trim() == "" ? "" : "1";
}
else
{
this.hd_comboSHORTNAME.Value = "";
this.hdISCLIENTGID.Value = "";
}
//
switch (ViewState["strHandleType"].ToString().Trim())
{
case "add"://新增
getnull();
break;
case "edit"://录入
CRMClientQuotationDA CRMClientQuotationDA = new CRMClientQuotationDA();
CRMClientQuotationEntity model = new CRMClientQuotationEntity();
model = CRMClientQuotationDA.GetModel(ViewState["GID"].ToString().Trim());
if (model != null)
{
//ddlSHORTNAME
this.hd_comboSHORTNAME.Value = model.SHORTNAME.ToString().Trim();
//ddlCONTACTNAME
this.hd_comboCONTACTNAME.Value = model.CONTACTNAME.ToString().Trim();
//ddlSALE
this.hd_comboSALE.Value = model.SALE.ToString().Trim();
//ddlCARRIER
this.hd_comboCARRIER.Value = model.CARRIER.ToString().Trim();
//ddlPORTLOAD
this.hd_comboPORTLOAD.Value = model.PORTLOAD.ToString().Trim();
//ddlPORTDISCHARGE
this.hd_comboPORTDISCHARGE.Value = model.PORTDISCHARGE.ToString().Trim();
//ddlENTREPORT
this.hd_comboENTREPORT.Value = model.ENTREPORT.ToString().Trim();
//ddlLANE
this.hd_comboLANE.Value = model.LANE.ToString().Trim();
tbQUOTATIONDATE.Text = model.QUOTATIONDATE.ToString().Trim().IndexOf("0001") > -1 ? "" : DateTime.Parse(model.QUOTATIONDATE.ToString().Trim()).ToString("yyyy-MM-dd");
tbETD.Text = model.ETD.ToString().Trim().IndexOf("0001") > -1 ? "" : DateTime.Parse(model.ETD.ToString().Trim()).ToString("yyyy-MM-dd");
this.lbWEEK.Value = model.WEEK.ToString().Trim();
tbVALIDDATE.Text = model.VALIDDATE.ToString().Trim().IndexOf("0001") > -1 ? "" : DateTime.Parse(model.VALIDDATE.ToString().Trim()).ToString("yyyy-MM-dd");
tbTT.Text = model.TT.ToString().Trim();
tbGOODSNAME.Text = model.GOODSNAME.ToString().Trim();
tbREMARK.Text = model.REMARK.ToString().Trim();
}
else
{
getnull();
}
//
//权限可视范围
if (this.hdCLIENTGID.Value.Trim() != "")
{
string strV = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modCRMClientQuotationList");
string strO = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modCRMClientQuotationList");
string alt = "";
if (strV.Trim().Equals("4"))//全部
{
}
else if (strV.Trim().Equals("1"))//分公司
{
if (strO.Trim().Equals("1"))//公司
{
alt = RangeDA.GetCRMClientQuotationListCompany(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetCRMClientQuotationListPerson(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
}
else if (strV.Trim().Equals("3"))
{
if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetCRMClientQuotationListPerson(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("4"))//无
{
getEnabled();
}
}
}
//
break;
}
}
else
{
} //
}
recvJSON = "";
payJSON = "";
recvJSON = this.recvContainer.Value.Trim();
payJSON = this.payContainer.Value.Trim();
//获取引入费用模板缓存信息
if (payJSON.Trim().Equals("") && strCacheName != null && iImportTemplateDetailType > 0)//recvJSON.Trim().Equals("") &&
{
DataTable templateTable = (DataTable)Session[strCacheName];
StringBuilder templateBuilder = new StringBuilder();
if (templateTable != null)
{
if (templateTable.Rows.Count > 0)
{
templateBuilder.Append("{\"templates\":[");
for (int i = 0; i < templateTable.Rows.Count; i++)
{
templateTable.Rows[i]["GID"] = Guid.NewGuid().ToString();
if (i == templateTable.Rows.Count - 1)
{
templateBuilder.Append("{");
templateBuilder.Append("\"tid\":\"" + templateTable.Rows[i]["GID"].ToString() + "\",");
templateBuilder.Append("\"fname\":\"" + templateTable.Rows[i]["FEENAME"].ToString() + "\",");
templateBuilder.Append("\"client\":" + templateTable.Rows[i]["CLIENT"].ToString() + ",");
templateBuilder.Append("\"cust\":\"" + templateTable.Rows[i]["CUSTOMERNAME"].ToString() + "\",");
templateBuilder.Append("\"unit\":\"" + templateTable.Rows[i]["UNIT"].ToString() + "\",");
templateBuilder.Append("\"uprice\":" + templateTable.Rows[i]["UNITPRICE"].ToString() + ",");
templateBuilder.Append("\"cur\":\"" + templateTable.Rows[i]["CURRENCY"].ToString() + "\",");
templateBuilder.Append("\"exrate\":" + templateTable.Rows[i]["EXCHANGERATE"].ToString() + ",");
templateBuilder.Append("\"remark\":\"" + templateTable.Rows[i]["REMARK"].ToString() + "\",");
//
string sfeetype = templateTable.Rows[i]["FEETYPE"].ToString().Trim();
if (sfeetype == "3")
{
sfeetype = "1";
}
else if (sfeetype == "4")
{
sfeetype = "2";
}
templateBuilder.Append("\"type\":" + sfeetype.Trim());
templateBuilder.Append("}");
}
else
{
templateBuilder.Append("{");
templateBuilder.Append("\"tid\":\"" + templateTable.Rows[i]["GID"].ToString() + "\",");
templateBuilder.Append("\"fname\":\"" + templateTable.Rows[i]["FEENAME"].ToString() + "\",");
templateBuilder.Append("\"client\":" + templateTable.Rows[i]["CLIENT"].ToString() + ",");
templateBuilder.Append("\"cust\":\"" + templateTable.Rows[i]["CUSTOMERNAME"].ToString() + "\",");
templateBuilder.Append("\"unit\":\"" + templateTable.Rows[i]["UNIT"].ToString() + "\",");
templateBuilder.Append("\"uprice\":" + templateTable.Rows[i]["UNITPRICE"].ToString() + ",");
templateBuilder.Append("\"cur\":\"" + templateTable.Rows[i]["CURRENCY"].ToString() + "\",");
templateBuilder.Append("\"exrate\":" + templateTable.Rows[i]["EXCHANGERATE"].ToString() + ",");
templateBuilder.Append("\"remark\":\"" + templateTable.Rows[i]["REMARK"].ToString() + "\",");
//
string sfeetype = templateTable.Rows[i]["FEETYPE"].ToString().Trim();
if (sfeetype == "3")
{
sfeetype = "1";
}
else if (sfeetype == "4")
{
sfeetype = "2";
}
templateBuilder.Append("\"type\":" + sfeetype.Trim());
templateBuilder.Append("},");
}
}
templateBuilder.Append("]}");
this.h_importtype.Value = iImportTemplateDetailType.ToString();
this.h_cachename.Value = strCacheName;
this.h_cachetemplate.Value = templateBuilder.ToString();
}
else
{
this.h_importtype.Value = iImportTemplateDetailType.ToString();
this.h_cachename.Value = "";
this.h_cachetemplate.Value = "";
}
}
}
if (this.h_post.Value.Trim() != "")
{
//保存操作
if (this.h_post.Value.Trim() == "1")
{
if (!recvJSON.Trim().Equals("") || !payJSON.Trim().Equals(""))
{
SaveFeeAction();
}
}
}
//加载下拉框
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboSHORTNAME();initComboCONTACTNAME();initComboSALE();initComboPORTLOAD(); initComboPORTDISCHARGE();initComboENTREPORT();initComboLANE();initComboCARRIER();</script>");
}
private void getEnabled()
{
//ddlSHORTNAME
//this.hd_comboSHORTNAME.Value="";
//ddlSALE
//this.hd_comboSALE.Value = strShowName;
//ddlCARRIER
//this.hd_comboCARRIER.Value="";
//ddlPORTLOAD
//this.hd_comboPORTLOAD.Value="";
//T_ALL_DA T_ALL_DA = new T_ALL_DA();
//this.hd_comboPORTLOAD.Value = T_ALL_DA.GetStrSQL("PORTLOAD", "select PORTLOAD from subcomp_seae_def where CORPID='" + strCompanyID + "'");
//ddlPORTDISCHARGE
//this.hd_comboPORTDISCHARGE.Value="";
//ddlENTREPORT
//this.hd_comboENTREPORT.Value="";
//ddlLANE
//this.hd_comboLANE.Value="";
//
this.hdEnabled.Value = "0";
tbQUOTATIONDATE.Enabled = false;
tbETD.Enabled = false;
this.lbWEEK.Disabled = true;
tbVALIDDATE.Enabled = false;
tbTT.Enabled = false;
tbGOODSNAME.Enabled = false;
tbREMARK.Enabled = false;
//
this.Div2.Disabled=true;
this.Div6.Disabled=true;
this.btn_recvadd.Disabled=true;
this.btn_recvsave.Disabled=true;
this.btn_recvdel.Disabled=true;
this.btn_recvrefresh.Disabled=true;
this.mygrid_container_recv.Disabled=true;
this.btn_payadd.Disabled=true;
this.btn_paysave.Disabled=true;
this.btn_paydel.Disabled=true;
this.btn_payrefresh.Disabled=true;
this.mygrid_container_pay.Disabled = true;
}
private void getnull()
{
//ddlSHORTNAME
//this.hd_comboSHORTNAME.Value="";
//ddlSALE
this.hd_comboCONTACTNAME.Value = "";
//ddlSALE
this.hd_comboSALE.Value = strShowName;
//ddlCARRIER
this.hd_comboCARRIER.Value="";
//ddlPORTLOAD
this.hd_comboPORTLOAD.Value="";
T_ALL_DA T_ALL_DA = new T_ALL_DA();
this.hd_comboPORTLOAD.Value = T_ALL_DA.GetStrSQL("PORTLOAD", "select PORTLOAD from subcomp_seae_def where CORPID='" + strCompanyID + "'");
//ddlPORTDISCHARGE
this.hd_comboPORTDISCHARGE.Value="";
//ddlENTREPORT
this.hd_comboENTREPORT.Value="";
//ddlLANE
this.hd_comboLANE.Value="";
//
tbQUOTATIONDATE.Text = T_ALL_DA.GetStrSQL("rq", "select convert(char(10),getdate(),20) rq");
tbETD.Text="";
this.lbWEEK.Value = "";
tbVALIDDATE.Text = "";
tbTT.Text="";
tbGOODSNAME.Text="";
tbREMARK.Text="";
}
private void SaveFeeAction()
{
bool bl = false;
if (ViewState["strHandleType"].ToString().Trim().Equals("add"))//新增
{
bl = getAdd();
}
else if (ViewState["strHandleType"].ToString().Trim().Equals("edit"))//录入
{
bl = getEdit();
}
//
if (bl)
{
if (Session[strCacheName] != null)
{
this.h_importtype.Value = iImportTemplateDetailType.ToString();
this.h_cachename.Value = "";
this.h_cachetemplate.Value = "";
Session.Remove(strCacheName);
}
ViewState["strHandleType"] = "edit";
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
//
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>initGrid();window.opener.location.reload();</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + ViewState["strHandleType"].ToString().Trim() + "');</script>");
return;
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('出错,请重新填写!');</script>");
return;
}
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "Quotation" + strBSNO;
return strBSNO;
}
protected bool getAdd()
{
CRMClientQuotationDA CRMClientQuotationDA = new CRMClientQuotationDA();
CRMClientQuotationEntity model = new CRMClientQuotationEntity();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//
ViewState["GID"] = getBSNO();
this.hdGID.Value = ViewState["GID"].ToString().Trim();
model.GID = ViewState["GID"].ToString().Trim();
model.LANE = this.hd_comboLANE.Value.Trim();
model.CARRIER = this.hd_comboCARRIER.Value.Trim();
model.ETD = tbETD.Text.Trim() == "" ? DateTime.Parse("0001-01-01 00:00:00"):DateTime.Parse(tbETD.Text.Trim());
model.WEEK = this.lbWEEK.Value.Trim();
model.VALIDDATE = tbVALIDDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01 00:00:00") : DateTime.Parse(tbVALIDDATE.Text.Trim());
model.ENTREPORT = this.hd_comboENTREPORT.Value.Trim();
model.TT = tbTT.Text.Trim();
model.GOODSNAME = tbGOODSNAME.Text.Trim();
model.REMARK = tbREMARK.Text.Trim();
model.CREATEUSER = strUserID.Trim();
model.MODIFIEDUSER = strUserID.Trim();
model.SHORTNAME = this.hd_comboSHORTNAME.Value.Trim();
model.CLIENTGID = T_ALL_DA.GetStrSQL("gid", "select gid from crm_info_client where SHORTNAME='" + this.hd_comboSHORTNAME.Value.Trim() + "'");
model.DESCRIPTION = T_ALL_DA.GetStrSQL("DESCRIPTION", "select DESCRIPTION from crm_info_client where SHORTNAME='" + this.hd_comboSHORTNAME.Value.Trim() + "'");
model.CONTACTNAME = this.hd_comboCONTACTNAME.Value.Trim();
model.SALE = this.hd_comboSALE.Value.Trim();
model.QUOTATIONDATE = tbQUOTATIONDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01 00:00:00"):DateTime.Parse(tbQUOTATIONDATE.Text.Trim());
model.CORPID = strCompanyID.Trim();
model.PORTLOAD = this.hd_comboENTREPORT.Value.Trim();
model.PORTDISCHARGE = this.hd_comboENTREPORT.Value.Trim();
//
IList<CRMClientQuotationDetailEntity> feeEntities = new List<CRMClientQuotationDetailEntity>();
if (!recvJSON.Trim().Equals(""))
{
feeEntities = ResolveFeeJSON(recvJSON.Trim(), feeEntities, "海运费及附加费", "USD");
recvContainer.Value = "";
}
IList<CRMClientQuotationDetailEntity> feeEntities2 = new List<CRMClientQuotationDetailEntity>();
if (!payJSON.Trim().Equals(""))
{
feeEntities2 = ResolveFeeJSON(payJSON.Trim(), feeEntities2, "人民币费用", "RMB");
payContainer.Value = "";
}
//
int iResult = CRMClientQuotationDA.AddAll(model,feeEntities,feeEntities2);
if (iResult > 0)
{
h_post.Value = "";//请求状态清空
return true;
}
else
{
return false;
}
}
protected bool getEdit()
{
CRMClientQuotationDA CRMClientQuotationDA = new CRMClientQuotationDA();
CRMClientQuotationEntity model = new CRMClientQuotationEntity();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//
model.GID = ViewState["GID"].ToString().Trim();
this.hdGID.Value = ViewState["GID"].ToString().Trim();
model.LANE = this.hd_comboLANE.Value.Trim();
model.CARRIER = this.hd_comboCARRIER.Value.Trim();
model.ETD = tbETD.Text.Trim() == "" ? DateTime.Parse("0001-01-01 00:00:00") : DateTime.Parse(tbETD.Text.Trim());
model.WEEK = this.lbWEEK.Value.Trim();
model.VALIDDATE = tbVALIDDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01 00:00:00") : DateTime.Parse(tbVALIDDATE.Text.Trim());
model.ENTREPORT = this.hd_comboENTREPORT.Value.Trim();
model.TT = tbTT.Text.Trim();
model.GOODSNAME = tbGOODSNAME.Text.Trim();
model.REMARK = tbREMARK.Text.Trim();
model.CREATEUSER = strUserID.Trim();
model.MODIFIEDUSER = strUserID.Trim();
model.SHORTNAME = this.hd_comboSHORTNAME.Value.Trim();
model.CLIENTGID = T_ALL_DA.GetStrSQL("gid", "select gid from crm_info_client where SHORTNAME='" + this.hd_comboSHORTNAME.Value.Trim() + "'");
model.DESCRIPTION = T_ALL_DA.GetStrSQL("DESCRIPTION", "select DESCRIPTION from crm_info_client where SHORTNAME='" + this.hd_comboSHORTNAME.Value.Trim() + "'");
model.CONTACTNAME = this.hd_comboCONTACTNAME.Value.Trim();
model.SALE = this.hd_comboSALE.Value.Trim();
model.QUOTATIONDATE = tbQUOTATIONDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01 00:00:00"):DateTime.Parse(tbQUOTATIONDATE.Text.Trim());
model.CORPID = strCompanyID.Trim();
model.PORTLOAD = this.hd_comboENTREPORT.Value.Trim();
model.PORTDISCHARGE = this.hd_comboENTREPORT.Value.Trim();
//
IList<CRMClientQuotationDetailEntity> feeEntities = new List<CRMClientQuotationDetailEntity>();
if (!recvJSON.Trim().Equals(""))
{
feeEntities = ResolveFeeJSON(recvJSON.Trim(), feeEntities,"海运费及附加费", "USD");
recvContainer.Value = "";
}
IList<CRMClientQuotationDetailEntity> feeEntities2 = new List<CRMClientQuotationDetailEntity>();
if (!payJSON.Trim().Equals(""))
{
feeEntities2 = ResolveFeeJSON(payJSON.Trim(), feeEntities2, "人民币费用", "RMB");
payContainer.Value = "";
}
//
int iResult = CRMClientQuotationDA.UpdateAll(model, feeEntities, feeEntities2);
if (iResult > 0)
{
return true;
}
else
{
return false;
}
}
private IList<CRMClientQuotationDetailEntity> ResolveFeeJSON(string tempJSON, IList<CRMClientQuotationDetailEntity> tempFeeEntities, string strFEETYPE, string strCURRENCY)
{
string strFilter = "";
if (tempJSON.IndexOf("[") >= 0 && tempJSON.IndexOf("]") > 0)
{
strFilter = tempJSON.Substring(tempJSON.IndexOf("[") + 1, tempJSON.IndexOf("]") - tempJSON.IndexOf("[") - 1);
string[] strFees = strFilter.Split(new string[] { "},{" }, System.StringSplitOptions.RemoveEmptyEntries);
if (strFees.Length > 0)
{
for (int i = 0; i < strFees.Length; i++)
{
strFees[i] = strFees[i].ToString().Replace("{", "");
strFees[i] = strFees[i].ToString().Replace("}", "");
string[] strCell = strFees[i].Split(new char[] { ',' });
if (strCell.Length > 0)
{
CRMClientQuotationDetailEntity model = new CRMClientQuotationDetailEntity();
model.CARRIER = "";
for (int j = 0; j < strCell.Length; j++)
{
string[] strArg = strCell[j].Split(new char[] { ':' });
switch (strArg[0].Replace("\"", ""))
{
case "id":
model.GID = strArg[1].ToString().Replace("\"", "").Trim();
break;
case "fname":
model.FEENAME = UnicodeToGB(strArg[1].ToString().Replace("\"", "").Trim());
break;
case "cust":
model.CARRIER = UnicodeToGB(strArg[1].ToString().Replace("\"", "").Trim());
break;
case "unit":
model.UNIT = UnicodeToGB(strArg[1].ToString().Replace("\"", "").Trim());
break;
case "price":
model.UNITPRICE = decimal.Parse(strArg[1].ToString().Replace("\"", "").Trim());
break;
case "remark":
model.REMARK = UnicodeToGB(strArg[1].ToString().Replace("\"", "").Trim());
break;
default:
break;
}
}
model.LINKGID = ViewState["GID"].ToString().Trim();
this.hdGID.Value = ViewState["GID"].ToString().Trim();
model.FEETYPE = strFEETYPE.Trim();
model.CURRENCY = strCURRENCY.Trim();
model.CREATEUSER = strUserID.Trim();
model.MODIFIEDUSER = strUserID.Trim();
tempFeeEntities.Add(model);
}
}
}
}
return tempFeeEntities;
}
#region Unicode-GB Code转换
/// <summary>
/// Unicode-GB Code转换
/// </summary>
/// <param name="text">将Unicode编码字符转换成GB编码字符</param>
/// <returns>GB Code字符串</returns>
public string UnicodeToGB(string text)
{
UnicodeEncoding unicode = new UnicodeEncoding();
text = unicode.GetString(unicode.GetBytes(Regex.Unescape(text.Trim())));
return text;
}
/// <summary>
/// Unicode-GB Code转换
/// </summary>
/// <param name="text">将Unicode编码字符转换成GB编码字符</param>
/// <returns>GB Code字符串</returns>
public string UnicodeToGB_Old(string text)
{
MatchCollection mc = Regex.Matches(text, "([\\w]+)|(\\\\u([\\w]{4}))");
if (mc != null && mc.Count > 0)
{
StringBuilder sb = new StringBuilder();
foreach (Match m2 in mc)
{
string v = m2.Value;
if (v.IndexOf("\\") >= 0)
{
string word = v.Substring(2);
byte[] codes = new byte[2];
int code = Convert.ToInt32(word.Substring(0, 2), 16);
int code2 = Convert.ToInt32(word.Substring(2), 16);
codes[0] = (byte)code2;
codes[1] = (byte)code;
sb.Append(Encoding.Unicode.GetString(codes));
}
else
{
sb.Append(v);
}
}
return sb.ToString();
}
else
{
return text;
}
}
#endregion
}
}