132 lines
4.8 KiB
C#
132 lines
4.8 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Collections;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using GThinking.N_MISPRO;
|
|
using GThinking.N_MISPRO.Data;
|
|
using GThinking.N_MODEL.Page;
|
|
using GThinking.N_PUBLIC;
|
|
using GThinking.N_MISPRO.Utility;
|
|
using GThinking.N_CONTROL;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace GThinking.N_XLXSBJ
|
|
{
|
|
public partial class XLBJD_WBBJDMX_XHZZTHInfo : SingleCardBase
|
|
{
|
|
XLBJD_WBBJDMX_XHZZTH entity = new XLBJD_WBBJDMX_XHZZTH();
|
|
private const string THLX_XHZZTH = "XHZZTH";
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 100860043;
|
|
this.UMName = "外部线缆产品导入";
|
|
this.CurMaster = Master;
|
|
this.CurEntity = entity;
|
|
this.Master.EnableAttachBtn = false;
|
|
this.Master.EnablePrintBtn = false;
|
|
this.PageWidth = 500;
|
|
this.PageHeight = 400;
|
|
base.InitPage();
|
|
}
|
|
|
|
protected override void LoadRecord()
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_XH", PageParam.GetRTrimString("XLXSBJDXTHDZQD_XH"));
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_THLX", PageParam.GetRTrimString("XLXSBJDXTHDZQD_THLX"));
|
|
}
|
|
else
|
|
{
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_XH", txtXH.Value.Trim());
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_THLX", txtTHLX.Value.Trim());
|
|
}
|
|
base.LoadRecord();
|
|
}
|
|
|
|
protected override void OnNewRecorder()
|
|
{
|
|
base.OnNewRecorder();
|
|
txtTHLX.Value = THLX_XHZZTH;
|
|
txtWHR.Text = tSession.UserName;
|
|
datWHSJ.Value = CMISproConvert.ConvertTime(DateTime.Now);
|
|
txtWHRID.Value = tSession.UserId;
|
|
}
|
|
|
|
protected override void OnCopyRecorder()
|
|
{
|
|
base.OnCopyRecorder();
|
|
txtTHLX.Value = THLX_XHZZTH;
|
|
txtWHR.Text = tSession.UserName;
|
|
txtWHRID.Value = tSession.UserId;
|
|
datWHSJ.Value = CMISproConvert.ConvertTime(DateTime.Now);
|
|
}
|
|
|
|
protected override void SetControlState()
|
|
{
|
|
base.SetControlState();
|
|
txtWHR.Enabled = false;
|
|
datWHSJ.Enabled = false;
|
|
}
|
|
|
|
protected override bool DataLogicValid()
|
|
{
|
|
if (txtTHQGGZF.Text.Trim().Equals("")) { ShowMessage("替换前型号不允许为空!"); return false; }
|
|
if (txtTHHGGZF.Text.Trim().Equals("")) { ShowMessage("替换后型号不允许为空!"); return false; }
|
|
|
|
try
|
|
{
|
|
new Regex(txtTHQGGZF.Text.Trim());
|
|
new Regex(txtTHHGGZF.Text.Trim());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ShowMessage("替换前/后型号不是合法的正则表达式! " + ex.Message);
|
|
return false;
|
|
}
|
|
|
|
string sQXH = txtTHQGGZF.Text.Trim().Replace("'", "''");
|
|
if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy))
|
|
{
|
|
string sSQL = string.Format("select 1 from XLXSBJDXTHDZQD where XLXSBJDXTHDZQD_THLX = '{0}' and XLXSBJDXTHDZQD_THQGGZF = '{1}' ", THLX_XHZZTH, sQXH);
|
|
if (CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
|
{
|
|
ShowMessage("已存在相同替换前型号的规则,不允许重复!");
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string sSQL = string.Format("select 1 from XLXSBJDXTHDZQD where XLXSBJDXTHDZQD_THLX = '{0}' and XLXSBJDXTHDZQD_THQGGZF = '{1}' and not (XLXSBJDXTHDZQD_XH = {2} and XLXSBJDXTHDZQD_THLX = '{0}')", THLX_XHZZTH, sQXH, txtXH.Value.Trim());
|
|
if (CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
|
{
|
|
ShowMessage("已存在相同替换前型号的规则,不允许重复!");
|
|
return false;
|
|
}
|
|
}
|
|
return base.DataLogicValid();
|
|
}
|
|
|
|
protected override bool Master_BeforeSaveAction(object sender, EventArgs e)
|
|
{
|
|
if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy))
|
|
{
|
|
int iXH = CMISproDataBase.GetMaxXH("DBERP", "XLXSBJDXTHDZQD", "XLXSBJDXTHDZQD_XH", "XLXSBJDXTHDZQD_THLX ='XHZZTH'") + 1;
|
|
txtXH.Value = iXH.ToString();
|
|
}
|
|
txtTHLX.Value = THLX_XHZZTH;
|
|
txtWHR.Text = tSession.UserName;
|
|
txtWHRID.Value = tSession.UserId;
|
|
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
|
return base.Master_BeforeSaveAction(sender, e);
|
|
}
|
|
}
|
|
}
|