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 System.Text.RegularExpressions; using GThinking.N_CONTROL; namespace GThinking.N_XLXSBJ { public partial class XLBJD_WBBJDMX_TDGXWHInfo : SingleCardBase { XLBJD_WBBJDMX_TDGXWH entity = new XLBJD_WBBJDMX_TDGXWH(); #region 页面初始化 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(); if (!IsPostBack) { InitControl(); } } #endregion #region 模板事件继承 protected override void LoadRecord() { if (!IsPostBack) { this.CurEntity.Param.Add("XLWBBJDXHGGDZB_WBXLXHID", PageParam.GetRTrimString("XLWBBJDXHGGDZB_WBXLXHID")); this.CurEntity.Param.Add("XLWBBJDXHGGDZB_WBXLGGID", PageParam.GetRTrimString("XLWBBJDXHGGDZB_WBXLGGID")); this.CurEntity.Param.Add("XLWBBJDXHGGDZB_WBDYDJID", PageParam.GetRTrimString("XLWBBJDXHGGDZB_WBDYDJID")); } else { this.CurEntity.Param.Add("XLWBBJDXHGGDZB_WBXLXHID", txtOLDWBXLXHID.Text.Trim()); this.CurEntity.Param.Add("XLWBBJDXHGGDZB_WBXLGGID", txtOLDWBXLGGID.Text.Trim()); this.CurEntity.Param.Add("XLWBBJDXHGGDZB_WBDYDJID", txtOLDWBDYDJID.Text.Trim()); } base.LoadRecord(); } protected override void OnNewRecorder() { base.OnNewRecorder(); txtWHR.Text = tSession.UserName; datWHSJ.Value = CMISproConvert.ConvertTime(DateTime.Now); txtWHRID.Value = tSession.UserId; } protected override void OnCopyRecorder() { base.OnCopyRecorder(); 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 void SetComboxItems() { base.SetComboxItems(); } protected override bool DataLogicValid() { if (txtWBXLXHID.Text.Trim().Equals("")) { ShowMessage("替换前型号不允许为空!"); return false; } if (txtXLXHID.Text.Trim().Equals("")) { ShowMessage("替换后型号不允许为空!"); return false; } //string sSQL = ""; ////此处需要限制不能出现出现同样的替换前型号 //if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy)) //{ // sSQL = string.Format("select 1 from XLWBBJDXHGGDZB where XLWBBJDXHGGDZB_WBXLXHID = '{0}' and XLWBBJDXHGGDZB_WBXLGGID= '{1}' ", // txtWBXLXHID.Text.Trim(), txtWBXLGGID.Text.Trim()); // if (CMISproDataBase.ExistsRecord("DBERP", sSQL)) // { // ShowMessage("替换前型号和规格已经存在,不允许重复替换!"); // return false; // } //} //else //{ // if (!txtOLDWBXLXHID.Text.ToString().Trim().Equals(txtWBXLXHID.Text.ToString().Trim()) // && !txtOLDWBXLXHID.Text.ToString().Trim().Equals(txtWBXLXHID.Text.ToString().Trim())) // { // sSQL = string.Format("select 1 from XLWBBJDXHGGDZB where XLWBBJDXHGGDZB_WBXLXHID = '{0}' and XLWBBJDXHGGDZB_WBXLGGID = '{1}' ", // txtWBXLXHID.Text.Trim(), txtWBXLGGID.Text.Trim()); // if (CMISproDataBase.ExistsRecord("DBERP", sSQL)) // { // ShowMessage("替换前型号和规格已经存在,不允许重复替换!"); // return false; // } // } // else if (!txtOLDWBXLXHID.Text.ToString().Trim().Equals(txtWBXLXHID.Text.ToString().Trim())) // { // sSQL = string.Format("select 1 from XLWBBJDXHGGDZB where XLWBBJDXHGGDZB_WBXLXHID = '{0}' and XLWBBJDXHGGDZB_WBXLGGID = '{1}' ", // txtWBXLXHID.Text.Trim(), txtWBXLGGID.Text.Trim()); // if (CMISproDataBase.ExistsRecord("DBERP", sSQL)) // { // ShowMessage("替换前型号和规格已经存在,不允许重复替换!"); // return false; // } // } // else if (!txtOLDWBXLGGID.Text.ToString().Trim().Equals(txtWBXLGGID.Text.ToString().Trim())) // { // sSQL = string.Format("select 1 from XLWBBJDXHGGDZB where XLWBBJDXHGGDZB_WBXLXHID = '{0}' and XLWBBJDXHGGDZB_WBXLGGID = '{1}' ", // txtWBXLXHID.Text.Trim(), txtWBXLGGID.Text.Trim()); // if (CMISproDataBase.ExistsRecord("DBERP", sSQL)) // { // ShowMessage("替换前型号和规格已经存在,不允许重复替换!"); // return false; // } // } //} return base.DataLogicValid(); } protected override bool Master_BeforeSaveAction(object sender, EventArgs e) { txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; if (txtWBXLGGID.Text.Trim().Equals("")) txtWBXLGGID.Text = " "; if (txtWBDYDJID.Text.Trim().Equals("")) txtWBDYDJID.Text = " "; datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now); return base.Master_BeforeSaveAction(sender, e); } protected override void BeforeSave(TDatabase db, ref bool ActionIsDone) { base.BeforeSave(db, ref ActionIsDone); } protected override void AfterSave(TDatabase db, ref bool ActionIsDone) { base.BeforeSave(db, ref ActionIsDone); } protected override bool Master_AfterSaveAction(object sender, EventArgs e) { txtOLDWBXLXHID.Text = txtWBXLXHID.Text.Trim(); txtOLDWBXLGGID.Text = txtWBXLGGID.Text.Trim(); txtOLDWBDYDJID.Text = txtWBDYDJID.Text.Trim(); return base.Master_AfterSaveAction(sender, e); } #endregion #region 控件事件 protected void txtWBXLGGID_OnTextChanged(object sender, EventArgs e) { txtXLGGID.Text = txtWBXLGGID.Text.Trim(); } protected void txtWBDYDJID_OnTextChanged(object sender, EventArgs e) { txtDYDJID.Text = txtWBDYDJID.Text.Trim(); } #endregion #region 私有函数 private void InitControl() { } #endregion } }