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.
DS7/DSWeb/SeaiInfo/SeaImportInfoBusinessTruck....

248 lines
12 KiB
C#

3 years 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.SeaiInfo
{
public partial class SeaImportInfoBusinessTruck : 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();
TopSeaiEntity TopSeaiEntity = new TopSeaiEntity();
SeaImportInfoDA SeaImportInfoDA = new SeaImportInfoDA();
TopSeaeBillmanageEntity TopSeaeBillmanageEntity = new TopSeaeBillmanageEntity();
TopSeaeBillmanageDA TopSeaeBillmanageDA = new TopSeaeBillmanageDA();
RangeDA RangeDA = new RangeDA();
public string strUserID;//登录用户GID
public string strCompanyID;//公司GID
public string strShowName;//用户显示名
public string strDeptName;//部门名称
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 (!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();
}
}
}
//权限可视范围
string strV = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modSeaImportList");
string strO = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modSeaImportList");
//页面是否只读
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.GetSeaImportListCompany(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("2"))//部门
{
alt = RangeDA.GetSeaImportListDEPT(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetSeaImportListPerson(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("4"))//无
{
getEnabled();
}
}
//
}
else
{
tbFM.Text = strShowName.Trim();
this.imgPrint.Disabled = true;
}
}
//
if (this.hdEnter.Value == "1")
{
getEnter();
}
//加载下拉框
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboTRUCK();initComboYARD();initcomboRETURNYARD();</script>");
}
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;
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(), "0001-01-01 00:00:00", 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("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(), "0001-01-01 00:00:00", strUserID.Trim());
if (alt == "")
{
this.imgPrint.Disabled = false;
Session["handle"] = "edit";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<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;
}
}
}
}
}