using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL.Inquiry;
|
using CY.Infrastructure.Common;
|
using CY.Model;
|
|
namespace CY.WebForm.Pages.business
|
{
|
public partial class StrangeCustomerInfo : BasePage
|
{
|
#region 变量
|
StrangeCustomerInfoBLL _strangeCustomerInfoBLL = new StrangeCustomerInfoBLL();
|
#endregion
|
|
#region 属性
|
|
public int RecordId
|
{
|
get
|
{
|
return Request["RecordId"].ToString().ToInt32().Value;
|
}
|
}
|
|
#endregion
|
|
#region 方法
|
/// <summary>
|
/// 初始化绑定页面
|
/// </summary>
|
private void BindPage()
|
{
|
if (Request["KeyId"] != null)
|
{
|
string keyIdStr=Request["KeyId"].ToString();
|
Guid keyIdGuid = keyIdStr.ToGuid2();
|
Inquiry_StrangeCustomerInfo model = _strangeCustomerInfoBLL.GetModel(keyIdGuid);
|
if (model != null)
|
{
|
this.txtCustomerName.Text = model.CustomerName;
|
this.txtContractPeraon.Text = model.ContractPeraon;
|
this.txtContractCall.Text = model.ContractCall;
|
this.txtContractPhone.Text = model.ContractPhone;
|
this.txtQQ.Text = model.QQ;
|
this.txtAddress.Text = model.Address;
|
this.txtRemark.Text = model.Remark;
|
ViewState["model"] = model;
|
}
|
}
|
}
|
#endregion
|
|
#region 事件
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
BindPage();
|
}
|
}
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
{
|
bool isSuccess = false;
|
Inquiry_StrangeCustomerInfo model = ViewState["model"] as Inquiry_StrangeCustomerInfo;
|
if (model==null)
|
{
|
model = new Inquiry_StrangeCustomerInfo();
|
model.CustomerName = this.txtCustomerName.Text;
|
model.ContractPeraon = this.txtContractPeraon.Text;
|
model.ContractCall = this.txtContractCall.Text;
|
model.ContractPhone = this.txtContractPhone.Text;
|
model.QQ = this.txtQQ.Text;
|
model.Address = this.txtAddress.Text;
|
model.Remark = this.txtRemark.Text;
|
model.RecordId = RecordId;
|
model.LastUpdateTime = DateTime.Now;
|
isSuccess = _strangeCustomerInfoBLL.InsertModel(model);
|
}
|
else
|
{
|
model.CustomerName = this.txtCustomerName.Text;
|
model.ContractPeraon = this.txtContractPeraon.Text;
|
model.ContractCall = this.txtContractCall.Text;
|
model.ContractPhone = this.txtContractPhone.Text;
|
model.QQ = this.txtQQ.Text;
|
model.Address = this.txtAddress.Text;
|
model.Remark = this.txtRemark.Text;
|
model.LastUpdateTime = DateTime.Now;
|
isSuccess = _strangeCustomerInfoBLL.UpdateModel(model);
|
}
|
|
if (isSuccess)
|
{
|
JavaScript.RefreshDIVOpener(this);
|
}
|
else
|
{
|
JavaScript.MessageBox("保存失败", this);
|
}
|
}
|
#endregion
|
}
|
}
|