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.

1388 lines
60 KiB
C#

12 months ago
using System;
using System.Collections;
using System.Collections.Generic;
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.Text;
using DSWeb.DataAccess;
using System.Data.SqlClient;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Web.Script.Serialization;
namespace DSWeb.Shipping
{
public partial class ExchangesUnitInfo : System.Web.UI.Page
{
public string strHandleType = String.Empty;
public string sSQL = String.Empty;
public string gvid = String.Empty;
public string strUserID = String.Empty;
T_ALL_DA T_ALL_DA = new T_ALL_DA();
MoneyConvert MoneyConvert = new MoneyConvert();
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
RangeDA RangeDA = new RangeDA();
public int isOpenAnnounce;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
this.hdUserID.Value = strUserID.Trim();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
}
//
isOpenAnnounce = 0;
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
Label1.Visible=true;
//rblLEVEL.Visible = true;
Label2.Visible = true;
tbLOGINNAME.Visible = true;
Label3.Visible = true;
tbLOGINPASSWORD.Visible = true;
}
else
{
Label1.Visible=false;
//rblLEVEL.Visible=false;
Label2.Visible=false;
tbLOGINNAME.Visible=false;
Label3.Visible=false;
tbLOGINPASSWORD.Visible=false;
}
//
if (Request.QueryString["id"] != null)//if (Request.QueryString["id"] != null)
{
ViewState["GID"] = Request.QueryString["id"].ToString();//"topseaeusername129481962859531250";
this.hdGid.Value = ViewState["GID"].ToString().Trim();
}
//
//权限菜单范围
string strAction = T_ALL_DA.GetStrSQL("USERID", "select USERID from [user_action] where USERID='" + strUserID.Trim() + "' and ACTIONID='7309DD9E-3A7F-44E9-93A2-3CA571C374E9'");
if (strAction.Trim().Equals(""))
{
Response.Write("<script>alert('无权限打开往来单位信息!');window.parent.close();window.close();</script>");
Response.End();
//Response.Close();
return;
}
//权限可视范围
//if (strHandleType.Trim() == "edit")
//{
//
string strV = RangeDA.GetVISIBLERANGE(this.hdUserID.Value.Trim(), "modExchangesUnit");
string strO = RangeDA.GetOPERATERANGE(this.hdUserID.Value.Trim(), "modExchangesUnit");
string alt = "";
if (strV.Trim().Equals("4"))
{
Response.Write("<script>alert('无权限打开往来单位信息!');window.parent.close();window.close();</script>");
Response.End();
//Response.Close();
return;
}
else if (strV.Trim().Equals("0"))
{
if (strV.Trim() != strO.Trim())
{
if (strO.Trim().Equals("1"))//分公司
{
if (ViewState["GID"] != null)
{
alt = RangeDA.GetUnitCompany(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("2"))//部门
{
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("3"))//个人
{
if (ViewState["GID"] != null)
{
alt = RangeDA.GetUnitPerson(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("4"))//无
{
if (ViewState["GID"] == null)
{
Response.Write("<script>alert('无权限新建往来单位信息!');</script>");
Response.End();
//Response.Close();
return;
}
getEnabled();
}
}
}
else if (strV.Trim().Equals("1"))
{
if (strO.Trim().Equals("1"))//公司
{
if (ViewState["GID"] != null)
{
alt = RangeDA.GetUnitCompany(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
ibAdd.Enabled = true;
}
if (strO.Trim().Equals("2"))//部门
{
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("3"))//个人
{
if (ViewState["GID"] != null)
{
alt = RangeDA.GetUnitPerson(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("4"))//无
{
if (ViewState["GID"] == null)
{
Response.Write("<script>alert('无权限打开往来单位信息!');</script>");
Response.End();
//Response.Close();
return;
}
getEnabled();
}
}
else if (strV.Trim().Equals("2"))
{
if (strO.Trim().Equals("2"))//个人
{
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("3"))//个人
{
if (ViewState["GID"] != null)
{
alt = RangeDA.GetUnitPerson(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("4"))//无
{
if (ViewState["GID"] == null)
{
Response.Write("<script>alert('无权限打开往来单位信息!');</script>");
Response.End();
//Response.Close();
return;
}
getEnabled();
}
}
else if (strV.Trim().Equals("3"))
{
if (strO.Trim().Equals("3"))//个人
{
if (ViewState["GID"] != null)
{
alt = RangeDA.GetUnitPerson(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("4"))//无
{
if (ViewState["GID"] == null)
{
Response.Write("<script>alert('无权限打开往来单位信息!');window.parent.close();window.close();</script>");
Response.End();
//Response.Close();
return;
}
getEnabled();
}
}
//}
//else
//{
// getEnabledTrue();
//}
if (!IsPostBack)
{
if (Request.QueryString["handle"] != null)
{
ViewState["strHandleType"] = Request.QueryString["handle"].ToString();//"edit";
strHandleType = ViewState["strHandleType"].ToString().Trim();
this.hdhandle.Value = Request.QueryString["handle"].ToString();
//
switch (strHandleType)
{
case "add"://新增
getaddnull();
break;
case "edit"://录入
DataSet ds = T_ALL_DA.GetInfoClient(" and GID='" + ViewState["GID"].ToString().Trim() + "'");
//
if (ds == null)
{
strHandleType = "add";
ViewState["strHandleType"] = "add";
//
getaddnull();
}
else
{
if (ds.Tables[0].Rows[0]["ISSTOP"].ToString().Trim() == "True")
{
cbISSTOP.Checked = true;
}
else
{
cbISSTOP.Checked = false;
}
//
this.hd_comboOP.Value = ds.Tables[0].Rows[0]["OP"].ToString().Trim();
this.hd_comboSALE.Value = ds.Tables[0].Rows[0]["SALE"].ToString().Trim();
this.hd_comboDOC.Value = ds.Tables[0].Rows[0]["DOC"].ToString().Trim();
tbCODENAME.Text = ds.Tables[0].Rows[0]["CODENAME"].ToString().Trim();
this.hdCODENAME.Value = ds.Tables[0].Rows[0]["CODENAME"].ToString().Trim();
tbSHORTNAME.Text = ds.Tables[0].Rows[0]["SHORTNAME"].ToString().Trim();
this.hdSHORTNAME.Value = ds.Tables[0].Rows[0]["SHORTNAME"].ToString().Trim();
tbDESCRIPTION.Text = ds.Tables[0].Rows[0]["DESCRIPTION"].ToString().Trim();
this.hdDESCRIPTION.Value = ds.Tables[0].Rows[0]["DESCRIPTION"].ToString().Trim();
tbNAME.Text = ds.Tables[0].Rows[0]["NAME"].ToString().Trim();
tbEnFullName.Text = ds.Tables[0].Rows[0]["EnFullName"].ToString().Trim();
//
int itel = ds.Tables[0].Rows[0]["TEL"].ToString().Trim().IndexOf("-");
if (itel != 0)
{
string[] strTELs = ds.Tables[0].Rows[0]["TEL"].ToString().Trim().Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i < strTELs.Length; i++)
{
if (strTELs[0].Trim() == "" || strTELs[0].Trim() == "0")
{
tbTEL1.Text = "86";
}
else
{
tbTEL1.Text = strTELs[0].Trim();
}
if (strTELs[1].Trim() == "" || strTELs[1].Trim() == "0")
{
tbTEL2.Text ="";
}
else
{
tbTEL2.Text = strTELs[1].Trim();
}
if (strTELs[2].Trim() == "" || strTELs[2].Trim() == "0")
{
tbTEL.Text = "";
}
else
{
tbTEL.Text = strTELs[2].Trim();
}
}
}
else
{
tbTEL1.Text = "86";
tbTEL2.Text = "";
tbTEL.Text = "";
}
//
int iFAX = ds.Tables[0].Rows[0]["FAX"].ToString().Trim().IndexOf("-");
if (iFAX != 0)
{
string[] strFAXs = ds.Tables[0].Rows[0]["FAX"].ToString().Trim().Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i < strFAXs.Length; i++)
{
if (strFAXs[0].Trim() == "" || strFAXs[0].Trim() == "0")
{
tbFAX1.Text = "86";
}
else
{
tbFAX1.Text = strFAXs[0].Trim();
}
if (strFAXs[1].Trim() == "" || strFAXs[1].Trim() == "0")
{
tbFAX2.Text = "";
}
else
{
tbFAX2.Text = strFAXs[1].Trim();
}
if (strFAXs[2].Trim() == "" || strFAXs[2].Trim() == "0")
{
tbFAX.Text = "";
}
else
{
tbFAX.Text = strFAXs[2].Trim();
}
}
}
else
{
tbFAX1.Text = "86";
tbFAX2.Text = "";
tbFAX.Text = "";
}
//
tbADDR.Text = ds.Tables[0].Rows[0]["ADDR"].ToString().Trim();
tbEMAIL.Text = ds.Tables[0].Rows[0]["EMAIL"].ToString().Trim();
tbWEB.Text = ds.Tables[0].Rows[0]["WEB"].ToString().Trim();
tbQQ.Text = ds.Tables[0].Rows[0]["QQ"].ToString().Trim();
tbMSN.Text = ds.Tables[0].Rows[0]["MSN"].ToString().Trim();
tbREGISTRATIONNO.Text = ds.Tables[0].Rows[0]["REGISTRATIONNO"].ToString().Trim();
tbORDERNO.Text = ds.Tables[0].Rows[0]["ORDERNO"].ToString().Trim();
tbUNITPRICE.Text = ds.Tables[0].Rows[0]["UNITPRICE"].ToString().Trim();
ddlCustomAttributes1.Value = ds.Tables[0].Rows[0]["CustomAttributes1"].ToString().Trim();
ddlCustomAttributes2.Value = ds.Tables[0].Rows[0]["CustomAttributes2"].ToString().Trim();
tbEDICODE.Text = ds.Tables[0].Rows[0]["EDICODE"].ToString().Trim();
//
if (ds.Tables[0].Rows[0]["ISCARRIER"].ToString().Trim() == "True")
{
cbISCARRIER.Checked = true;
}
else
{
cbISCARRIER.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISCONTROLLER"].ToString().Trim() == "True")
{
cbISCONTROLLER.Checked = true;
}
else
{
cbISCONTROLLER.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISYARD"].ToString().Trim() == "True")
{
cbISYARD.Checked = true;
}
else
{
cbISYARD.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISCUSTOM"].ToString().Trim() == "True")
{
cbISCUSTOM.Checked = true;
}
else
{
cbISCUSTOM.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISSHIPPER"].ToString().Trim() == "True")
{
cbISSHIPPER.Checked = true;
}
else
{
cbISSHIPPER.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISCONSIGNEE"].ToString().Trim() == "True")
{
cbISCONSIGNEE.Checked = true;
}
else
{
cbISCONSIGNEE.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISBOOKING"].ToString().Trim() == "True")
{
cbISBOOKING.Checked = true;
}
else
{
cbISBOOKING.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISAIRLINES"].ToString().Trim() == "True")
{
cbISAIRLINES.Checked = true;
}
else
{
cbISAIRLINES.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISWAREHOUSE"].ToString().Trim() == "True")
{
cbISWAREHOUSE.Checked = true;
}
else
{
cbISWAREHOUSE.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISEXPRESS"].ToString().Trim() == "True")
{
cbISEXPRESS.Checked = true;
}
else
{
cbISEXPRESS.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISAGENTCN"].ToString().Trim() == "True")
{
cbISAGENTCN.Checked = true;
}
else
{
cbISAGENTCN.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISAGENT"].ToString().Trim() == "True")
{
cbISAGENT.Checked = true;
}
else
{
cbISAGENT.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISTRUCK"].ToString().Trim() == "True")
{
cbISTRUCK.Checked = true;
}
else
{
cbISTRUCK.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISWHARF"].ToString().Trim() == "True")
{
cbISWHARF.Checked = true;
}
else
{
cbISWHARF.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISSHIPPINGAGENT"].ToString().Trim() == "True")
{
cbISSHIPPINGAGENT.Checked = true;
}
else
{
cbISSHIPPINGAGENT.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISINSURE"].ToString().Trim() == "True")
{
cbISINSURE.Checked = true;
}
else
{
cbISINSURE.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISLEASING"].ToString().Trim() == "True")
{
cbISLEASING.Checked = true;
}
else
{
cbISLEASING.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISTradingAgency"].ToString().Trim() == "True")
{
cbISTradingAgency.Checked = true;
}
else
{
cbISTradingAgency.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISENTERP"].ToString().Trim() == "True")
{
cbISENTERP.Checked = true;
}
else
{
cbISENTERP.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISOTHER"].ToString().Trim() == "True")
{
cbISOTHER.Checked = true;
}
else
{
cbISOTHER.Checked = false;
}
//
tbOTHERS.Text = ds.Tables[0].Rows[0]["OTHERS"].ToString().Trim();
tbREMARK.Text = ds.Tables[0].Rows[0]["REMARK"].ToString().Trim();
tbCHIEF.Text = ds.Tables[0].Rows[0]["CHIEF"].ToString().Trim();
tbLOGINNAME.Text = ds.Tables[0].Rows[0]["LOGINNAME"].ToString().Trim();
tbLOGINPASSWORD.Text = ds.Tables[0].Rows[0]["LOGINPASSWORD"].ToString().Trim();
//
string strLEVEL = ds.Tables[0].Rows[0]["LEVEL"].ToString().Trim();
if (!strLEVEL.Trim().Equals(""))
{
rblLEVEL.SelectedValue = strLEVEL;
}
}
break;
}
}
else
{
}
}
//加载下拉框
Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>initComboOP();initComboSALE();initComboDOC();</script>");
}
protected void getaddnull()
{
cbISSTOP.Checked = false;
this.hd_comboSALE.Value = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID='" + this.hdUserID.Value.Trim() + "'");
this.hd_comboOP.Value = "";
this.hd_comboDOC.Value = "";
tbCODENAME.Text = "";
this.hdCODENAME.Value = "";
tbSHORTNAME.Text = "";
this.hdSHORTNAME.Value = "";
tbDESCRIPTION.Text = "";
this.hdDESCRIPTION.Value = "";
tbNAME.Text = "";
tbEnFullName.Text = "";
tbTEL1.Text = "86";
tbTEL2.Text = "";
tbTEL.Text = "";
tbFAX1.Text = "86";
tbFAX2.Text = "";
tbFAX.Text = "";
tbADDR.Text = "";
tbEMAIL.Text = "";
tbWEB.Text = "";
tbQQ.Text = "";
tbMSN.Text = "";
tbREGISTRATIONNO.Text = "";
tbEDICODE.Text = "";
tbORDERNO.Text = "";
tbUNITPRICE.Text = "0";
ddlCustomAttributes1.Value = "";
ddlCustomAttributes2.Value = "";
cbISCARRIER.Checked = false;
cbISCONTROLLER.Checked = false;
cbISYARD.Checked = false;
cbISCUSTOM.Checked = false;
cbISSHIPPER.Checked = false;
cbISCONSIGNEE.Checked = false;
cbISBOOKING.Checked = false;
cbISAIRLINES.Checked = false;
cbISWAREHOUSE.Checked = false;
cbISEXPRESS.Checked = false;
cbISAGENTCN.Checked = false;
cbISAGENT.Checked = false;
cbISTRUCK.Checked = false;
cbISWHARF.Checked = false;
cbISSHIPPINGAGENT.Checked = false;
cbISINSURE.Checked = false;
cbISLEASING.Checked = false;
cbISTradingAgency.Checked = false;
cbISENTERP.Checked = false;
cbISOTHER.Checked = false;
tbOTHERS.Text = "";
tbREMARK.Text = "";
tbCHIEF.Text = "";
//
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
rblLEVEL.SelectedValue = "1";//"3";
tbLOGINNAME.Text = "";
tbLOGINPASSWORD.Text = "";
}
}
protected void getEnabled()
{
ibAdd.Enabled = false;
this.ibEnter.Disabled = true;
this.imgDel.Disabled = true;
//ibDel.Enabled = false;
//
this.hdEnabled.Value = "false";
//
cbISSTOP.Enabled = false;
//ddlSALE.Enabled = false;
//ddlOP.Enabled = false;
//ddlDOC.Enabled = false;
tbCODENAME.Enabled = false;
tbSHORTNAME.Enabled = false;
tbDESCRIPTION.Enabled = false;
tbNAME.Enabled = false;
tbEnFullName.Enabled = false;
tbTEL1.Enabled = false;
tbTEL2.Enabled = false;
tbTEL.Enabled = false;
tbFAX1.Enabled = false;
tbFAX2.Enabled = false;
tbFAX.Enabled = false;
tbADDR.Enabled = false;
tbEMAIL.Enabled = false;
tbWEB.Enabled = false;
tbQQ.Enabled = false;
tbMSN.Enabled = false;
tbREGISTRATIONNO.Enabled = false;
tbEDICODE.Enabled = false;
tbORDERNO.Enabled = false;
tbUNITPRICE.Enabled = false;
ddlCustomAttributes1.Disabled = true;
ddlCustomAttributes2.Disabled = true;
cbISCARRIER.Enabled = false;
cbISCONTROLLER.Enabled = false;
cbISYARD.Enabled = false;
cbISCUSTOM.Enabled = false;
cbISSHIPPER.Enabled = false;
cbISCONSIGNEE.Enabled = false;
cbISBOOKING.Enabled = false;
cbISAIRLINES.Enabled = false;
cbISWAREHOUSE.Enabled = false;
cbISEXPRESS.Enabled = false;
cbISAGENTCN.Enabled = false;
cbISAGENT.Enabled = false;
cbISTRUCK.Enabled = false;
cbISWHARF.Enabled = false;
cbISSHIPPINGAGENT.Enabled = false;
cbISINSURE.Enabled = false;
cbISLEASING.Enabled = false;
tbREMARK.Enabled = false;
cbISTradingAgency.Enabled = false;
cbISENTERP.Enabled = false;
cbISOTHER.Enabled = false;
tbOTHERS.Enabled = false;
tbCHIEF.Enabled = false;
//
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
Label1.Visible = true;
//rblLEVEL.Visible = true;
Label2.Visible = true;
tbLOGINNAME.Visible = true;
Label3.Visible = true;
tbLOGINPASSWORD.Visible = true;
//
//rblLEVEL.Enabled = false;
tbLOGINNAME.Enabled = false;
tbLOGINPASSWORD.Enabled = false;
}
else
{
Label1.Visible = false;
//rblLEVEL.Visible = false;
Label2.Visible = false;
tbLOGINNAME.Visible = false;
Label3.Visible = false;
tbLOGINPASSWORD.Visible = false;
}
}
protected void getEnabledTrue()
{
ibAdd.Enabled = true;
this.ibEnter.Disabled = false;
this.imgDel.Disabled = false;
//ibDel.Enabled = true;
//
this.hdEnabled.Value = "true";
//
cbISSTOP.Enabled = true;
//ddlSALE.Enabled = true;
//ddlOP.Enabled = true;
//ddlDOC.Enabled = true;
tbCODENAME.Enabled = true;
tbSHORTNAME.Enabled = true;
tbDESCRIPTION.Enabled = true;
tbNAME.Enabled = true;
tbEnFullName.Enabled = true;
tbTEL1.Enabled = true;
tbTEL2.Enabled = true;
tbTEL.Enabled = true;
tbFAX1.Enabled = true;
tbFAX2.Enabled = true;
tbFAX.Enabled = true;
tbADDR.Enabled = true;
tbEMAIL.Enabled = true;
tbWEB.Enabled = true;
tbQQ.Enabled = true;
tbMSN.Enabled = true;
tbREGISTRATIONNO.Enabled = true;
tbEDICODE.Enabled = true;
tbORDERNO.Enabled = true;
tbUNITPRICE.Enabled = true;
ddlCustomAttributes1.Disabled = true;
ddlCustomAttributes2.Disabled = true;
cbISCARRIER.Enabled = true;
cbISCONTROLLER.Enabled = true;
cbISYARD.Enabled = true;
cbISCUSTOM.Enabled = true;
cbISSHIPPER.Enabled = true;
cbISCONSIGNEE.Enabled = true;
cbISBOOKING.Enabled = true;
cbISAIRLINES.Enabled = true;
cbISWAREHOUSE.Enabled = true;
cbISEXPRESS.Enabled = true;
cbISAGENTCN.Enabled = true;
cbISAGENT.Enabled = true;
cbISTRUCK.Enabled = true;
cbISWHARF.Enabled = true;
cbISSHIPPINGAGENT.Enabled = true;
cbISINSURE.Enabled = true;
cbISLEASING.Enabled = true;
tbREMARK.Enabled = true;
cbISTradingAgency.Enabled = true;
cbISENTERP.Enabled = true;
cbISOTHER.Enabled = true;
tbOTHERS.Enabled = true;
tbCHIEF.Enabled = true;
//
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
Label1.Visible = true;
//rblLEVEL.Visible = true;
Label2.Visible = true;
tbLOGINNAME.Visible = true;
Label3.Visible = true;
tbLOGINPASSWORD.Visible = true;
//
//rblLEVEL.Enabled = true;
tbLOGINNAME.Enabled = true;
tbLOGINPASSWORD.Enabled = true;
}
else
{
Label1.Visible = false;
//rblLEVEL.Visible = false;
Label2.Visible = false;
tbLOGINNAME.Visible = false;
Label3.Visible = false;
tbLOGINPASSWORD.Visible = false;
}
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "InfoClient" + strBSNO;
return strBSNO;
}
protected bool getAdd()
{
string alt = "";
string strLEVEL = "";
//
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
strLEVEL = "1";//rblLEVEL.SelectedValue.ToString().Trim();
}
string strREMARK = tbREMARK.Text.Trim();
strREMARK = strREMARK.Replace("'", "");
//
alt = T_ALL_DA.GetInfoClientInsert(cbISSTOP.Checked, this.hd_comboSALE.Value, this.hd_comboOP.Value, this.hd_comboDOC.Value, this.hdCODENAME.Value.ToString().Trim(), this.hdSHORTNAME.Value.ToString().Trim(), this.hdDESCRIPTION.Value.ToString().Trim(), tbNAME.Text, tbEnFullName.Text, tbTEL1.Text + "-" + tbTEL2.Text + "-" + tbTEL.Text, tbFAX1.Text + "-" + tbFAX2.Text + "-" + tbFAX.Text, tbADDR.Text, tbEMAIL.Text, tbWEB.Text, ddlCustomAttributes1.Value, ddlCustomAttributes2.Value, cbISCARRIER.Checked, cbISCONTROLLER.Checked, cbISYARD.Checked, cbISCUSTOM.Checked, cbISSHIPPER.Checked, cbISCONSIGNEE.Checked, cbISBOOKING.Checked, cbISAIRLINES.Checked, cbISWAREHOUSE.Checked, cbISEXPRESS.Checked, cbISAGENTCN.Checked, cbISAGENT.Checked, cbISTRUCK.Checked, cbISWHARF.Checked, cbISSHIPPINGAGENT.Checked, cbISINSURE.Checked, cbISLEASING.Checked, strREMARK, this.hdUserID.Value.Trim(), strLEVEL, tbLOGINNAME.Text, tbLOGINPASSWORD.Text, tbQQ.Text,
tbMSN.Text, tbREGISTRATIONNO.Text, tbORDERNO.Text, tbUNITPRICE.Text, cbISTradingAgency.Checked, cbISENTERP.Checked, cbISOTHER.Checked, tbOTHERS.Text, tbCHIEF.Text, tbEDICODE.Text);
if (alt=="")
{
alt = T_ALL_DA.GetStrSQL("Gid", "select Gid from info_client where CODENAME='" + this.hdCODENAME.Value.ToString().Trim() + "'");
ViewState["GID"] = alt;
this.hdGid.Value = alt;
ViewState["strHandleType"] = "edit";
this.hdhandle.Value = "edit";
return true;
}
else
{
return false;
}
}
protected bool getEdit()
{
string alt = "";
string strLEVEL = "";
//
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
strLEVEL = "1";//rblLEVEL.SelectedValue.ToString().Trim();
}
string strREMARK = tbREMARK.Text.Trim();
strREMARK = strREMARK.Replace("'","");
alt = T_ALL_DA.GetInfoClientUpdate(ViewState["GID"].ToString().Trim(), cbISSTOP.Checked, this.hd_comboSALE.Value, this.hd_comboOP.Value, this.hd_comboDOC.Value, this.hdCODENAME.Value.ToString().Trim(), this.hdSHORTNAME.Value.ToString().Trim(), this.hdDESCRIPTION.Value.ToString().Trim(), tbNAME.Text, tbEnFullName.Text, tbTEL1.Text + "-" + tbTEL2.Text + "-" + tbTEL.Text, tbFAX1.Text + "-" + tbFAX2.Text + "-" + tbFAX.Text, tbADDR.Text, tbEMAIL.Text, tbWEB.Text, ddlCustomAttributes1.Value, ddlCustomAttributes2.Value, cbISCARRIER.Checked, cbISCONTROLLER.Checked, cbISYARD.Checked, cbISCUSTOM.Checked, cbISSHIPPER.Checked, cbISCONSIGNEE.Checked, cbISBOOKING.Checked, cbISAIRLINES.Checked, cbISWAREHOUSE.Checked, cbISEXPRESS.Checked, cbISAGENTCN.Checked, cbISAGENT.Checked, cbISTRUCK.Checked, cbISWHARF.Checked, cbISSHIPPINGAGENT.Checked, cbISINSURE.Checked, cbISLEASING.Checked, strREMARK, this.hdUserID.Value.Trim(), this.hdRises.Value.Trim(), strLEVEL, tbLOGINNAME.Text, tbLOGINPASSWORD.Text, tbQQ.Text,
tbMSN.Text, tbREGISTRATIONNO.Text, tbORDERNO.Text, tbUNITPRICE.Text, cbISTradingAgency.Checked, cbISENTERP.Checked, cbISOTHER.Checked, tbOTHERS.Text, tbCHIEF.Text, tbEDICODE.Text);
if (alt == "")
{
return true;
}
else
{
return false;
}
}
protected void btnEnter_Click(object sender, EventArgs e)
{
if (cbISCARRIER.Checked != true && cbISCONTROLLER.Checked != true && cbISYARD.Checked != true && cbISCUSTOM.Checked != true && cbISSHIPPER.Checked != true && cbISCONSIGNEE.Checked != true && cbISBOOKING.Checked != true && cbISAIRLINES.Checked != true && cbISWAREHOUSE.Checked != true && cbISEXPRESS.Checked != true && cbISAGENTCN.Checked != true && cbISAGENT.Checked != true && cbISTRUCK.Checked != true && cbISWHARF.Checked != true && cbISSHIPPINGAGENT.Checked != true && cbISINSURE.Checked != true && cbISLEASING.Checked != true && cbISTradingAgency.Checked != true && cbISENTERP.Checked != true && cbISOTHER.Checked != true)
{
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "alert('往来单位属性为必选项,也可多选!');", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>alert('往来单位属性为必选项,也可多选!');</script>");
return;
}
//
if (tbTEL1.Text.Trim().Equals(""))
{
tbTEL1.Text = "86";
}
//if (tbTEL2.Text.Trim().Equals(""))
//{
// tbTEL2.Text = "0";
//}
//if (tbTEL.Text.Trim().Equals(""))
//{
// tbTEL.Text = "0";
//}
if (tbFAX1.Text.Trim().Equals(""))
{
tbFAX1.Text = "86";
}
//if (tbFAX2.Text.Trim().Equals(""))
//{
// tbFAX2.Text = "0";
//}
//if (tbFAX.Text.Trim().Equals(""))
//{
// tbFAX.Text = "0";
//}
//
bool bl = false;
strHandleType = ViewState["strHandleType"].ToString();
if (strHandleType.Equals("add"))//新增
{
bl = getAdd();
}
else if (strHandleType.Equals("edit"))//录入
{
bl = getEdit();
}
//ibDel.Enabled = true;
this.imgDel.Disabled = false;
ibAdd.Enabled = true;
if (bl)
{
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "reloadParent('" + ViewState["GID"].ToString().Trim() + "');", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "key4", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "');</script>");
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "alert('成功提交!');", true);
//Response.Write("<script>alert('成功提交!');history.back();</script>");
return;
}
else
{
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport31", "alert('出错,请重新填写!');", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "key4", "<script>alert('出错,请重新填写!');</script>");
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return;
}
}
protected void btnAdd_Click(object sender, ImageClickEventArgs e)
{
getEnabledTrue();
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
ViewState["strHandleType"] = "add";
this.hdGid.Value = "";
//ViewState["GID"] = getBSNO();
//this.hdGid.Value = ViewState["GID"].ToString().Trim();
cbISSTOP.Checked = false;
this.hd_comboSALE.Value = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID='" + this.hdUserID.Value.Trim() + "'");
this.hd_comboOP.Value = "";
this.hd_comboDOC.Value = "";
tbCODENAME.Text = "";
this.hdCODENAME.Value = "";
tbSHORTNAME.Text = "";
this.hdSHORTNAME.Value = "";
tbDESCRIPTION.Text = "";
this.hdDESCRIPTION.Value = "";
tbNAME.Text = "";
tbEnFullName.Text = "";
tbTEL1.Text = "86";
tbTEL2.Text = "";
tbTEL.Text = "";
tbFAX1.Text = "86";
tbFAX2.Text = "";
tbFAX.Text = "";
tbADDR.Text = "";
tbEMAIL.Text = "";
tbWEB.Text = "";
tbQQ.Text = "";
tbMSN.Text = "";
tbREGISTRATIONNO.Text = "";
tbEDICODE.Text = "";
tbORDERNO.Text = "";
tbUNITPRICE.Text = "0";
ddlCustomAttributes1.Value = "";
ddlCustomAttributes2.Value = "";
cbISCARRIER.Checked = false;
cbISCONTROLLER.Checked = false;
cbISYARD.Checked = false;
cbISCUSTOM.Checked = false;
cbISSHIPPER.Checked = false;
cbISCONSIGNEE.Checked = false;
cbISBOOKING.Checked = false;
cbISAIRLINES.Checked = false;
cbISWAREHOUSE.Checked = false;
cbISEXPRESS.Checked = false;
cbISAGENTCN.Checked = false;
cbISAGENT.Checked = false;
cbISTRUCK.Checked = false;
cbISWHARF.Checked = false;
cbISSHIPPINGAGENT.Checked = false;
cbISINSURE.Checked = false;
cbISLEASING.Checked = false;
tbREMARK.Text = "";
cbISTradingAgency.Checked = false;
cbISENTERP.Checked = false;
cbISOTHER.Checked = false;
tbOTHERS.Text = "";
tbCHIEF.Text = "";
//
isOpenAnnounce = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["isannounce"].ToString());
if (isOpenAnnounce == 1)
{
rblLEVEL.SelectedValue = "1";//"3";
tbLOGINNAME.Text = "";
tbLOGINPASSWORD.Text = "";
}
//
//ibDel.Enabled = false;
this.imgDel.Disabled = true;
ibAdd.Enabled = true;
this.ibEnter.Disabled = false;
}
protected void btnDel_Click(object sender, EventArgs e)
{
string alt = T_ALL_DA.GetInfoClientDel(" and Gid='" + ViewState["GID"].ToString().Trim() + "' ", this.hdUserID.Value.Trim());
if (alt != "")
{
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport50", "alert('" + alt + "');", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('" + alt + "');</script>");
return;
}
else
{
//window.opener.location.reload();
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport50", "alert('删除成功!');", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "key6", "<script>alert('删除成功!');</script>");
}
//
ViewState["strHandleType"] = "edit";
this.hdhandle.Value = "edit";
DataSet ds = T_ALL_DA.GetAllSQL("select top 1 * from info_client order by CODENAME");
//
if (ds.Tables[0].Rows[0]["ISSTOP"].ToString().Trim() == "True")
{
cbISSTOP.Checked = true;
}
else
{
cbISSTOP.Checked = false;
}
//
this.hd_comboOP.Value = ds.Tables[0].Rows[0]["OP"].ToString().Trim();
this.hd_comboSALE.Value = ds.Tables[0].Rows[0]["SALE"].ToString().Trim();
this.hd_comboDOC.Value = ds.Tables[0].Rows[0]["DOC"].ToString().Trim();
tbCODENAME.Text = ds.Tables[0].Rows[0]["CODENAME"].ToString().Trim();
this.hdCODENAME.Value = ds.Tables[0].Rows[0]["CODENAME"].ToString().Trim();
tbSHORTNAME.Text = ds.Tables[0].Rows[0]["SHORTNAME"].ToString().Trim();
this.hdSHORTNAME.Value = ds.Tables[0].Rows[0]["SHORTNAME"].ToString().Trim();
tbDESCRIPTION.Text = ds.Tables[0].Rows[0]["DESCRIPTION"].ToString().Trim();
this.hdDESCRIPTION.Value = ds.Tables[0].Rows[0]["DESCRIPTION"].ToString().Trim();
tbNAME.Text = ds.Tables[0].Rows[0]["NAME"].ToString().Trim();
tbEnFullName.Text = ds.Tables[0].Rows[0]["EnFullName"].ToString().Trim();
//
int itel = ds.Tables[0].Rows[0]["TEL"].ToString().Trim().IndexOf("-");
if (itel != 0)
{
string[] strTELs = ds.Tables[0].Rows[0]["TEL"].ToString().Trim().Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i < strTELs.Length; i++)
{
if (strTELs[0].Trim() == "" || strTELs[0].Trim() == "0")
{
tbTEL1.Text = "86";
}
else
{
tbTEL1.Text = strTELs[0].Trim();
}
if (strTELs[1].Trim() == "" || strTELs[1].Trim() == "0")
{
tbTEL2.Text = "";
}
else
{
tbTEL2.Text = strTELs[1].Trim();
}
if (strTELs[2].Trim() == "" || strTELs[2].Trim() == "0")
{
tbTEL.Text = "";
}
else
{
tbTEL.Text = strTELs[2].Trim();
}
}
}
else
{
tbTEL1.Text = "86";
tbTEL2.Text = "";
tbTEL.Text = "";
}
//
int iFAX = ds.Tables[0].Rows[0]["FAX"].ToString().Trim().IndexOf("-");
if (iFAX != 0)
{
string[] strFAXs = ds.Tables[0].Rows[0]["FAX"].ToString().Trim().Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i < strFAXs.Length; i++)
{
if (strFAXs[0].Trim() == "" || strFAXs[0].Trim() == "0")
{
tbFAX1.Text = "86";
}
else
{
tbFAX1.Text = strFAXs[0].Trim();
}
if (strFAXs[1].Trim() == "" || strFAXs[1].Trim() == "0")
{
tbFAX2.Text = "";
}
else
{
tbFAX2.Text = strFAXs[1].Trim();
}
if (strFAXs[2].Trim() == "" || strFAXs[2].Trim() == "0")
{
tbFAX.Text = "";
}
else
{
tbFAX.Text = strFAXs[2].Trim();
}
}
}
else
{
tbFAX1.Text = "86";
tbFAX2.Text = "";
tbFAX.Text = "";
}
//
tbADDR.Text = ds.Tables[0].Rows[0]["ADDR"].ToString().Trim();
tbEMAIL.Text = ds.Tables[0].Rows[0]["EMAIL"].ToString().Trim();
tbWEB.Text = ds.Tables[0].Rows[0]["WEB"].ToString().Trim();
tbQQ.Text = ds.Tables[0].Rows[0]["QQ"].ToString().Trim();
tbMSN.Text = ds.Tables[0].Rows[0]["MSN"].ToString().Trim();
tbREGISTRATIONNO.Text = ds.Tables[0].Rows[0]["REGISTRATIONNO"].ToString().Trim();
tbORDERNO.Text = ds.Tables[0].Rows[0]["ORDERNO"].ToString().Trim();
tbUNITPRICE.Text = ds.Tables[0].Rows[0]["UNITPRICE"].ToString().Trim();
ddlCustomAttributes1.Value = ds.Tables[0].Rows[0]["CustomAttributes1"].ToString().Trim();
ddlCustomAttributes2.Value = ds.Tables[0].Rows[0]["CustomAttributes2"].ToString().Trim();
tbEDICODE.Text = ds.Tables[0].Rows[0]["EDICODE"].ToString().Trim();
//
if (ds.Tables[0].Rows[0]["ISCARRIER"].ToString().Trim() == "True")
{
cbISCARRIER.Checked = true;
}
else
{
cbISCARRIER.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISCONTROLLER"].ToString().Trim() == "True")
{
cbISCONTROLLER.Checked = true;
}
else
{
cbISCONTROLLER.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISYARD"].ToString().Trim() == "True")
{
cbISYARD.Checked = true;
}
else
{
cbISYARD.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISCUSTOM"].ToString().Trim() == "True")
{
cbISCUSTOM.Checked = true;
}
else
{
cbISCUSTOM.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISSHIPPER"].ToString().Trim() == "True")
{
cbISSHIPPER.Checked = true;
}
else
{
cbISSHIPPER.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISCONSIGNEE"].ToString().Trim() == "True")
{
cbISCONSIGNEE.Checked = true;
}
else
{
cbISCONSIGNEE.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISBOOKING"].ToString().Trim() == "True")
{
cbISBOOKING.Checked = true;
}
else
{
cbISBOOKING.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISAIRLINES"].ToString().Trim() == "True")
{
cbISAIRLINES.Checked = true;
}
else
{
cbISAIRLINES.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISWAREHOUSE"].ToString().Trim() == "True")
{
cbISWAREHOUSE.Checked = true;
}
else
{
cbISWAREHOUSE.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISEXPRESS"].ToString().Trim() == "True")
{
cbISEXPRESS.Checked = true;
}
else
{
cbISEXPRESS.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISAGENTCN"].ToString().Trim() == "True")
{
cbISAGENTCN.Checked = true;
}
else
{
cbISAGENTCN.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISAGENT"].ToString().Trim() == "True")
{
cbISAGENT.Checked = true;
}
else
{
cbISAGENT.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISTRUCK"].ToString().Trim() == "True")
{
cbISTRUCK.Checked = true;
}
else
{
cbISTRUCK.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISWHARF"].ToString().Trim() == "True")
{
cbISWHARF.Checked = true;
}
else
{
cbISWHARF.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISSHIPPINGAGENT"].ToString().Trim() == "True")
{
cbISSHIPPINGAGENT.Checked = true;
}
else
{
cbISSHIPPINGAGENT.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISINSURE"].ToString().Trim() == "True")
{
cbISINSURE.Checked = true;
}
else
{
cbISINSURE.Checked = false;
}
//
if (ds.Tables[0].Rows[0]["ISLEASING"].ToString().Trim() == "True")
{
cbISLEASING.Checked = true;
}
else
{
cbISLEASING.Checked = false;
}
if (ds.Tables[0].Rows[0]["ISTradingAgency"].ToString().Trim() == "True")
{
cbISTradingAgency.Checked = true;
}
else
{
cbISTradingAgency.Checked = false;
}
if (ds.Tables[0].Rows[0]["ISENTERP"].ToString().Trim() == "True")
{
cbISENTERP.Checked = true;
}
else
{
cbISENTERP.Checked = false;
}
if (ds.Tables[0].Rows[0]["ISOTHER"].ToString().Trim() == "True")
{
cbISOTHER.Checked = true;
}
else
{
cbISOTHER.Checked = false;
}
//
tbOTHERS.Text = ds.Tables[0].Rows[0]["OTHERS"].ToString().Trim();
tbREMARK.Text = ds.Tables[0].Rows[0]["REMARK"].ToString().Trim();
tbCHIEF.Text = ds.Tables[0].Rows[0]["OTHERS"].ToString().Trim();
//
//ibDel.Enabled = false;
this.imgDel.Disabled = true;
ibAdd.Enabled = false;
//权限可视范围
if (ViewState["strHandleType"].ToString().Trim() == "edit")
{
string strV = RangeDA.GetVISIBLERANGE(this.hdUserID.Value.Trim(), "modExchangesUnit");
string strO = RangeDA.GetOPERATERANGE(this.hdUserID.Value.Trim(), "modExchangesUnit");
alt = "";
if (strV.Trim() != strO.Trim())
{
if (strO.Trim().Equals("0"))//全部
{
}
else if (strO.Trim().Equals("1"))//分公司
{
alt = RangeDA.GetUnitCompany(this.hdUserID.Value.Trim(), ds.Tables[0].Rows[0]["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("2"))//部门
{
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetUnitPerson(this.hdUserID.Value, ds.Tables[0].Rows[0]["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
ibAdd.Enabled = true;
}
else if (strO.Trim().Equals("4"))//无
{
getEnabled();
}
}
}
else
{
getEnabledTrue();
}
//
}
public bool IsNumeric(string s)
{
bool bReturn = true;
try
{
int inum = int.Parse(s);
}
catch
{
//int inum = 0;
bReturn = false;
}
return bReturn;
}
}
}