username@email.com
2025-05-15 6fe02a16e55f17e45a3997171e1b2284d45af25b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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<OA_CorporateClients> corporateClients = _oA_CorporateClientsBLL.SelectListByFirmId(CurrentUser.MemberId) as IList<OA_CorporateClients>;
            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();
            }
        }
    }
}