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
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.OA;
using CY.BLL.Promotion;
 
namespace CY.WebForm.Pages.sysglobal
{
    public partial class Promotion_ArticleInfoEdit : BasePage
    {
        Promotion_ArticleInfoBLL _Promotion_ArticleInfoBLL = null;
        Promotion_ArticleInfo ArticleInfo = null;
        public Promotion_ArticleInfoEdit() 
            {
                ArticleInfo = new Promotion_ArticleInfo();
                _Promotion_ArticleInfoBLL = new Promotion_ArticleInfoBLL();
            }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               
                if (Request["Keyid"].ToInt32() > 0)
                {
                    InitialModifyData();
 
                }
            }
 
        }
       
        /// <summary>
        /// 加载要修改的数据
        /// </summary>
        protected void InitialModifyData()
        {
 
            ArticleInfo = _Promotion_ArticleInfoBLL.SelectSingleModel(Request["Keyid"].ToString2());
            this.txtContent.Value = ArticleInfo.Content;
            this.txtRemark.Value = ArticleInfo.Remark;
            this.txtTitle.Value = ArticleInfo.Title;
         
        }
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
 
            if (Request["Keyid"].ToInt32() > 0) //如果keyid 大于0 则再加载一次对象,方便利用对象里面的不变属性
            {
                ArticleInfo = _Promotion_ArticleInfoBLL.SelectSingleModel(Request["Keyid"].ToString2());
            }
 
            ArticleInfo.Remark = txtRemark.Value;
            ArticleInfo.Content = txtContent.Value;
            ArticleInfo.Title = txtTitle.Value;
            ArticleInfo.LastUpdateTime = DateTime.Now;
            ArticleInfo.Operator = CurrentUser.ShortName;
 
            if (Request["Keyid"].ToInt32() > 0)
            {
                if (_Promotion_ArticleInfoBLL.UpdateModel(ArticleInfo))
                {
                    JavaScript.RefreshDIVOpener(this);
                }
                else
                {
                    JavaScript.MessageBox("修改失败", this);
                }
            }
            else
            {
 
                if (_Promotion_ArticleInfoBLL.insertModel(ArticleInfo))
                {
                    JavaScript.RefreshDIVOpener(this);
 
                }
                else
                {
                    JavaScript.MessageBox("添加失败", this);
                }
            }
        }
 
    }
}