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.BLL.Sys; namespace CY.WebForm.Pages.adminclient { //吴辉 //新增/修改软件销售记录 public partial class Soft_SellRecordAdd : BasePage { Soft_SellRecordBLL bll_Soft_SellRecordBLL = null; Soft_ManageBLL bll_Soft_ManageBLL = null; //初始化 public Soft_SellRecordAdd() { bll_Soft_SellRecordBLL = new Soft_SellRecordBLL(); bll_Soft_ManageBLL = new Soft_ManageBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //数据加载 public void InitData() { Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象 OA_CorporateClientsBLL _oA_CorporateClientsBLL = new OA_CorporateClientsBLL(); this.txtCustormerName.Visible = false;//默认不显示 this.spanOrderNum.InnerText = bll_Soft_SellRecordBLL.LoadOrderNum();//加载订单编号 IList corporateClients = _oA_CorporateClientsBLL.SelectListByFirmId(CurrentUser.MemberId) as IList; if (null != corporateClients) { corporateClients.Where(cc => CurrentUser.MemberId.Equals(cc.MemberId) && corporateClients.Remove(cc)); } this.selCustormer.DataSource = corporateClients; this.selCustormer.DataBind(); this.selCustormer.Items.Insert(0, new ListItem("请选择", "")); this.txtDegreeImportanId.DataSource = _sys_DictionaryBLL.GetDataByType("客户重要程度"); this.txtDegreeImportanId.DataBind(); OA_StaffBLL oA_StaffBLL = new BLL.OA_StaffBLL(); this.selBusinessManagers.DataSource = oA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, true, false); this.selBusinessManagers.DataBind(); this.selBusinessManagers.Items.Insert(0, new ListItem("无", "0")); this.selCustormerManagers.DataSource = oA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, false, true); this.selCustormerManagers.DataBind(); this.selCustormerManagers.Items.Insert(0, new ListItem("无", "0")); Pagination pa = new Pagination(); pa.PageSize = 500; pa.PageIndex = 1; this.txtSoftId.DataSource = bll_Soft_ManageBLL.SelectModelPage(pa, null, null, null, null, null, null); this.txtSoftId.DataTextField = "SoftName"; this.txtSoftId.DataValueField = "Keyid"; this.txtSoftId.DataBind(); this.txtSoftId.Items.Insert(0, new ListItem("请选择", "")); this.txtSoftId.SelectedValue = ""; this.txtSoftQuantity.Value = ""; this.txtSoftUnitprice.Value = ""; this.txtOrderMoney.Value = ""; this.txtDegreeImportanId.Value = ""; this.txtMobile.Value = ""; this.txtQQ.Value = ""; this.txtMKMdG.Value = ""; this.txtOrderRemark.Value = ""; } //表单提交 protected void btn_submit_form(object sender, EventArgs e) { try { DateTime nowTime = DateTime.Now; Soft_SellRecord m_Soft_SellRecord = new Soft_SellRecord(); m_Soft_SellRecord.ClientId = this.selCustormer.Value.ToGuid2(); m_Soft_SellRecord.ClientName = this.selCustormer.Items[this.selCustormer.SelectedIndex].Text.ToString2(); m_Soft_SellRecord.AccountManagerId = this.selCustormerManagers.Value.ToInt32(); m_Soft_SellRecord.BusinessManagerId = this.selBusinessManagers.Value.ToInt32(); m_Soft_SellRecord.SoftId = this.txtSoftId.SelectedValue.ToInt32(); m_Soft_SellRecord.SoftName = this.txtSoftId.SelectedItem.Text.ToString2(); m_Soft_SellRecord.SoftQuantity = this.txtSoftQuantity.Value.ToInt32(); m_Soft_SellRecord.SoftUnitprice = this.txtSoftUnitprice.Value.ToInt32(); m_Soft_SellRecord.OrderMoney = this.txtOrderMoney.Value.ToInt32(); m_Soft_SellRecord.OrderReceiveMoney =0; m_Soft_SellRecord.OrderStatus = 1; m_Soft_SellRecord.OrderNum = bll_Soft_SellRecordBLL.LoadOrderNum(); m_Soft_SellRecord.CreatTime = nowTime; m_Soft_SellRecord.LastUpdateTime = nowTime; m_Soft_SellRecord.Operator = this.txtMKMdG.Value; m_Soft_SellRecord.VisitStatus = 2; m_Soft_SellRecord.VisitSoftScore = ""; m_Soft_SellRecord.VisitSoftServers = ""; m_Soft_SellRecord.VisitReason = ""; m_Soft_SellRecord.VisitProposal = ""; m_Soft_SellRecord.VisitPeople = ""; m_Soft_SellRecord.VisitTime = nowTime; m_Soft_SellRecord.DegreeImportanId = this.txtDegreeImportanId.Value.ToInt32(); m_Soft_SellRecord.Mobile = this.txtMobile.Value.ToString2(); m_Soft_SellRecord.QQ = this.txtQQ.Value.ToString2(); m_Soft_SellRecord.OrderRemark = this.txtOrderRemark.Value.Trim(); if (bll_Soft_SellRecordBLL.InsertModel(m_Soft_SellRecord)) { JavaScript.MessageBox("新增成功", this, false, true); InitData(); } else JavaScript.MessageBox("新增失败", this); } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } //切换软件 protected void txtSoftTypeId_SelectedIndexChanged(object sender, EventArgs e) { Soft_Manage m_Soft_Manage = bll_Soft_ManageBLL.GetModelByKeyid(this.txtSoftId.SelectedValue.ToInt32()); if (m_Soft_Manage == null) { this.txtSoftUnitprice.Value = "0"; } else { this.txtSoftUnitprice.Value = m_Soft_Manage.SoftPrice.ToString2(); } } } }