using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using System.Data;
|
using System.Data.SqlClient;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.DESEncrypt;
|
|
namespace CY.WebForm.Pages.soft
|
{
|
//吴辉
|
//新增/修改软件客户
|
public partial class ClientAdd : BasePage
|
{
|
Soft_ClientBLL bll_Soft_ClientBLL = null;
|
public string Province = ""; //接收值 Request["selectProvince"].ToString2();
|
public string City = "";//接收值 Request["selectCity"].ToString2();
|
public string County = "";//接收值 Request["selectCounty"].ToString2();
|
|
//初始化
|
public ClientAdd()
|
{
|
bll_Soft_ClientBLL = new Soft_ClientBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
Soft_Client m_Soft_Client = bll_Soft_ClientBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_Soft_Client != null)
|
{
|
this.txtClientName.Value = m_Soft_Client.ClientName.ToString2();
|
this.txtClientPhone.Value = m_Soft_Client.ClientPhone.ToString2();
|
this.txtClientQQ.Value = m_Soft_Client.ClientQQ.ToString2();
|
this.txtClientMobile.Value = m_Soft_Client.ClientMobile.ToString2();
|
Province = m_Soft_Client.ClientProvince.ToString2();
|
City = m_Soft_Client.ClientCity.ToString2();
|
County = m_Soft_Client.ClientCountry.ToString2();
|
this.txtClientAddress.Value = m_Soft_Client.ClientAddress.ToString2();
|
this.txtClientPostcode.Value = m_Soft_Client.ClientPostcode.ToString2();
|
this.txtLoginId.Value = m_Soft_Client.LoginId;
|
this.txtRegDate.Value = m_Soft_Client.RegisterDate.Value.ToString("yyyy-MM-dd");
|
this.txtEmail.Value = m_Soft_Client.ClientEmail;
|
this.selPwdReset.Value = "1";
|
this.selStatus.Value = (string.IsNullOrEmpty(m_Soft_Client.UseState.ToString2()) ? "1" : m_Soft_Client.UseState.ToString2());
|
}
|
else
|
{
|
this.txtEmail.Value = "";
|
this.txtClientName.Value = "";
|
this.txtClientPhone.Value = "";
|
this.txtClientQQ.Value = "";
|
this.txtClientMobile.Value = "";
|
this.txtClientAddress.Value = "";
|
this.txtClientPostcode.Value = "";
|
this.txtLoginId.Value = "";
|
this.selPwdReset.Value = "1";
|
this.selStatus.Value = "1";
|
this.txtRegDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
|
}
|
}
|
|
//表单提交
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
try
|
{
|
DateTime nowTime = DateTime.Now;
|
Soft_Client m_Soft_Client = bll_Soft_ClientBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_Soft_Client == null)
|
{
|
m_Soft_Client = new Soft_Client();
|
m_Soft_Client.ClientProxyId = 0;
|
m_Soft_Client.ClientStatus = 2;
|
m_Soft_Client.ClientType = 2;
|
m_Soft_Client.ClientIsMember = 1;
|
m_Soft_Client.ClientMemberId = Guid.NewGuid();
|
m_Soft_Client.ClientCreatTime = nowTime;
|
m_Soft_Client.Password = DESEncrypt.Encrypt("123456+");
|
m_Soft_Client.RegisterDate = nowTime;
|
}
|
|
if (this.selPwdReset.Value == "2" || string.IsNullOrEmpty(m_Soft_Client.Password))
|
{
|
m_Soft_Client.Password = DESEncrypt.Encrypt("123456+");
|
}
|
|
m_Soft_Client.ClientName = this.txtClientName.Value.ToString2();
|
m_Soft_Client.ClientPhone = this.txtClientPhone.Value.ToString2();
|
m_Soft_Client.ClientQQ = this.txtClientQQ.Value.ToString2();
|
m_Soft_Client.ClientMobile = this.txtClientMobile.Value.ToString2();
|
m_Soft_Client.ClientProvince = Request["selectProvince"].ToString2();
|
m_Soft_Client.ClientCity = Request["selectCity"].ToString2();
|
m_Soft_Client.ClientCountry = Request["selectCounty"].ToString2();
|
m_Soft_Client.ClientAddress = this.txtClientAddress.Value.ToString2();
|
m_Soft_Client.ClientPostcode = this.txtClientPostcode.Value.ToString2();
|
m_Soft_Client.ClientEndTime = nowTime;
|
m_Soft_Client.LastUpdateTime = nowTime;
|
m_Soft_Client.Operator = CurrentUser.ShortName;
|
m_Soft_Client.LoginId = this.txtLoginId.Value;
|
m_Soft_Client.UseState = this.selStatus.Value.ToInt32();
|
m_Soft_Client.ClientEmail = this.txtEmail.Value;
|
|
if (Request["keyid"].ToInt32() > 0)
|
{
|
if (bll_Soft_ClientBLL.UpdateModel(m_Soft_Client))
|
JavaScript.MessageBox("更新成功", this, true, true);
|
else
|
JavaScript.MessageBox("更新失败", this);
|
}
|
else
|
{
|
if (bll_Soft_ClientBLL.InsertModel(m_Soft_Client))
|
{
|
JavaScript.MessageBox("新增成功", this, false, true);
|
InitData();
|
}
|
else
|
JavaScript.MessageBox("新增失败", this);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
}
|
}
|