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.
175 lines
7.2 KiB
C#
175 lines
7.2 KiB
C#
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;
|
|
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Web.SessionState;
|
|
using System.Web.Mail;
|
|
using System.IO;
|
|
using System.Data.OleDb;
|
|
|
|
using JsonHelper;
|
|
using DSWeb.Log;
|
|
using DSWeb.Attributes;
|
|
using WebSqlHelper;
|
|
|
|
namespace DSWeb.box
|
|
{
|
|
public partial class BoxBusinessInfo : System.Web.UI.Page
|
|
{
|
|
protected string cmd, id;
|
|
private string username;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
cmd = Request["handle"];
|
|
id = Request["id"];
|
|
if (Session["SHOWNAME"] != null)
|
|
{
|
|
username = Session["SHOWNAME"].ToString();
|
|
}
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
HttpHelper.BindDropDownList(Vessel, BaseClass.db.GetSqlStrTable("select * from code_vessel"), "VESSEL", "VESSEL", 1);
|
|
//Response.Write(Session["SHOWNAME"]);
|
|
if (cmd == "edit")
|
|
{
|
|
CreateData();
|
|
}
|
|
}
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboPort();</script>");
|
|
|
|
}
|
|
void CreateData()
|
|
{
|
|
DataRow dr = BaseClass.db.GetSqlStrRow("select * from container_Business where b_id=" + id);
|
|
if (dr != null)
|
|
{
|
|
BaseClass.InitValue(BLNO, dr);
|
|
//ddlPORT.Items.FindByValue(dr["position"].ToString()).Selected=true;
|
|
hd_comboPORT.Value = getPortName(dr["position"].ToString());
|
|
hd_comboPORT0.Value = getPortName(dr["fobport"].ToString());
|
|
hd_port1.Value = dr["position"].ToString();
|
|
hd_port2.Value = dr["fobport"].ToString();
|
|
//try{
|
|
// hd_comboPORT.Value = BaseClass.db.GetSpScalar("select cname from code_disport where portid= '" + dr["position"].ToString() + "'").ToString();
|
|
//}
|
|
// catch{}
|
|
//Buytime.Text = DateHelper.dateFormat(dr["buytime"].ToString(), "yyyy-MM-dd");
|
|
//Rent_begintime.Text = DateHelper.dateFormat(dr["Rent_begintime"].ToString(), "yyyy-MM-dd");
|
|
//Rent_endtime.Text = DateHelper.dateFormat(dr["Rent_endtime"].ToString(), "yyyy-MM-dd");
|
|
}
|
|
}
|
|
protected void ibsave_Click(object sender, ImageClickEventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(BLNO.Text.Trim()))
|
|
{
|
|
Alert("请输入提单号");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(Box_No.Text.Trim()))
|
|
{
|
|
Alert("请输入箱号");
|
|
return;
|
|
}
|
|
if (!WebSqlHelper.Common.isCntrNO(Box_No.Text.Trim()))
|
|
{
|
|
Alert("箱号不合法,请重新输入");
|
|
return;
|
|
}
|
|
string posiid = Request["ddlPORT"].ToString();
|
|
string posiid0 = Request["ddlPORT0"].ToString();
|
|
|
|
string s1 = "", s2 = "", s3 = "";
|
|
DataTable dtstruct = BaseClass.db.GetSqlStrTable("select * from container_Business where 1>2");
|
|
List<System.Data.Common.DbParameter> param = new List<System.Data.Common.DbParameter>();
|
|
BaseClass.CreateSql(BLNO, dtstruct, ref s1, ref s2, ref s3, ref param);
|
|
|
|
string insert = "insert into container_Business (" + s1.TrimEnd(',') + ",OperMan,OperTime,position,fobport) values (" + s2.TrimEnd(',') + ",@OperMan,@OperTime,@position,@fobport)";
|
|
string edit = "update container_Business set " + s3.TrimEnd(',') + ",position=@position,fobport=@fobport where b_id=@id";
|
|
if (cmd == "edit")
|
|
{
|
|
if (BaseClass.db.GetSqlStrTable("select * from container_Business where BLNO='" + BLNO.Text.Trim() + "' and b_id!=" + id).Rows.Count > 0)
|
|
{
|
|
Alert("此提单业务已经录入");
|
|
return;
|
|
}
|
|
param.Add(BaseClass.db.GetParameter("id", id));
|
|
param.Add(BaseClass.db.GetParameter("position", posiid));
|
|
param.Add(BaseClass.db.GetParameter("fobport", posiid0));
|
|
BaseClass.db.SetSqlStrNonQuery(edit, param.ToArray());
|
|
}
|
|
else if (cmd == "add")
|
|
{
|
|
//if (BaseClass.db.GetSqlStrTable("select * from container_Business where BLNO='" + BLNO.Text.Trim() + "'").Rows.Count > 0)
|
|
//{
|
|
// Alert("此提单业务已经录入");
|
|
// return;
|
|
//}
|
|
param.Add(BaseClass.db.GetParameter("OperMan", username));
|
|
param.Add(BaseClass.db.GetParameter("OperTime", DateTime.Now.ToString()));
|
|
param.Add(BaseClass.db.GetParameter("position", posiid));
|
|
param.Add(BaseClass.db.GetParameter("fobport", posiid0));
|
|
BaseClass.db.SetSqlStrNonQuery(insert, param.ToArray());
|
|
}
|
|
BaseClass.db.SetSqlStrNonQuery("update container_info set status=2,Position='" + posiid + "',positionname='" + hd_comboPORT.Value + "' where CntrNo='" + Box_No.Text + "'");
|
|
Alert2("已保存成功");
|
|
|
|
}
|
|
|
|
protected void ibAdd_Click(object sender, ImageClickEventArgs e)
|
|
{
|
|
Response.Redirect("BoxBusinessInfo.aspx?handle=add");
|
|
}
|
|
|
|
public string getPortName(string portid)
|
|
{
|
|
string str = "";
|
|
try {
|
|
DataRow dr = BaseClass.db.GetSqlStrRow("select * from code_disport where portid='"+portid+"'");
|
|
if (dr != null)
|
|
{
|
|
str = dr["PORT"].ToString().Trim() ;
|
|
//str = dr["PORT"].ToString().Trim() + "-" + dr["cname"].ToString().Trim();
|
|
}
|
|
}
|
|
catch { }
|
|
return str;
|
|
}
|
|
// Methods
|
|
public void Alert(string msg)
|
|
{
|
|
ScriptManager.RegisterClientScriptBlock(this, base.GetType(), WebSqlHelper.Common.RndNum(8), "alert('" + msg + "');", true);
|
|
}
|
|
public void Alert2(string msg)
|
|
{
|
|
ScriptManager.RegisterClientScriptBlock(this, base.GetType(), WebSqlHelper.Common.RndNum(8), "alert('" + msg + "');window.parent.opener.location.href = window.parent.opener.location.href;", true);
|
|
}
|
|
|
|
public void Run(string script)
|
|
{
|
|
ScriptManager.RegisterClientScriptBlock(this, base.GetType(), WebSqlHelper.Common.RndNum(8), script, true);
|
|
}
|
|
public void ShowMessageAndRedirect(string Message, string Redirect)
|
|
{
|
|
ScriptManager.RegisterClientScriptBlock(this, base.GetType(), WebSqlHelper.Common.RndNum(8), "alert('" + Message + "');" + (string.IsNullOrEmpty(Redirect) ? "" : "location='" + Redirect + "';"), true);
|
|
}
|
|
}
|
|
}
|