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
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_PictureEdit : BasePage
    {
 
        Promotion_PictureBLL _Promotion_PictureBLL = null;
        Promotion_Picture Picture = null;
        public Promotion_PictureEdit()
        {
            _Promotion_PictureBLL = new Promotion_PictureBLL();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
 
            if (!IsPostBack)
            {
 
                if (Request["Keyid"].ToInt32() > 0)
                {
                    InitialModifyData();
                }
            }
 
        }
        /// <summary>
        /// 如果是修改则显示原来数据的信息
        /// </summary>
        public void InitialModifyData()
        {
 
            Picture = _Promotion_PictureBLL.SelectSingleModel(Request["Keyid"].ToString2());
            this.trImg.Visible = string.IsNullOrEmpty(Picture.FileId) ? false : true;
            this.imgFileId.Src = Picture.FileId;
            this.txtHeight.Value = Picture.Height.ToString2();
            this.txtRemark.Value = Picture.Remark;
            this.txtWidth.Value = Picture.Width.ToString2();
 
        }
 
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            Promotion_Picture m_Promotion_Picture = new Promotion_Picture();
            if (Request["Keyid"].ToInt32() > 0)
            {
                m_Promotion_Picture = _Promotion_PictureBLL.SelectSingleModel(Request["Keyid"].ToString2());
            }
 
 
            //图片上传
            CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("FileId", m_Promotion_Picture.FileId);
            m_Promotion_Picture.FileId = m_Promotion_Picture.FileId ?? "";
            if (_UpFileResult2.returnerror.Count == 0)
            {
                if (_UpFileResult2.returnfilename.Count > 0)
                    m_Promotion_Picture.FileId = _UpFileResult2.returnfilename[0].ToString2();
            }
            else
            {
                JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
                return;
            }
 
            m_Promotion_Picture.Height = this.txtHeight.Value.ToInt32();
            m_Promotion_Picture.Width = this.txtWidth.Value.ToInt32();
            m_Promotion_Picture.Remark = this.txtRemark.Value;
            m_Promotion_Picture.LastUpdateTime = DateTime.Now;
            m_Promotion_Picture.Operator = CurrentUser.ShortName;
 
            if (Request["Keyid"].ToInt32() > 0)
            {
                if (_Promotion_PictureBLL.UpdateModel(m_Promotion_Picture))
                {
                    JavaScript.RefreshDIVOpener(this);
 
                }
                else
                {
                    JavaScript.MessageBox("更新失败", this);
                }
 
            }
            else
            {
 
                if (_Promotion_PictureBLL.insertModel(m_Promotion_Picture))
                {
                    JavaScript.RefreshDIVOpener(this);
                }
                else
                {
                    JavaScript.MessageBox("添加失败", this);
                }
 
            }
 
        }
 
    }
}