username@email.com
2025-05-12 ae6e40362a745caef9ead36f81f38313fb8c2c66
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
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;
using CY.Infrastructure.Common;
using System.Data;
using CY.BLL.Sys;
 
namespace CY.WebForm.Pages.InfoManage
{
    //吴辉
    //添加/修改广告位置
    public partial class AdLocationEdit : BasePage
    {
        Info_AdLoctionBLL bll_Info_AdLoctionBLL = null;
        Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
 
        //初始化
        public AdLocationEdit()
        {
            bll_Info_AdLoctionBLL = new Info_AdLoctionBLL();
            bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
        }
 
        //页面加载
        public void InitData()
        {
            this.selRemark.DataSource = bll_Sys_DictionaryBLL.GetDataByType("网站广告位置版块");
            this.selRemark.DataValueField = "MeanValue";
            this.selRemark.DataTextField = "Name";
            this.selRemark.DataBind();
 
            Info_AdLoction m_Info_AdLoction = new Info_AdLoction();
            if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0)
                m_Info_AdLoction = bll_Info_AdLoctionBLL.SelectModelByKeyId(Request["Keyid"].ToInt32());
 
            this.txtAP_Title.Value = m_Info_AdLoction.AP_Title.ToString2();
            this.txtAP_WidePixels.Value = m_Info_AdLoction.AP_WidePixels.ToString2();
            this.txtAP_HighPixels.Value = m_Info_AdLoction.AP_HighPixels.ToString2();
            this.afileAP_DefaultImg.HRef = m_Info_AdLoction.AP_DefaultImg.ToString2();
            this.selRemark.Value = m_Info_AdLoction.Remark.ToString2();
        }
 
        //提交事件
        protected void btn_Submit_form(object sender, EventArgs e)
        {
            Info_AdLoction m_Info_AdLoction = new Info_AdLoction();
            if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0)
                m_Info_AdLoction = bll_Info_AdLoctionBLL.SelectModelByKeyId(Request["Keyid"].ToInt32());
 
            m_Info_AdLoction.AP_Title = this.txtAP_Title.Value.ToString2();
            m_Info_AdLoction.AP_WidePixels = this.txtAP_WidePixels.Value.ToInt32();
            m_Info_AdLoction.AP_HighPixels = this.txtAP_HighPixels.Value.ToInt32();
 
            //图片上传
            CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("fileAP_DefaultImg", m_Info_AdLoction.AP_DefaultImg);
            m_Info_AdLoction.AP_DefaultImg = m_Info_AdLoction.AP_DefaultImg ?? "";
            if (_UpFileResult2.returnerror.Count == 0)
            {
                if (_UpFileResult2.returnfilename.Count > 0)
                    m_Info_AdLoction.AP_DefaultImg = _UpFileResult2.returnfilename[0].ToString2();
            }
            else
            {
                JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
                return; 
            }
 
            m_Info_AdLoction.Remark = this.selRemark.Value.ToInt32();
            m_Info_AdLoction.LastUpdateTime = DateTime.Now;
            m_Info_AdLoction.Operator = CurrentUser.ShortName;
            m_Info_AdLoction.Price_Month = m_Info_AdLoction.Price_Month ?? 0;
            m_Info_AdLoction.Price_Season = m_Info_AdLoction.Price_Season ?? 0;
            m_Info_AdLoction.Price_Half = m_Info_AdLoction.Price_Half ?? 0;
            m_Info_AdLoction.Price_Year = m_Info_AdLoction.Price_Year ?? 0;
 
            if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0)
            {
                if (bll_Info_AdLoctionBLL.UpdateModel(m_Info_AdLoction))
                    JavaScript.MessageBox("更新成功", this, true, false);
                else
                    JavaScript.MessageBox("更新失败", this);
            }
            else
            {
                if (bll_Info_AdLoctionBLL.InsertModel(m_Info_AdLoction))
                    JavaScript.RefreshParent(this);
                else
                    JavaScript.MessageBox("添加失败", this);
            }
        }
 
 
    }
}