📄 orderticketadd1.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Botheighten.Yanghui.BusinessFacade;
using Botheighten.Yanghui.Framework;
using Botheighten.Yanghui.BusinessRules;
namespace Botheighten.Yanghui.Web
{
/// <summary>
/// OrderTicketAdd1 的摘要说明。
/// </summary>
public class OrderTicketAdd1 : BasePage
{
protected System.Web.UI.WebControls.Label lblTitle;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label lblCode;
protected System.Web.UI.WebControls.RequiredFieldValidator reqId;
protected System.Web.UI.WebControls.ValidationSummary ErrorSummary;
protected System.Web.UI.WebControls.Label Label9;
protected System.Web.UI.WebControls.RequiredFieldValidator ReqPWD;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label lblInsertOperater;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Label lblInsertDate;
protected System.Web.UI.WebControls.Button btnGoBack;
protected System.Web.UI.HtmlControls.HtmlTable tableMod;
protected System.Web.UI.WebControls.Button btnAdd;
protected System.Web.UI.WebControls.TextBox txtCode;
protected System.Web.UI.WebControls.DropDownList ddlCustom;
protected System.Web.UI.WebControls.TextBox txtRemark;
protected System.Web.UI.WebControls.Label lblMessage;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
Principal p=this.CurrentUser();
this.CheckPermissionPage(p.Id,"","201");
this.lblMessage.Visible=false;
this.GoBackFunction(this.btnGoBack);
if(!Page.IsPostBack)
{
DataTable dt=CustomSystem.AllCustom("Y");
Common.BindDrop(this.ddlCustom,dt,Custom.CODE,Custom.ID);
this.lblInsertDate.Text=System.DateTime.Now.ToString();
this.lblInsertOperater.Text=this.CurrentUser().Id;
}
CheckDemo();
}
private void CheckDemo()
{
if(Application["Demo"]!=null && Application["Demo"].ToString()=="Y")
{
int counts=OrderTicketSystem.GetOrderHeads();
if(counts>=10)
{
this.btnAdd.Enabled=false;
this.lblMessage.Text="提示:此试用版只允许定义十条定单";
this.lblMessage.Visible=true;
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnAdd_Click(object sender, System.EventArgs e)
{
if(!Common.CheckMultTextBox(this.txtRemark,this.lblMessage,"失败:备注只允许500个字符之内",500)) return;
string orderCode=this.txtCode.Text.Trim();
if(!OrderTicketSystem.CheckOrderTicketIsUnique(orderCode))
{
this.lblMessage.Text="失败:定单号已经存在,请确保唯一";
this.lblMessage.Visible=true;
return;
}
OrderHead oh=new OrderHead();
oh.Id=LoginSystem.GetTableId("OrderHead").ToString();
oh.Code=this.txtCode.Text.Trim();
if(this.ddlCustom.Items.Count>0)
oh.CustomId=this.ddlCustom.SelectedItem.Value;
else
oh.CustomId="";
oh.Remark=this.txtRemark.Text.Trim();
oh.Flag="N";
oh.InsertDate=System.DateTime.Now;
oh.InsertOperater=this.lblInsertOperater.Text.Trim();
try
{
oh.Save();
}
catch (LeaseException le)
{
if (le.ErrorType == LeaseExceptionType.PrimaryConflictException)
{
this.lblMessage.Text = "失败:新增记录时,主关键字冲突";
this.lblMessage.Visible = true;
}
else
{
throw le;
}
}
this.lblMessage.Text ="成功:新增记录成功";
this.lblMessage.Visible=true;
Response.Redirect("OrderTicketAdd2.aspx?OHID=" +oh.Id);
Response.End();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -