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.
HENGCHENG/DSWeb/FeeCodes/CrmPriceCarrierLCListAdapte...

381 lines
21 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
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.Xml.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Xml;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Text.RegularExpressions;
namespace DSWeb.FeeCodes
{
public partial class CrmPriceCarrierLCListAdapter : System.Web.UI.Page
{
public string strUserID = "";
public string strCompanyID;//公司GID
public string strShowName;//用户显示名
public string strDeptName;//部门名称
public string shandle = "";
public string isLOCKFLAGGID = "";
public string hdLOCKFLAGGID = "";
public string isISSUE = "";
public string hdISSUEGID = "";
public string strPortName = "";
public string hid_sel = "";
public string alt = "";
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
}
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["handle"] != null)
{
if (Request.QueryString["handle"] != null)
{
shandle = Request.QueryString["handle"].ToString();
}
if (Request.QueryString["isLOCKFLAGGID"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
isLOCKFLAGGID = Request.QueryString["isLOCKFLAGGID"].ToString();
}
if (Request.QueryString["hdLOCKFLAGGID"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
hdLOCKFLAGGID = Request.QueryString["hdLOCKFLAGGID"].ToString();
}
if (Request.QueryString["isISSUE"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
isISSUE = Request.QueryString["isISSUE"].ToString();
}
if (Request.QueryString["hdISSUEGID"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
hdISSUEGID = Request.QueryString["hdISSUEGID"].ToString();
}
//
hid_sel = "";
if (Request.QueryString["carrier"] != null && Request.QueryString["carrier"].ToString().Trim() != "")
{
UnicodeEncoding unicode = new UnicodeEncoding();
string strcarrier = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["carrier"].ToString().Trim())));
hid_sel += " and carrier='" + strcarrier + "'";
}
//
if (Request.QueryString["lane"] != null && Request.QueryString["lane"].ToString().Trim() != "")
{
UnicodeEncoding unicode = new UnicodeEncoding();
string strlane = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["lane"].ToString().Trim())));
hid_sel += " and lane='" + strlane + "'";
}
//
if (Request.QueryString["lockflag"] != null && Request.QueryString["lockflag"].ToString().Trim() != "")
{
UnicodeEncoding unicode = new UnicodeEncoding();
string strlockflag = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["lockflag"].ToString().Trim())));
if (!strlockflag.Trim().Equals("9"))
{
hid_sel += " and lockflag='" + strlockflag + "'";
}
}
//
if (shandle.Trim() == "btSubmit")
{
strPortName = "";
alt = "";
T_ALL_DA T_ALL_DA = new T_ALL_DA();
CrmPriceCarrierDA CrmPriceCarrierDA = new CrmPriceCarrierDA();
//
string[] sLOCKFLAGGID = this.hdLOCKFLAGGID.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < sLOCKFLAGGID.Length; i++)
{
alt += " or GID='" + sLOCKFLAGGID[i].ToString().Trim() + "'";
}
int iii = 0;
if (this.isLOCKFLAGGID.Trim().Equals("0"))
{
int ialt = 0;
EBPricequeryDA EBPricequeryDA = new EBPricequeryDA();
IList<EBPricequeryEntity> EBPricequeryEntities = new List<EBPricequeryEntity>();
for (int i = 0; i < sLOCKFLAGGID.Length; i++)
{
EBPricequeryEntities = EBPricequeryDA.GetEBPricequeryByLINKGID(sLOCKFLAGGID[i].ToString().Trim(), "LC");
if (EBPricequeryEntities.Count > 0)
{
ialt = ialt + 1;
}
}
//
if (ialt > 0)
{
strPortName = "有已发布的数据,请先取消数据发布!";
Response.Write(strPortName);
return;
}
//
iii = CrmPriceCarrierDA.UpdateInfoCNTRTOTAL("update crm_price_carrier set LOCKFLAG='0' where (1=0 " + alt + ") and TYPE='LC' ", strUserID.Trim());
}
else if (this.isLOCKFLAGGID.Trim().Equals("1"))
{
iii = CrmPriceCarrierDA.UpdateInfoCNTRTOTAL("update crm_price_carrier set LOCKFLAG='1' where (1=0 " + alt + ") and TYPE='LC' ", strUserID.Trim());
}
else if (this.isLOCKFLAGGID.Trim().Equals("2"))
{
iii = CrmPriceCarrierDA.UpdateInfoCNTRTOTAL("update crm_price_carrier set LOCKFLAG='1' where TYPE='LC' " + hid_sel.Trim(), strUserID.Trim());
}
else if (this.isLOCKFLAGGID.Trim().Equals("3"))
{
int ialt = 0;
ialt = int.Parse(T_ALL_DA.GetStrSQL("icount", "select count(*) as icount from eb_pricequery where TYPE='LC' " + hid_sel.Trim()));
if (ialt > 0)
{
strPortName = "有已发布的数据,请先取消数据发布!";
Response.Write(strPortName);
return;
}
else
{
iii = CrmPriceCarrierDA.UpdateInfoCNTRTOTAL("update crm_price_carrier set LOCKFLAG='0' where TYPE='LC' " + hid_sel.Trim(), strUserID.Trim());
}
}
if (iii == 1)
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>alert('操作成功!');</script>");
Response.Write(strPortName);
return;
}
else
{
strPortName = "操作出错!";
Response.Write(strPortName);
return;
}
//--------------
}
else if (shandle.Trim() == "btIssue")
{
strPortName = "";
alt = "";
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//
EBPricequeryDA EBPricequeryDA = new EBPricequeryDA();
EBPricequeryEntity EBPricequeryEntity1 = new EBPricequeryEntity();
IList<EBPricequeryEntity> EBPricequeryEntities = new List<EBPricequeryEntity>();
CrmPriceCarrierEntity CrmPriceCarrierEntity = new CrmPriceCarrierEntity();
CrmPriceCarrierDA CrmPriceCarrierDA = new CrmPriceCarrierDA();
string strError = "";
string[] sISSUEGID = hdISSUEGID.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < sISSUEGID.Length; i++)
{
alt += " or LINKGID='" + sISSUEGID[i].ToString().Trim() + "'";
}
int iii = 0;
if (this.isISSUE.Trim().Equals("0"))
{
strError = EBPricequeryDA.GetEBPricequeryDel(alt, strUserID.Trim(), "LC", strCompanyID.Trim());
}
else if (this.isISSUE.Trim().Equals("1"))
{
for (int i = 0; i < sISSUEGID.Length; i++)
{
EBPricequeryEntities = EBPricequeryDA.GetEBPricequeryByLINKGID(sISSUEGID[i].ToString().Trim(), "LC");
CrmPriceCarrierEntity = CrmPriceCarrierDA.GetID(sISSUEGID[i].ToString().Trim());
string sSHOWNAME = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID ='" + strUserID + "'");
//
if (EBPricequeryEntities.Count > 0)
{
foreach (EBPricequeryEntity EBPricequeryEntity in EBPricequeryEntities)
{
EBPricequeryEntity1.GID = EBPricequeryEntity.GID;
EBPricequeryEntity1.PODLOAD = CrmPriceCarrierEntity.PODLOAD;
EBPricequeryEntity1.PORTDISCHARGE = CrmPriceCarrierEntity.PORTDISCHARGE;
EBPricequeryEntity1.DESTINATION = CrmPriceCarrierEntity.DESTINATION;
EBPricequeryEntity1.VIA = CrmPriceCarrierEntity.VIA;
EBPricequeryEntity1.POC = CrmPriceCarrierEntity.POC;
EBPricequeryEntity1.LANE = CrmPriceCarrierEntity.LANE;
EBPricequeryEntity1.CARRIERLANE = CrmPriceCarrierEntity.CARRIERLANE;
EBPricequeryEntity1.CARRIER = CrmPriceCarrierEntity.CARRIER;
EBPricequeryEntity1.FORWARDER = CrmPriceCarrierEntity.FORWARDER;
EBPricequeryEntity1.ETD = CrmPriceCarrierEntity.ETD;
EBPricequeryEntity1.TT = CrmPriceCarrierEntity.TT;
EBPricequeryEntity1.SVC = CrmPriceCarrierEntity.SVC;
EBPricequeryEntity1.SC = CrmPriceCarrierEntity.SC;
EBPricequeryEntity1.NAMEAC = CrmPriceCarrierEntity.NAMEAC;
EBPricequeryEntity1.SICUT = CrmPriceCarrierEntity.SICUT;
EBPricequeryEntity1.CUSCLSG = CrmPriceCarrierEntity.CUSCLSG;
EBPricequeryEntity1.CYCLSG = CrmPriceCarrierEntity.CYCLSG;
EBPricequeryEntity1.OWS = CrmPriceCarrierEntity.OWS;
EBPricequeryEntity1.COMMODITY = CrmPriceCarrierEntity.COMMODITY;
EBPricequeryEntity1.D_20GP = CrmPriceCarrierEntity.D_20GP1;
EBPricequeryEntity1.D_40GP = CrmPriceCarrierEntity.D_40GP1;
EBPricequeryEntity1.D_40HQ = CrmPriceCarrierEntity.D_40HQ1;
EBPricequeryEntity1.D_40RH = CrmPriceCarrierEntity.D_40RH1;
EBPricequeryEntity1.D_45HQ = CrmPriceCarrierEntity.D_45HQ1;
EBPricequeryEntity1.LEVEL = "1";
EBPricequeryEntity1.MODIFIEDUSER = sSHOWNAME;
EBPricequeryEntity1.LINKGID = EBPricequeryEntity.LINKGID;
EBPricequeryEntity1.REMARK = CrmPriceCarrierEntity.REMARK;
//
EBPricequeryEntity1.CARRIERCN = CrmPriceCarrierEntity.CARRIERCN;
EBPricequeryEntity1.BOOKINGFEE = CrmPriceCarrierEntity.BOOKINGFEE;
EBPricequeryEntity1.CTNFEE = CrmPriceCarrierEntity.CTNFEE;
EBPricequeryEntity1.THCFEE = CrmPriceCarrierEntity.THCFEE;
EBPricequeryEntity1.FILEFEE = CrmPriceCarrierEntity.FILEFEE;
EBPricequeryEntity1.LCLPRICE = CrmPriceCarrierEntity.LCLPRICE;
EBPricequeryEntity1.CISF = CrmPriceCarrierEntity.CISF;
EBPricequeryEntity1.REMARK2 = CrmPriceCarrierEntity.REMARK2;
EBPricequeryEntity1.TYPE = CrmPriceCarrierEntity.TYPE;
EBPricequeryEntity1.CORPID = CrmPriceCarrierEntity.CORPID;
EBPricequeryEntity1.PIRICEVIAPORT = CrmPriceCarrierEntity.PIRICEVIAPORT;
EBPricequeryEntity1.D_20RS = CrmPriceCarrierEntity.D_20RS1;
EBPricequeryEntity1.D_40NOR = CrmPriceCarrierEntity.D_40NOR1;
//
iii = EBPricequeryDA.UpdateInfo(EBPricequeryEntity1);
if (iii < 1)
{
strError += ",更新GID" + EBPricequeryEntity.GID.ToString() + "";
}
}
}
else
{
EBPricequeryEntity1.GID = getBSNO();
EBPricequeryEntity1.PODLOAD = CrmPriceCarrierEntity.PODLOAD;
EBPricequeryEntity1.PORTDISCHARGE = CrmPriceCarrierEntity.PORTDISCHARGE;
EBPricequeryEntity1.DESTINATION = CrmPriceCarrierEntity.DESTINATION;
EBPricequeryEntity1.VIA = CrmPriceCarrierEntity.VIA;
EBPricequeryEntity1.POC = CrmPriceCarrierEntity.POC;
EBPricequeryEntity1.LANE = CrmPriceCarrierEntity.LANE;
EBPricequeryEntity1.CARRIERLANE = CrmPriceCarrierEntity.CARRIERLANE;
EBPricequeryEntity1.CARRIER = CrmPriceCarrierEntity.CARRIER;
EBPricequeryEntity1.FORWARDER = CrmPriceCarrierEntity.FORWARDER;
EBPricequeryEntity1.ETD = CrmPriceCarrierEntity.ETD;
EBPricequeryEntity1.TT = CrmPriceCarrierEntity.TT;
EBPricequeryEntity1.SVC = CrmPriceCarrierEntity.SVC;
EBPricequeryEntity1.SC = CrmPriceCarrierEntity.SC;
EBPricequeryEntity1.NAMEAC = CrmPriceCarrierEntity.NAMEAC;
EBPricequeryEntity1.SICUT = CrmPriceCarrierEntity.SICUT;
EBPricequeryEntity1.CUSCLSG = CrmPriceCarrierEntity.CUSCLSG;
EBPricequeryEntity1.CYCLSG = CrmPriceCarrierEntity.CYCLSG;
EBPricequeryEntity1.OWS = CrmPriceCarrierEntity.OWS;
EBPricequeryEntity1.COMMODITY = CrmPriceCarrierEntity.COMMODITY;
EBPricequeryEntity1.D_20GP = CrmPriceCarrierEntity.D_20GP1;
EBPricequeryEntity1.D_40GP = CrmPriceCarrierEntity.D_40GP1;
EBPricequeryEntity1.D_40HQ = CrmPriceCarrierEntity.D_40HQ1;
EBPricequeryEntity1.D_40RH = CrmPriceCarrierEntity.D_40RH1;
EBPricequeryEntity1.D_45HQ = CrmPriceCarrierEntity.D_45HQ1;
EBPricequeryEntity1.LEVEL = "1";
EBPricequeryEntity1.INPUTBY = sSHOWNAME;
EBPricequeryEntity1.MODIFIEDUSER = sSHOWNAME;
EBPricequeryEntity1.LINKGID = CrmPriceCarrierEntity.GID;
EBPricequeryEntity1.REMARK = CrmPriceCarrierEntity.REMARK;
//
EBPricequeryEntity1.EFFECTIVEDATE = CrmPriceCarrierEntity.EFFECTIVEDATE;
EBPricequeryEntity1.VALIDDATE = CrmPriceCarrierEntity.VALIDDATE;
//
EBPricequeryEntity1.CARRIERCN = CrmPriceCarrierEntity.CARRIERCN;
EBPricequeryEntity1.BOOKINGFEE = CrmPriceCarrierEntity.BOOKINGFEE;
EBPricequeryEntity1.CTNFEE = CrmPriceCarrierEntity.CTNFEE;
EBPricequeryEntity1.THCFEE = CrmPriceCarrierEntity.THCFEE;
EBPricequeryEntity1.FILEFEE = CrmPriceCarrierEntity.FILEFEE;
EBPricequeryEntity1.LCLPRICE = CrmPriceCarrierEntity.LCLPRICE;
EBPricequeryEntity1.CISF = CrmPriceCarrierEntity.CISF;
EBPricequeryEntity1.REMARK2 = CrmPriceCarrierEntity.REMARK2;
EBPricequeryEntity1.TYPE = CrmPriceCarrierEntity.TYPE;
EBPricequeryEntity1.CORPID = CrmPriceCarrierEntity.CORPID;
//
EBPricequeryEntity1.EFFECTIVEDATE = CrmPriceCarrierEntity.EFFECTIVEDATE;
EBPricequeryEntity1.VALIDDATE = CrmPriceCarrierEntity.VALIDDATE;
EBPricequeryEntity1.PIRICEVIAPORT = CrmPriceCarrierEntity.PIRICEVIAPORT;
EBPricequeryEntity1.D_20RS = CrmPriceCarrierEntity.D_20RS1;
EBPricequeryEntity1.D_40NOR = CrmPriceCarrierEntity.D_40NOR1;
//
iii = EBPricequeryDA.InserInfo(EBPricequeryEntity1);
if (iii < 1)
{
strError += ",插入GID" + EBPricequeryEntity1.GID.ToString() + "";
}
}
}
}
else if (this.isISSUE.Trim().Equals("2"))
{
int irr = EBPricequeryDA.GetISSUEALLLC(strUserID.Trim(), strCompanyID.Trim(), hid_sel);
if (irr > 0)
{
strError = "";
}
else if (irr > 0)
{
strError = "" + irr;
}
}
else if (this.isISSUE.Trim().Equals("3"))
{
strError = EBPricequeryDA.GetEBPricequeryDelALL(strUserID.Trim(), "LC", strCompanyID.Trim(), hid_sel);
}
if (strError.Trim().Equals(""))
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script>alert('操作成功!');</script>");
Response.Write(strPortName);
return;
}
else
{
strPortName = "操作出错!";
Response.Write(strPortName);
return;
}
//--------------
}
}
Response.Write(strPortName);
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "EBPQ" + strBSNO;
return strBSNO;
}
}
}