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.
D7QUANTAI/DSWeb/Shipping/SeaExportInfoBusinessSur.as...

232 lines
10 KiB
C#

10 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 SeaExportInfoBusinessSur : 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().Trim();
}
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();
}
//
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();
//FM
tbFM.Text = ds.Tables[0].Rows[0]["INPUTBY"].ToString().Trim();
//
ds = T_ALL_DA.GetTopLetterSur(Request.QueryString["leid"].ToString().Trim());
if (ds != null)
{
//主提单号
tbMBLNO.Text = ds.Tables[0].Rows[0]["MBLNO"].ToString().Trim();
//装货港
tbPORTLOAD.Text = ds.Tables[0].Rows[0]["PORTLOAD"].ToString().Trim();
//卸货港
tbPORTDISCHARGE.Text = ds.Tables[0].Rows[0]["PORTDISCHARGE"].ToString().Trim();
//船名/航次
tbVESSELVOYNO.Text = ds.Tables[0].Rows[0]["VESSELVOYNO"].ToString().Trim();
//
tbCONSIGNEE.Text = ds.Tables[0].Rows[0]["CONSIGNEE"].ToString().Trim();
//备注
tbREMARK.Text = ds.Tables[0].Rows[0]["REMARK"].ToString().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";
}
}
//
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
{
if (ViewState["GID"].ToString().Trim() != "")
{
TopSeaeEntity = SeaExportInfoDA.GetID(ViewState["GID"].ToString().Trim());
if (TopSeaeEntity.BSNO != null)
{
tbFM.Text = T_ALL_DA.GetSHOWNAME(strUserID.Trim());
//主提单号
tbMBLNO.Text = TopSeaeEntity.MBLNO.ToString().Trim();
//装货港
tbPORTLOAD.Text = TopSeaeEntity.PORTLOAD.ToString().Trim();
//卸货港
tbPORTDISCHARGE.Text = TopSeaeEntity.PORTDISCHARGE.ToString().Trim();
//船名/航次
tbVESSELVOYNO.Text = TopSeaeEntity.VESSEL.ToString().Trim() + " " + TopSeaeEntity.VOYNO.ToString().Trim();
//收货人
tbCONSIGNEE.Text = TopSeaeEntity.CONSIGNEE.ToString().Trim();
//备注
tbREMARK.Text = TopSeaeEntity.REMARK.ToString().Trim();
}
}
else
{
}
this.imgPrint.Disabled = true;
}
}
}
protected void getEnabled()
{
this.ibEnter.Enabled = false;
this.imgPrint.Disabled = true;
//
tbTO.Enabled=false;
tbATTN.Enabled=false;
tbFM.Enabled=false;
tbVESSELVOYNO.Enabled=false;
tbMBLNO.Enabled=false;
tbPORTLOAD.Enabled=false;
tbPORTDISCHARGE.Enabled=false;
tbCONSIGNEE.Enabled=false;
tbREMARK.Enabled = false;
}
protected void btnEnter_Click(object sender, ImageClickEventArgs e)
{
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.GetTopLetterSurUpdate(Session["leid"].ToString().Trim(), tbTO.Text.Trim(), tbATTN.Text.Trim(), tbFM.Text.Trim(), tbMBLNO.Text.Trim(), tbPORTLOAD.Text.Trim(), tbPORTDISCHARGE.Text.Trim(), tbVESSELVOYNO.Text.Trim(), tbCONSIGNEE.Text.Trim(), tbREMARK.Text.Trim(), strUserID.Trim());
if (alt == "")
{
Response.Write("<script>alert('更改成功!');window.opener.location.reload();history.back();</script>");
return;
}
else
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
else
{
Session["leid"] = T_ALL_DA.getSQLID("TopLetterSur");
string alt = T_ALL_DA.GetTopLetterSurInsert(Session["leid"].ToString().Trim(), ViewState["GID"].ToString().Trim(), tbTO.Text.Trim(), tbATTN.Text.Trim(), tbFM.Text.Trim(), tbMBLNO.Text.Trim(), tbPORTLOAD.Text.Trim(), tbPORTDISCHARGE.Text.Trim(), tbVESSELVOYNO.Text.Trim(), tbCONSIGNEE.Text.Trim(), tbREMARK.Text.Trim(), strUserID.Trim());
if (alt == "")
{
this.imgPrint.Disabled = true;
Session["handle"] = "edit";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + Session["leid"].ToString().Trim() + "');</script>");
//Response.Write("<script>alert('添加成功!');window.opener.location.reload();history.back();</script>");
return;
}
else
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
}
}