194 lines
12 KiB
C#
194 lines
12 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 System.Text.RegularExpressions;
|
|
using GThinking.N_CONTROL;
|
|
|
|
namespace GThinking.N_XLXSBJ
|
|
{
|
|
public partial class BJFL_KHInfo : SingleCardBase
|
|
{
|
|
BJFL_KH entity = new BJFL_KH();
|
|
|
|
#region 页面初始化
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 100860023;
|
|
this.UMName = "适用客户";
|
|
this.CurMaster = Master;
|
|
this.CurEntity = entity;
|
|
this.Master.EnableAttachBtn = false;
|
|
this.PageWidth = 500;
|
|
this.PageHeight = 400;
|
|
|
|
|
|
base.InitPage();
|
|
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
InitControl();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 模板事件继承
|
|
|
|
protected override void LoadRecord()
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.CurEntity.Param.Add("XLXSBJFLKH_BJFLID", PageParam.GetRTrimString("XLXSBJFLKH_BJFLID"));
|
|
this.CurEntity.Param.Add("XLXSBJFLKH_KHID", PageParam.GetRTrimString("XLXSBJFLKH_KHID"));
|
|
}
|
|
else
|
|
{
|
|
this.CurEntity.Param.Add("XLXSBJFLKH_BJFLID", txtBJDFLID.Value);
|
|
this.CurEntity.Param.Add("XLXSBJFLKH_KHID", txtOLDKHID.Text);
|
|
}
|
|
|
|
base.LoadRecord();
|
|
}
|
|
|
|
protected override void OnNewRecorder()
|
|
{
|
|
|
|
base.OnNewRecorder();
|
|
txtBJDFLID.Value = PageParam.GetRTrimString("FromBJFLID");
|
|
|
|
txtWHR.Text = tSession.UserName;
|
|
datWHSJ.Value = CMISproConvert.ConvertTime(DateTime.Now);
|
|
txtWHRID.Value = tSession.UserId;
|
|
}
|
|
|
|
protected override void OnCopyRecorder()
|
|
{
|
|
base.OnCopyRecorder();
|
|
txtKHMC.Text = "";
|
|
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;
|
|
txtKHMC.Enabled = false;
|
|
}
|
|
|
|
protected override void SetComboxItems()
|
|
{
|
|
base.SetComboxItems();
|
|
}
|
|
|
|
protected override bool DataLogicValid()
|
|
{
|
|
if (txtKHID.Text.Trim().Equals(""))
|
|
{
|
|
ShowMessage("客户--不允许为空!");
|
|
return false;
|
|
}
|
|
if (txtKHMC.Text.Trim().Equals(""))
|
|
{
|
|
ShowMessage("客户不存在!");
|
|
return false;
|
|
}
|
|
//重复检验
|
|
if (!txtOLDKHID.Text.Trim().Equals(txtKHID.Text.Trim()) && !txtOLDKHID.Text.Trim().Equals(""))
|
|
{
|
|
if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSBJFLKH where XLXSBJFLKH_BJFLID='{0}' and XLXSBJFLKH_KHID='{1}'", txtBJDFLID.Value, txtKHID.Text.Trim())))
|
|
{
|
|
ShowMessage("此客户已是该报价单分类适用客户,请重新选择!");
|
|
return false;
|
|
}
|
|
}
|
|
return base.DataLogicValid();
|
|
}
|
|
|
|
protected override bool Master_BeforeSaveAction(object sender, EventArgs e)
|
|
{
|
|
if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy))
|
|
{
|
|
if (!PageParam.GetRTrimString("FromBJFLID").Equals(""))
|
|
txtBJDFLID.Value = PageParam.GetRTrimString("FromBJFLID");
|
|
}
|
|
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)
|
|
{
|
|
txtOLDKHID.Text = txtKHID.Text.Trim();
|
|
return base.Master_AfterSaveAction(sender, e);
|
|
}
|
|
|
|
protected override string CodeClass(string ComponentID)
|
|
{
|
|
string SQL = base.CodeClass(ComponentID);
|
|
if (ComponentID.ToUpper().Equals("TXTKHID"))
|
|
{
|
|
SQL += "!!select KH_KHID as CODE, KH_MC as MESSAGE from KH where 1 = 1 "
|
|
+ " and isnull(KH_TYBZ,'N')<>'Y'order by CODE ";
|
|
}
|
|
return SQL;
|
|
}
|
|
#endregion
|
|
|
|
#region 控件事件
|
|
|
|
protected void txtKHID_OnTextChanged(object sender, EventArgs e)
|
|
{
|
|
txtKHMC.Text = GetKHMC(txtKHID.Text.Trim());
|
|
}
|
|
|
|
private string GetKHMC(string sKHID)
|
|
{
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL sql = new TSQL(dberp);
|
|
sql.Add("select KH_MC from KH where KH_KHID=:pKHID ");
|
|
sql.ParamByName("pKHID").Value = sKHID.Trim();
|
|
DataSet ds = dberp.OpenDataSet(sql);
|
|
string sMC = "";
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
sMC = ds.Tables[0].Rows[0][0].ToString().Trim();
|
|
}
|
|
return sMC;
|
|
}
|
|
#endregion
|
|
|
|
#region 私有函数
|
|
private void InitControl()
|
|
{
|
|
txtBJDFLID.Value = PageParam.GetRTrimString("FromBJFLID");
|
|
}
|
|
#endregion
|
|
}
|
|
}
|