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.

116 lines
4.3 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;
namespace DSWeb.ParameterSet
{
public partial class TSysTemplateSet : System.Web.UI.Page
{
public string sSQL = String.Empty;
TopSeaeBillmanageEntity TopSeaeBillmanageEntity = new TopSeaeBillmanageEntity();
TopSeaeBillmanageDA TopSeaeBillmanageDA = new TopSeaeBillmanageDA();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
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)
{
DataSet ds = T_ALL_DA.GetTCodeTemplate();
foreach(DataTable myTable in ds.Tables)
{
foreach(DataRow myRow in myTable.Rows)//遍历表
{
ListBox1.Items.Add(new ListItem(myRow["TEMPLATE"].ToString().Trim(), myRow["TEMPLATEID"].ToString().Trim()));
}
}
//
ds = T_ALL_DA.GetTableField("op_seae");
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
string str = myRow["Explain"].ToString().Trim();
int s = str.IndexOf(" ");
if (s != -1)
{
str = str.Substring(0,s);
}
str = myRow["Field"].ToString().Trim() + " | " + str;
ListBox2.Items.Add(new ListItem(str, myRow["Field"].ToString().Trim()));
}
}
}
}
protected void btnEnter_Click(object sender, ImageClickEventArgs e)
{
if (ListBox1.SelectedValue.ToString().Trim().Equals(""))
{
Response.Write("<script>alert('请先选择要设置的提单模板!');</script>");
return;
}
else
{
string alt = "";
DataSet ds = T_ALL_DA.GetTSysTemplateSet(ListBox1.SelectedValue.ToString().Trim());
if (ds == null)
{
alt = T_ALL_DA.GetTSysTemplateSetInsert(ListBox1.SelectedValue.ToString().Trim(), TextBox3.Text.Trim(), TextBox4.Text.Trim(), TextBox1.Text.Trim(), TextBox2.Text.Trim(), strUserID.Trim());
}
else
{
alt = T_ALL_DA.GetTSysTemplateSetUpdate(ListBox1.SelectedValue.ToString().Trim(), TextBox3.Text.Trim(), TextBox4.Text.Trim(), TextBox1.Text.Trim(), TextBox2.Text.Trim(), strUserID.Trim());
}
if (alt != "")
{
Response.Write("<script>alert('出错,请重新操作!');history.back();</script>");
return;
}
else
{
Response.Write("<script>alert('成功提交!');</script>");
return;
}
}
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
DataSet ds = T_ALL_DA.GetTSysTemplateSet(ListBox1.SelectedValue.ToString().Trim());
if (ds != null)
{
TextBox1.Text = ds.Tables[0].Rows[0]["KGS_DIGITAL"].ToString().Trim();
TextBox2.Text = ds.Tables[0].Rows[0]["CBM_DIGITAL"].ToString().Trim();
TextBox3.Text = ds.Tables[0].Rows[0]["MARKS_SET"].ToString().Trim();
TextBox4.Text = ds.Tables[0].Rows[0]["DESCRIPTION_SETS"].ToString().Trim();
}
}
}
}