username@email.com
2025-02-20 27008c309a7adcd608666df53f4a89f88fb83d5f
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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;
using CY.Infrastructure.Query;
using CY.BLL.Sys;
namespace CY.WebForm.Pages.business
{
    public partial class FollowRecord : BasePage
    {
        #region 变量
        FollowRecordInfoBLL _followRecordInfoBLL = new FollowRecordInfoBLL();
        Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();
        RecordInfoBLL _recordInfoBLL = new RecordInfoBLL();
        #endregion
 
        #region 属性
        #endregion
 
        #region 方法
        /// <summary>
        /// 初始化绑定页面
        /// </summary>
        private void BindList()
        {
            int keyId = 0;
            if (Request["keyId"] != null)
                keyId = Request["keyId"].ToString().ToInt32().Value;
            Inquiry_RecordInfo recordInfo = _recordInfoBLL.GetModel(keyId);
            if (recordInfo.CustomerPrice.HasValue)
            {
                this.txtCustomerPrice.Value = recordInfo.CustomerPrice.Value.ToString("0.00");
            }
            this.hidInquiryId.Value = keyId.ToString();
            Pagination pa = new Pagination();
            pa.PageSize = UCPager1.AspNetPager.PageSize;
            pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
            IList<Inquiry_FollowRecordInfo> recordList = _followRecordInfoBLL.GetModeList(keyId, pa);
            this.RepRecordList.DataSource = recordList;
            this.RepRecordList.DataBind();
            UCPager1.AspNetPager.RecordCount = pa.RecordCount;
        }
 
        private void BindFollowType()
        {
            IEnumerable<Sys_Dictionary> list = _sys_DictionaryBLL.GetDataByType("跟单方式");
            this.ddlFollowType.DataSource = list;
            this.ddlFollowType.DataTextField = "Name";
            this.ddlFollowType.DataValueField = "MeanValue";
            this.ddlFollowType.DataBind();
        }
 
        private void BindIntentType()
        {
            IEnumerable<Sys_Dictionary> list = _sys_DictionaryBLL.GetDataByType("成交意向");
            this.ddlIntentType.DataSource = list;
            this.ddlIntentType.DataTextField = "Name";
            this.ddlIntentType.DataValueField = "MeanValue";
            this.ddlIntentType.DataBind();
        }
        #endregion
 
        #region 事件
        protected void Page_Load(object sender, EventArgs e)
        {
            this.UCPager1.AspNetPager.PageChanged += new EventHandler(AspNetPager1_PageChanged);
            if (!IsPostBack)
            {
                BindFollowType();
                BindIntentType();
                BindList();
            }
            if (Request["deleteKeyIds"] != null)
            {
                List<int> deleteKeyIdList = new List<int>();
                string deleteKeyIds = Request["deleteKeyIds"].ToString();
                if (deleteKeyIds.Contains(","))
                {
                    string[] keyIdArry = deleteKeyIds.Split(',');
                    foreach (string keyId in keyIdArry)
                    {
                        deleteKeyIdList.Add(Convert.ToInt32(keyId));
                    }
                }
                else
                {
                    deleteKeyIdList.Add(Convert.ToInt32(deleteKeyIds));
                }
 
                bool isSuccess = _followRecordInfoBLL.DeleteModelList(deleteKeyIdList);
                if (isSuccess)
                {
                    JavaScript.MessageBox("删除成功", this);
 
                }
                else
                {
                    JavaScript.MessageBox("删除失败", this);
                }
                BindList();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool isSuccess = false;
            Inquiry_FollowRecordInfo _recordInfo = new Inquiry_FollowRecordInfo();
            int keyId = -1;
            if (!string.IsNullOrEmpty(this.hidKeyId.Value))
            {
                keyId = this.hidKeyId.Value.ToInt32().Value;
            }
            //新增
            if (keyId == -1)
            {
                _recordInfo.RecordId = Request["keyId"].ToString().ToInt32().Value;
                if (this.txtCustomerPrice.Value.Trim() == "")
                {
                    _recordInfo.CustomerPrice = null;
                }
                else
                {
                    _recordInfo.CustomerPrice = this.txtCustomerPrice.Value.ToDecimal2().Value;
                }
                _recordInfo.FollowTypeId = this.ddlFollowType.SelectedValue.ToString().ToInt32().Value;
                _recordInfo.IntentTypeId = this.ddlIntentType.SelectedValue.ToString().ToInt32().Value;
                _recordInfo.FollowRecord = this.txtFollowRecord.Text.ToString();
                _recordInfo.FollowPerson = CurrentUser.ShortName;
                _recordInfo.FollowTime = DateTime.Now;
                _recordInfo.ResultStatus = ddlResultStatus.SelectedValue.ToInt32().Value;
                isSuccess = _followRecordInfoBLL.InsertModel(_recordInfo);
            }
            else //修改
            {
                _recordInfo.KeyId = keyId;
                _recordInfo.RecordId = Request["keyId"].ToString().ToInt32().Value;
                if (this.txtCustomerPrice.Value.Trim() == "")
                {
                    _recordInfo.CustomerPrice = null;
                }
                else
                {
                    _recordInfo.CustomerPrice = this.txtCustomerPrice.Value.ToDecimal2().Value;
                }
                _recordInfo.FollowTypeId = this.ddlFollowType.SelectedValue.ToString().ToInt32().Value;
                _recordInfo.IntentTypeId = this.ddlIntentType.SelectedValue.ToString().ToInt32().Value;
                _recordInfo.FollowRecord = this.txtFollowRecord.Text.ToString();
                _recordInfo.FollowPerson = CurrentUser.ShortName;
                _recordInfo.FollowTime = DateTime.Now;
                _recordInfo.ResultStatus = ddlResultStatus.SelectedValue.ToInt32().Value;
                isSuccess = _followRecordInfoBLL.UpdateModel(_recordInfo);
            }
            if (isSuccess)
            {
                JavaScript.RefreshDIVOpener(this);
            }
            else
            {
                JavaScript.MessageBox("保存失败", this);
            }
            txtCustomerPrice.Value = string.Empty;
            txtFollowRecord.Text = string.Empty;
            this.ddlFollowType.SelectedIndex = 0;
            this.ddlIntentType.SelectedIndex = 0;
            this.hidKeyId.Value = string.Empty;
            BindList();
        }
 
        /// <summary>
        /// 分页事件
        /// </summary>
        /// <param name="src"></param>
        /// <param name="e"></param>
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BindList();
        }
        #endregion
    }
}