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 SeaExportInfoBusinessTruck : System.Web.UI.Page { public string sSQL = String.Empty; public string gvid = String.Empty; T_ALL_DA T_ALL_DA = new T_ALL_DA(); MoneyConvert MoneyConvert = new MoneyConvert(); TopSeaeEntity TopSeaeEntity = new TopSeaeEntity(); SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA(); TopSeaeBillmanageEntity TopSeaeBillmanageEntity = new TopSeaeBillmanageEntity(); TopSeaeBillmanageDA TopSeaeBillmanageDA = new TopSeaeBillmanageDA(); RangeDA RangeDA = new RangeDA(); public string strUserID;//用户GID 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 (!IsPostBack) { if (Request.QueryString["handle"] != null) { Session["handle"] = Request.QueryString["handle"].ToString(); } if (Request.QueryString["leid"] != null) { Session["leid"] = Request.QueryString["leid"].ToString(); this.hdGid.Value = Request.QueryString["leid"].ToString(); } if (Request.QueryString["id"] != null) { ViewState["GID"] = Request.QueryString["id"].ToString(); this.hdBSNO.Value = Request.QueryString["id"].ToString(); } // if (Session["handle"].ToString().Trim() == "edit") { if (Session["leid"].ToString().Trim() != "") { DataSet ds = T_ALL_DA.GetTopLetter(Session["leid"].ToString().Trim()); if (ds != null) { //TO tbTO.Text = ds.Tables[0].Rows[0]["HEAD_TO"].ToString().Trim(); //ATTN tbATTN.Text = ds.Tables[0].Rows[0]["HEAD_ATTN"].ToString().Trim(); tbATTNFAX.Text = ds.Tables[0].Rows[0]["HEAD_ATTNFAX"].ToString().Trim(); //FM tbFM.Text = ds.Tables[0].Rows[0]["INPUTBY"].ToString().Trim(); // ds = T_ALL_DA.GetTopLetterTruck(Request.QueryString["leid"].ToString().Trim()); if (ds != null) { this.hd_comboTRUCK.Value = ds.Tables[0].Rows[0]["TRUCK"].ToString().Trim(); tbCTNS.Text = ds.Tables[0].Rows[0]["CTNS"].ToString().Trim(); this.hd_comboYARD.Value = ds.Tables[0].Rows[0]["YARD"].ToString().Trim(); tbYARDATTN.Text = ds.Tables[0].Rows[0]["YARDATTN"].ToString().Trim(); tbYARDTEL.Text = ds.Tables[0].Rows[0]["YARDTEL"].ToString().Trim(); tbFACTRYATTN.Text = ds.Tables[0].Rows[0]["FACTRYATTN"].ToString().Trim(); tbFACTRYTEL.Text = ds.Tables[0].Rows[0]["FACTRYTEL"].ToString().Trim(); tbFACTRYADDR.Text = ds.Tables[0].Rows[0]["FACTRYADDR"].ToString().Trim(); tbFACTRYTIME.Text = ds.Tables[0].Rows[0]["FACTRYTIME"].ToString().Trim(); this.hd_comboRETURNYARD.Value = ds.Tables[0].Rows[0]["RETURNYARD"].ToString().Trim(); tbRETURNATTN.Text = ds.Tables[0].Rows[0]["RETURNATTN"].ToString().Trim(); tbRETURNTEL.Text = ds.Tables[0].Rows[0]["RETURNTEL"].ToString().Trim(); tbTRUCKFEE.Text = ds.Tables[0].Rows[0]["TRUCKFEE"].ToString().Trim(); tbPAYTYPE.Text = ds.Tables[0].Rows[0]["PAYTYPE"].ToString().Trim(); tbREMARK.Text = ds.Tables[0].Rows[0]["REMARK"].ToString().Trim(); //截港日期 if (ds.Tables[0].Rows[0]["CLOSINGDATE"].ToString().Trim() == "") { tbCLOSINGDATE.Text = ""; } else { tbCLOSINGDATE.Text = DateTime.Parse(ds.Tables[0].Rows[0]["CLOSINGDATE"].ToString().Trim()).ToString("yyyy-MM-dd hh:mm").Trim(); } } } } //权限可视范围 string strV = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modOrderManagement"); string strO = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modOrderManagement"); //页面是否只读 if (Request.QueryString["hdenabled"] != null) { if (Request.QueryString["hdenabled"].ToString() == "false") { strO = "4"; this.hdEnabled.Value = "false"; } } // string alt = ""; if (strV.Trim() != strO.Trim()) { if (strO.Trim().Equals("0"))//全部 { } else if (strO.Trim().Equals("1"))//分公司 { alt = RangeDA.GetOrderManagementCompany(strUserID.Trim(), ViewState["GID"].ToString().Trim()); if (alt == "") { getEnabled(); } } else if (strO.Trim().Equals("2"))//部门 { alt = RangeDA.GetOrderManagementDEPT(strUserID.Trim(), ViewState["GID"].ToString().Trim()); if (alt == "") { getEnabled(); } } else if (strO.Trim().Equals("3"))//个人 { alt = RangeDA.GetOrderManagementPerson(strUserID.Trim(), ViewState["GID"].ToString().Trim()); if (alt == "") { getEnabled(); } } else if (strO.Trim().Equals("4"))//无 { getEnabled(); } } // } else { tbFM.Text = T_ALL_DA.GetSHOWNAME(strUserID.Trim()); if (ViewState["GID"].ToString().Trim() != "") { TopSeaeEntity = SeaExportInfoDA.GetID(ViewState["GID"].ToString().Trim()); if (TopSeaeEntity.BSNO != null) { //截港日期==截港日期 if (TopSeaeEntity.CLOSINGDATE.ToString().Trim().IndexOf("0001")>-1) { tbCLOSINGDATE.Text = ""; } else { tbCLOSINGDATE.Text = DateTime.Parse(TopSeaeEntity.CLOSINGDATE.ToString().Trim()).ToString("yyyy-MM-dd hh:mm").Trim(); } } } this.imgPrint.Disabled = true; } } // if (this.hdEnter.Value == "1") { getEnter(); } //加载下拉框 Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", ""); } protected void getEnabled() { this.imgEnter.Disabled = true; this.imgPrint.Disabled = true; // //tbTO.Enabled=false; tbATTN.Enabled=false; tbATTNFAX.Enabled = false; tbFM.Enabled=false; //ddlTRUCK.Enabled=false; tbCTNS.Enabled=false; tbTRUCKFEE.Enabled=false; tbPAYTYPE.Enabled=false; //ddlYARD.Enabled=false; tbYARDATTN.Enabled=false; tbYARDTEL.Enabled=false; tbFACTRYADDR.Enabled=false; tbFACTRYTIME.Enabled = false; tbFACTRYATTN.Enabled=false; tbFACTRYTEL.Enabled=false; //ddlRETURNYARD.Enabled=false; tbRETURNATTN.Enabled=false; tbRETURNTEL.Enabled=false; tbCLOSINGDATE.Enabled=false; tbREMARK.Enabled = false; } protected void getEnter() { if (Session["handle"].ToString().Trim() != null && Session["handle"].ToString().Trim() == "edit") { if (Session["leid"].ToString().Trim() != null && Session["leid"].ToString().Trim() != "") { string alt = T_ALL_DA.GetTopLetterTruckUpdate(Session["leid"].ToString().Trim(), this.hd_comboTRUCK.Value.Trim(), tbATTN.Text.Trim(), tbATTNFAX.Text.Trim(), tbFM.Text.Trim(), this.hd_comboTRUCK.Value.Trim(), tbCTNS.Text.Trim(), this.hd_comboYARD.Value.Trim(), tbYARDATTN.Text.Trim(), tbYARDTEL.Text.Trim(), tbFACTRYATTN.Text.Trim(), tbFACTRYTEL.Text.Trim(), tbFACTRYADDR.Text.Trim(), tbFACTRYTIME.Text.Trim(), this.hd_comboRETURNYARD.Value.Trim(), tbRETURNATTN.Text.Trim(), tbRETURNTEL.Text.Trim(), tbTRUCKFEE.Text.Trim(), tbPAYTYPE.Text.Trim(), tbREMARK.Text.Trim(), tbCLOSINGDATE.Text.Trim(), strUserID.Trim()); if (alt == "") { if (this.hdISCLOSINGDATE.Value.Trim() == "1") { bool bl = T_ALL_DA.GetExecuteSqlCommand("update op_seae set CLOSINGDATE='" + tbCLOSINGDATE.Text.Trim() + "' where bsno='" + ViewState["GID"].ToString().Trim() + "'"); } Response.Write(""); return; } else { Response.Write(""); return; } } } else { Session["leid"] = T_ALL_DA.getSQLID("TopLetterTruck"); string alt = T_ALL_DA.GetTopLetterTruckInsert(Session["leid"].ToString().Trim(), ViewState["GID"].ToString().Trim(), this.hd_comboTRUCK.Value.Trim(), tbATTN.Text.Trim(), tbATTNFAX.Text.Trim(), tbFM.Text.Trim(), this.hd_comboTRUCK.Value.Trim(), tbCTNS.Text.Trim(), this.hd_comboYARD.Value.Trim(), tbYARDATTN.Text.Trim(), tbYARDTEL.Text.Trim(), tbFACTRYATTN.Text.Trim(), tbFACTRYTEL.Text.Trim(), tbFACTRYADDR.Text.Trim(), tbFACTRYTIME.Text.Trim(), this.hd_comboRETURNYARD.Value.Trim(), tbRETURNATTN.Text.Trim(), tbRETURNTEL.Text.Trim(), tbTRUCKFEE.Text.Trim(), tbPAYTYPE.Text.Trim(), tbREMARK.Text.Trim(), tbCLOSINGDATE.Text.Trim(), strUserID.Trim()); if (alt == "") { if (this.hdISCLOSINGDATE.Value.Trim() == "1") { bool bl = T_ALL_DA.GetExecuteSqlCommand("update op_seae set CLOSINGDATE='" + tbCLOSINGDATE.Text.Trim() + "' where bsno='" + ViewState["GID"].ToString().Trim() + "'"); } this.imgPrint.Disabled = false; Session["handle"] = "edit"; Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", ""); //Response.Write(""); return; } else { Response.Write(""); return; } } } } }