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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Query;
using CY.Infrastructure.Common;
using CY.BLL.EC;
namespace CY.WebForm.Pages.webmanage
{
    public partial class PrizeInfoEdit :BasePage
    {
 
        public string Province = "";
        public string City = "";
        public string County = "";
        EC_PrizeInfo prizeInfo = null;        
        EC_PrizeInfoBLL _EC_PrizeInfoBLL = null;
        EC_PrizeReciveAddressBLL _EC_PrizeReciveAddressBLL = null;
        public PrizeInfoEdit()
        {
            prizeInfo = new EC_PrizeInfo();   //实例化奖品实体类
            _EC_PrizeInfoBLL = new EC_PrizeInfoBLL(); // 实例化奖品信息操作对象
            _EC_PrizeReciveAddressBLL = new EC_PrizeReciveAddressBLL(); // 实例化奖品地址信息操作对象
 
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                InitialAddressData();
            if (Request["Keyid"].ToInt32() > 0)
            {
                InitialModifyData();
            }
            }
 
        }
        public void InitialAddressData()
        {
            this.selPrizeAddress.DataSource = _EC_PrizeReciveAddressBLL.getAllPriceAddress();
            this.selPrizeAddress.DataBind();
        }
      /// <summary>
      /// 如果是修改则显示原来数据的信息
      /// </summary>
        public void InitialModifyData()
        { 
          
            prizeInfo = _EC_PrizeInfoBLL.getOnePrizeInfo(Request["Keyid"].ToInt32());
            this.trImg.Visible = string.IsNullOrEmpty(prizeInfo.FileId)? false:true;
            this.imgFileId.Src = prizeInfo.FileId;
            this.txtAllCount.Value = prizeInfo.AllCount.ToString2();
            this.txtCommoditycode.Value = prizeInfo.Commoditycode.ToString2();
            this.txtExchangedCount.Value = prizeInfo.ExchangedCount.ToString2();
            this.txtNeedIntegral.Value = prizeInfo.NeedIntegral.ToString2();
            this.txtOrderCode.Value = prizeInfo.OrderCode.ToString2();
            this.txtPrizeName.Value = prizeInfo.PrizeName;
            this.txtSingleExCount.Value = prizeInfo.SingleExCount.ToString2();
            this.selPrizeAddress.Value = prizeInfo.ReceiveAddId.ToString2();
            this.txtPrizeName.Value = prizeInfo.PrizeName;
            this.selIsUsed.Value = prizeInfo.IsUsed.ToString2();
            this.txtRemark.Value = prizeInfo.Remark;
        }
 
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
 
 
            //上传奖品照片
            CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult0 = CY.WebForm.cs.UploadCS.Upload("FileId", prizeInfo.FileId);
            if (_UpFileResult0.returnerror.Count == 0)
            {
                if (_UpFileResult0.returnfilename.Count > 0)
                {
                    prizeInfo.FileId = _UpFileResult0.returnfilename[0].ToString2();
                }
                else
                {
                    prizeInfo.FileId = "";
                }
            }
            else
            {
                prizeInfo.FileId = "";
                JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult0.returnerror.ToArray(typeof(string))), this);
                return;
 
            }
            if (Request["Keyid"].ToInt32() > 0)
            {
 
                prizeInfo = _EC_PrizeInfoBLL.getOnePrizeInfo(Request["Keyid"].ToInt32());
                if (!string.IsNullOrEmpty( this.FileId.Value) )
                {
                   
                    if (_UpFileResult0.returnerror.Count == 0)
                    {
                        if (_UpFileResult0.returnfilename.Count > 0)
                        {
                            prizeInfo.FileId = _UpFileResult0.returnfilename[0].ToString2();
                        }
                        else
                        {
                            prizeInfo.FileId = "";
                        }
                    }
                    else
                    {
                        prizeInfo.FileId = "";
                        JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult0.returnerror.ToArray(typeof(string))), this);
                        return;
                    }
                }
            }
 
            //更新或添加奖品信息
         
            prizeInfo.ExchangedCount = this.txtExchangedCount.Value.ToInt32();
            prizeInfo.AllCount = this.txtAllCount.Value.ToInt32();
            prizeInfo.Commoditycode = this.txtCommoditycode.Value.ToString2();
            prizeInfo.IsUsed = this.selIsUsed.Value.ToBoolean2();
            prizeInfo.LastUpdateTime = DateTime.Now;
            prizeInfo.NeedIntegral = this.txtNeedIntegral.Value.ToInt32();
            prizeInfo.Operator = this.CurrentUser.ShortName;
            prizeInfo.OrderCode = this.txtOrderCode.Value.ToString2();
            prizeInfo.PrizeName = this.txtPrizeName.Value.ToString2();
            prizeInfo.Remark = this.txtRemark.Value.ToString2();
            prizeInfo.SingleExCount = this.txtSingleExCount.Value.ToInt32();
            prizeInfo.ReceiveAddId =  this.selPrizeAddress.Value.ToInt32();
 
            if (Request["Keyid"].ToInt32() > 0)
            {
                if (_EC_PrizeInfoBLL.UpdateModel(prizeInfo))
                {
                    JavaScript.RefreshDIVOpener(this);
 
                }
                else
                {
                    JavaScript.MessageBox("更新失败", this);
                }
 
            }
            else 
            {
 
                if (_EC_PrizeInfoBLL.InsertModel(prizeInfo))
                {
                    JavaScript.RefreshDIVOpener(this);
                }
                else
                {
                    JavaScript.MessageBox("插入失败", this);
                }
            
            }
 
        }
 
    }
}