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

501 lines
23 KiB
C#

11 months ago
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;
namespace DSWeb.FeeCodes
{
public partial class CrmPriceCarrierAdapter : System.Web.UI.Page
{
private string strMark;
private string strPos;
private int iPos = 0;
private string strPortName = "";
private string strPORTDISCHARGE = "";
private string strType = "";
private string strCompanyID = "";
T_ALL_DA T_ALL_DA = new T_ALL_DA();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strPost = Request.Url.ToString();
if (Request.QueryString["mask"] != null)
{
strMark = Request.QueryString["mask"].ToString();
}
if (Request.QueryString["pos"] != null)
{
strPos = Request.QueryString["pos"].ToString();
iPos = int.Parse(strPos);
}
if (Request.QueryString["type"] != null)
{
strType = Request.QueryString["type"].ToString();
}
if (Request.QueryString["companyid"] != null)
{
strCompanyID = Request.QueryString["companyid"].ToString();
}
if (Request.QueryString["portdischarge"] != null)
{
strPORTDISCHARGE = Request.QueryString["portdischarge"].ToString();
}
if (Request.QueryString["yunjia"] != null)
{
if (Request.QueryString["yunjia"].ToString().Trim() == "tcodedisportadapter")//卸货港
{
XmlDocument xmldoc = new XmlDocument();
string content = GetTCodeDisportAdapter();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "webcrmclientadapter")//船公司
{
XmlDocument xmldoc = new XmlDocument();
string content = GetWebCrmClientAdapter();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "tcodeloadportadapter")//启运港==装货港
{
XmlDocument xmldoc = new XmlDocument();
string content = GetTCodeLoadportAdapter();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "tcodelanesadapter")//航线
{
XmlDocument xmldoc = new XmlDocument();
string content = GetTCodeLanesAdapter();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "destination")//目的港
{
XmlDocument xmldoc = new XmlDocument();
string content = GetDestination();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "via")//中转港
{
XmlDocument xmldoc = new XmlDocument();
string content = GetVIA();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "piriceviaport")//计价港
{
XmlDocument xmldoc = new XmlDocument();
string content = GetPIRICEVIAPORT();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "svc")//服务
{
XmlDocument xmldoc = new XmlDocument();
string content = GetSVC();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "forwarder")//服务
{
XmlDocument xmldoc = new XmlDocument();
string content = GetFORWARDER();
try
{
xmldoc.LoadXml(content);
Response.ContentType = "text/xml";
Response.Write(xmldoc.OuterXml.ToString());
}
catch (Exception)
{
Response.Write("");
}
}
else if (Request.QueryString["yunjia"].ToString().Trim() == "getlanegid")//与卸货港关联的航线
{
XmlDocument xmldoc = new XmlDocument();
string content = getlanegid();
Response.Write(content.ToString());
}
}
}
}
protected string getXML(string strXML)//与卸货港关联的航线
{
strXML = strXML.Trim().Replace("&", "&");
strXML = strXML.Trim().Replace("<", "&lt;");
strXML = strXML.Trim().Replace(">", "&gt;");
strXML = strXML.Trim().Replace("'", "&apos;");
strXML = strXML.Trim().Replace("\"", "&quot;");
return strXML;
}
protected string getlanegid()//与卸货港关联的航线
{
strPortName = "";
if (strPORTDISCHARGE != "" && strPORTDISCHARGE != "null")
{
//strPortName = T_ALL_DA.GetStrSQL("LANE", "select top 1 LANE from crm_price_carrier where type='" + strType + "' and PORTDISCHARGE='" + strPORTDISCHARGE.Trim() + "' and CORPID='" + strCompanyID + "' group by PORTDISCHARGE,LANE order by LANE,PORTDISCHARGE");
strPortName = T_ALL_DA.GetStrSQL("LANE", "select top 1 LANE from crm_price_carrier where PORTDISCHARGE='" + strPORTDISCHARGE.Trim() + "' group by PORTDISCHARGE,LANE order by LANE,PORTDISCHARGE");
}
return strPortName;
}
public string GetFORWARDER()//代理公司
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str="select FORWARDER from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by FORWARDER order by FORWARDER";
string str = "select FORWARDER from crm_price_carrier group by FORWARDER order by FORWARDER";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["FORWARDER"].ToString().Trim() != "")
{
strXML = getXML(dr["FORWARDER"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetSVC()//服务
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select SVC from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by SVC order by SVC";
string str = "select SVC from crm_price_carrier group by SVC order by SVC";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["SVC"].ToString().Trim() != "")
{
strXML=getXML(dr["SVC"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetPIRICEVIAPORT()//计价港
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select PIRICEVIAPORT from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by PIRICEVIAPORT order by PIRICEVIAPORT";
string str = "select PIRICEVIAPORT from crm_price_carrier group by PIRICEVIAPORT order by PIRICEVIAPORT";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["PIRICEVIAPORT"].ToString().Trim() != "")
{
strXML = getXML(dr["PIRICEVIAPORT"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetVIA()//中转港
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select VIA from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by VIA order by VIA";
string str = "select VIA from crm_price_carrier group by VIA order by VIA";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["VIA"].ToString().Trim() != "")
{
strXML = getXML(dr["VIA"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetDestination()//目的港
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select destination from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by destination order by destination";
string str = "select destination from crm_price_carrier group by destination order by destination";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["destination"].ToString().Trim() != "")
{
strXML = getXML(dr["destination"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetTCodeLanesAdapter()//航线
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select LANE from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by LANE order by LANE";
string str = "select LANE from crm_price_carrier group by LANE order by LANE";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["LANE"].ToString().Trim() != "")
{
strXML = getXML(dr["LANE"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetTCodeLoadportAdapter()//启运港==装货港
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select PODLOAD from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by PODLOAD order by PODLOAD";
string str = "select PODLOAD from crm_price_carrier group by PODLOAD order by PODLOAD";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["PODLOAD"].ToString().Trim() != "")
{
strXML = getXML(dr["PODLOAD"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
else
{
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "SHANGHAI,CHINA", "SHANGHAI,CHINA");
}
}
else
{
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "SHANGHAI,CHINA", "SHANGHAI,CHINA");
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetWebCrmClientAdapter()//船公司
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select CARRIER from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by CARRIER order by CARRIER";
string str = "select CARRIER from crm_price_carrier group by CARRIER order by CARRIER";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["CARRIER"].ToString().Trim() != "")
{
strXML = getXML(dr["CARRIER"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
public string GetTCodeDisportAdapter()//卸货港
{
string strXML = "";
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.Append("<?xml version=\"1.0\" ?>");
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
if (!string.IsNullOrEmpty(strMark))
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//string str = "select PORTDISCHARGE from crm_price_carrier where type='" + strType + "' and CORPID='" + strCompanyID + "' group by PORTDISCHARGE order by PORTDISCHARGE";
string str = "select PORTDISCHARGE from crm_price_carrier group by PORTDISCHARGE order by PORTDISCHARGE";
DataSet ds = T_ALL_DA.GetYunJiaGroupBy(str);
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["PORTDISCHARGE"].ToString().Trim() != "")
{
strXML = getXML(dr["PORTDISCHARGE"].ToString().Trim());
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", strXML.Trim(), strXML.Trim());
}
}
}
}
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
resultBuilder.Append("</complete>");
return resultBuilder.ToString();
}
}
}