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_MISPRO.Utility; using GThinking.N_PUBLIC; using GThinking.N_MODEL.Dialog; using System.Windows.Forms; using System.IO; namespace GThinking.N_XLXSBJ { public partial class XLBJD_PZGSInfo : SingleCardBase { XLBJD_PZGS entity = new XLBJD_PZGS(); protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860000; this.UMName = "线缆销售报价单"; this.CurMaster = Master; this.CurEntity = entity; this.PageHeight = 400; this.PageWidth = 500; base.InitPage(); } #region 模板事件继承 protected override void SetControlState() { base.SetControlState(); txtPZXH.Enabled = false; txtPZMC.Enabled = false; txtWHR.Enabled = false; datWHSJ.Enabled = false; } protected override void LoadRecord() { if (!IsPostBack) { entity.Param.Add("XLXSBJDDRZ_PZXH", PageParam.GetRTrimString("XLXSBJDDRZ_PZXH")); } else { entity.Param.Add("XLXSBJDDRZ_PZXH", txtPZXH.Value); } base.LoadRecord(); } protected override void OnNewRecorder() { base.OnNewRecorder(); txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now); } protected override void OnCopyRecorder() { base.OnCopyRecorder(); txtPZMC.Text = ""; txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now); } protected override bool DataLogicValid() { if (!base.DataLogicValid()) return false; //if (!txtWJLJ.Text.Trim().Equals("")) //{ // if (!Directory.Exists(txtWJLJ.Text.Trim())) // { // ShowMessage("必须为服务器上的有效路径!可能是对目录的操作权限不够。"); // return false; // } //} return true; } protected override bool Master_BeforeSaveAction(object sender, EventArgs e) { if (!base.Master_BeforeSaveAction(sender, e)) return false; txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now); if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy)) { txtPZXH.Value = CMISproDataBase.GetMaxXH("DBERP", "XLXSBJDDRZ", "XLXSBJDDRZ_PZXH", "") + 1; txtPZMC.Text = "配置格式" + txtPZXH.Value.ToString().Trim(); } return true; } protected override void AfterSave(TDatabase db, ref bool ActionIsDone) { base.AfterSave(db, ref ActionIsDone); if (ControlState == TControlState.ctsCopy) { TSQL sql = new TSQL(db); sql.Add("insert into XLXSBJDDR(XLXSBJDDR_PZXH,XLXSBJDDR_EXCELLM,XLXSBJDDR_BJLM,XLXSBJDDR_BZ,XLXSBJDDR_WHR,XLXSBJDDR_WHRID,XLXSBJDDR_WHSJ)"); sql.Add(" select :pPZXH,XLXSBJDDR_EXCELLM,XLXSBJDDR_BJLM,XLXSBJDDR_BZ,:pWHR,:pWHRID,:pWHSJ "); sql.Add(" from XLXSBJDDR where XLXSBJDDR_PZXH=:pCopyPZXH "); sql.ParamByName("pPZXH").Value = txtPZXH.Value; sql.ParamByName("pWHR").Value = tSession.UserName; sql.ParamByName("pWHRID").Value = tSession.UserId; sql.ParamByName("pWHSJ").Value = DateTime.Now; sql.ParamByName("pCopyPZXH").Value = PageParam.GetRTrimString("XLXSBJDDRZ_PZXH"); db.ExecSQL(sql); } } protected override void AfterDelete(TDatabase db, ref bool ActionIsDone) { base.AfterDelete(db, ref ActionIsDone); db.ExecSQL(string.Format("delete from XLXSBJDDR where XLXSBJDDR_PZXH={0}", txtPZXH.Value)); } #endregion #region 自定义函数 #endregion } }