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
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 PrizeReciveAddressEdit :BasePage
    {   
        
        public string Province = ""; //接收值 Request["selectProvince"].ToString2();
        public string City = "";//接收值 Request["selectCity"].ToString2();
        public string County = "";//接收值 Request["selectCounty"].ToString2();
         EC_PrizeReciveAddressBLL _EC_PrizeReciveAddressBLL = null; //奖品地址类业务逻辑操作对象
       EC_PrizeReciveAddress prizeReciveAddress= null; // 奖品地址实体对象
 
        public PrizeReciveAddressEdit() 
        {
            _EC_PrizeReciveAddressBLL = new EC_PrizeReciveAddressBLL();
            prizeReciveAddress = new EC_PrizeReciveAddress();
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request["Keyid"].ToInt32() > 0)
                {
                    InitialModifyData();
                }
            }
 
        }
          /// <summary>
        /// 加载要修改的数据
        /// </summary>
        protected void InitialModifyData()
        {
            prizeReciveAddress = _EC_PrizeReciveAddressBLL.getOnePriceAddress(Request["Keyid"].ToInt32());
            this.txtDetailedAddress.Value = prizeReciveAddress.DetailedAddress;
            this.txtRemark.Value = prizeReciveAddress.Remark;
            this.txtWorkTime.Value = prizeReciveAddress.WorkTime;
            this.Province = prizeReciveAddress.Province;
            this.County = prizeReciveAddress.County;
            this.City = prizeReciveAddress.City;
        
        
        }
 
 
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            if (Request["Keyid"].ToInt32() > 0)    //如果keyid 大于0 则再加载一次对象,方便利用对象里面的不变属性
            {
                prizeReciveAddress = _EC_PrizeReciveAddressBLL.getOnePriceAddress(Request["Keyid"].ToInt32());
 
            }
            prizeReciveAddress.LastUpdateTime = System.DateTime.Now;
            prizeReciveAddress.Remark = txtRemark.Value.ToString2();
            prizeReciveAddress.Province = Request["selectProvince"].ToString2();
            prizeReciveAddress.City = Request["selectCity"].ToString2();
            prizeReciveAddress.County = Request["selectCounty"].ToString2();
            prizeReciveAddress.DetailedAddress = txtDetailedAddress.Value.ToString2();
            prizeReciveAddress.Operator = CurrentUser.ShortName;
            prizeReciveAddress.WorkTime = txtWorkTime.Value.ToString2();
            if (Request["Keyid"].ToInt32() > 0)
            {
                if (_EC_PrizeReciveAddressBLL.UpdateModel(prizeReciveAddress))
                {
                    JavaScript.RefreshDIVOpener(this);
                }
                else
                {
                    JavaScript.MessageBox("更新失败", this);
                }
 
            }
            else
            {
 
 
 
                if (_EC_PrizeReciveAddressBLL.InsertModel(prizeReciveAddress))
                {
                    JavaScript.RefreshDIVOpener(this);
                }
                else
                {
                    JavaScript.MessageBox("添加失败", this);
                }
            }
        }
    }
}