username@email.com
2025-05-14 99ddfbcecf0fa2881eb3a91028257eef87dab6de
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Model;
using CY.BLL.Sys;
using CY.BLL.Promotion;
using CY.Infrastructure;
using System.Data.SqlClient;
using System.Data;
using CY.Infrastructure.Common;
namespace CY.WebForm.Pages.sysglobal
{
    public partial class AddPromotionRule : BasePage
    {
 
        Sys_DictionaryBLL _Sys_DictionaryBLL = null;  //字典业务逻辑操作类对象
        Promotion_IncomeRuleBLL _Promotion_IncomeRuleBLL = null; // 推广收益规则 业务逻辑操作对象
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPageData();
                if (Request["Keyid"].ToInt32() > 0)
                {
                    ModifyData();
                }
 
            }
        }
        public AddPromotionRule()
        {
            _Sys_DictionaryBLL = new Sys_DictionaryBLL();
            _Promotion_IncomeRuleBLL = new Promotion_IncomeRuleBLL();
        }
 
        /// <summary>
        /// 初始化页面数据
        /// </summary>
        private void InitPageData()
        {
 
            lstSourceType.DataSource = _Sys_DictionaryBLL.GetDataByType("来源类型");
            lstSourceType.DataBind();
 
        }
        protected void ModifyData()
        {
            string Keyid = Request["Keyid"];
            Promotion_IncomeRule incomerule = _Promotion_IncomeRuleBLL.GetSingleModel(Keyid);
 
            this.lstSourceType.Value = incomerule.SourceTypeId.ToString2();
 
            this.txtPopularizeScore.Value = incomerule.PopularizeScore.ToString2();
            this.txtPopularizeNoteMoney.Value = incomerule.PopularizeNoteMoney.ToString2();
            this.txtSuperiorScore.Value = incomerule.SuperiorScore.ToString2();
            this.txtSuperiorNoteMoney.Value = incomerule.SuperiorNoteMoney.ToString2();
            this.lstIsRatio.Value = MyConvert.ConvertToString(incomerule.IsRatio);
            this.txtDeputyCityRevenue.Value = incomerule.DeputyCityRevenue.ToString2();
            this.txtDeputyDistrictRevenue.Value = incomerule.DeputyDistrictRevenue.ToString2();
            this.txtRemark.Value = incomerule.Remark.ToString2();
        }
 
 
        /// <summary>
        /// 插入一条收益规则
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Submit_Config(object sender, EventArgs e)
        {
            Promotion_IncomeRule model = new Promotion_IncomeRule();
            model.DeputyDistrictRevenue = MyConvert.ConvertToDecimal(txtDeputyDistrictRevenue.Value);
            model.DeputyCityRevenue = MyConvert.ConvertToDecimal(txtDeputyCityRevenue.Value);
 
            model.SourceTypeId = MyConvert.ConvertToInt32(lstSourceType.Value);
            model.SuperiorNoteMoney = this.txtSuperiorNoteMoney.Value.ToDecimal2();
            model.SuperiorScore = this.txtSuperiorScore.Value.ToDecimal2();
            model.PopularizeNoteMoney = this.txtPopularizeNoteMoney.Value.ToDecimal2();
            model.PopularizeScore = this.txtPopularizeScore.Value.ToDecimal2();
            model.IsRatio = this.lstIsRatio.Value.ToBoolean2();
            model.Operator = CurrentUser.ShortName;
            model.Remark = this.txtRemark.Value;
            model.LastUpdateTime = DateTime.Now;
            if (Request["Keyid"].ToInt32() > 0)
            {
                model.Keyid = Request["Keyid"].ToInt32();
                if (_Promotion_IncomeRuleBLL.UpdateModel(model))
                    JavaScript.MessageBox("更新成功", this, true, true);
                else
                    JavaScript.MessageBox("更新失败", this);
            }
            else
            {
 
                if (_Promotion_IncomeRuleBLL.InsertModel(model))
                    JavaScript.MessageBox("添加成功", this, true, true);
                else
                    JavaScript.MessageBox("添加失败", this);
            }
        }
    }
}