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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
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.Infrastructure.DESEncrypt;
using CY.Config;
using CY.Infrastructure.Common;
using System.Collections;
using System.IO;
using CY.Infrastructure.Cache;
using CY.Model;
namespace CY.WebForm.Pages.sysglobal
{
    //吴辉
    //网站基本信息配置
    public partial class SysSiteConfig : BasePage
    {
        public string page_WebIco = "";
        public string page_WebLogo = "";
        public string page_WebDefaultImg = "";
        Sys_CitySiteBLL bll_Sys_CitySiteBLL =  new Sys_CitySiteBLL();
 
        private static ICacheStrategy CACHE = null;
        private const string ASSEMBLYFORHomeKEYNews = "AssemblyForHomeNews";//首页新闻缓存键 
        private const string ASSEMBLYFORHomeKEYWebLink = "AssemblyForHomeWebLink";//首页新闻缓存键 
        private const string ASSEMBLYFORHomeKEYSupply = "AssemblyForHomeSupply";//首页供应信息缓存键 
        private const string ASSEMBLYFORHomeKEYPrize = "AssemblyForHomePrize";//首页礼品信息缓存键 
        private const string ASSEMBLYFORHomeKEYMemberScore = "AssemblyForHomeMemberScore";//首页积分排名缓存键 
        private const string ASSEMBLYFORHomeKEYAD = "AssemblyForHomeAD";//首页广告缓存键 
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            CacheFactory.InitializeCacheFactory(new DefaultCacheStrategy());//初始化缓存工厂
            CACHE = CacheFactory.GetCacher();//创建缓存
            if (!IsPostBack)
            {
                this.txtWebName.Value = WebInfo.Instance.WebName;
                this.txtWebDomain.Value = WebInfo.Instance.WebDomain;
                this.txtWebSuffix.Value = WebInfo.Instance.WebSuffix;
                this.selWebStatus.Value = WebInfo.Instance.WebStatus;
                this.txtWebSEOTitle.Value = WebInfo.Instance.WebSEOTitle;
                this.txtWebSEOKeyword.Value = WebInfo.Instance.WebSEOKeyword;
                this.txtWebSEODetail.InnerText = WebInfo.Instance.WebSEODetail;
                this.txtWebCloseMessage.Text = WebInfo.Instance.WebCloseMessage;
                this.selIsBogusStatic.Value = WebInfo.Instance.IsBogusStatic.ToString2();
                this.txtStaticPageSuffix.Value = WebInfo.Instance.StaticPageSuffix;
                this.txtAnnouncementDetail.Value = WebInfo.Instance.AnnouncementDetail.ToString2();
                this.txtVersionNumber.Value = WebInfo.Instance.VersionNumber.ToString2();
                page_WebIco = WebInfo.Instance.WebIco;
                page_WebLogo = WebInfo.Instance.WebLogo;
                page_WebDefaultImg = WebInfo.Instance.WebDefaultImg;
 
                this.selectProvince.DataSource = bll_Sys_CitySiteBLL.SelectProxyNextModel(0, 0, 1);
                this.selectProvince.DataTextField = "Name";
                this.selectProvince.DataValueField = "Keyid";
                this.selectProvince.DataBind();
                this.selectProvince.Items.Insert(0, new ListItem("请选择", ""));
                this.selectProvince.SelectedValue = WebInfo.Instance.WebProvinceId.ToString2();
                ChangeProvince(this, e);
                this.selectCity.SelectedValue = WebInfo.Instance.WebCityId.ToString2();
            }
        }
 
        //表单提交
        protected void btn_Submit_Config(object sender, EventArgs e)
        {
            try
            {
                //网站图标上传
                CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload("fileWebIco", WebInfo.Instance.WebIco);
                if (_UpFileResult1.returnerror.Count == 0)
                {
                    if (_UpFileResult1.returnfilename.Count > 0)
                    {
                        WebInfo.Instance.WebIco = _UpFileResult1.returnfilename[0].ToString2();
                    }
                }
                else
                {
                    JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult1.returnerror.ToArray(typeof(string))), this);
                    return;
                }
 
                //网站Logo上传
                CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("fileWebLogo", WebInfo.Instance.WebLogo);
                if (_UpFileResult2.returnerror.Count == 0)
                {
                    if (_UpFileResult2.returnfilename.Count > 0)
                    {
                        WebInfo.Instance.WebLogo = _UpFileResult2.returnfilename[0].ToString2();
                    }
                }
                else
                {
                    JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
                    return;
                }
 
                //网站默认图片上传
                CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult3 = CY.WebForm.cs.UploadCS.Upload("fileWebDefaultImg", WebInfo.Instance.WebDefaultImg);
                if (_UpFileResult3.returnerror.Count == 0)
                {
                    if (_UpFileResult3.returnfilename.Count > 0)
                    {
                        WebInfo.Instance.WebDefaultImg = _UpFileResult3.returnfilename[0].ToString2();
                    }
                }
                else
                {
                    JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult3.returnerror.ToArray(typeof(string))), this);
                    return;
                }
 
                WebInfo.Instance.WebName = this.txtWebName.Value.ToString2();
                WebInfo.Instance.WebDomain = this.txtWebDomain.Value.ToString2();
                WebInfo.Instance.WebSuffix = this.txtWebSuffix.Value.ToString2();
                WebInfo.Instance.WebStatus = this.selWebStatus.Value.ToString2();
                WebInfo.Instance.WebSEOTitle = this.txtWebSEOTitle.Value.ToString2();
                WebInfo.Instance.WebSEOKeyword = this.txtWebSEOKeyword.Value.ToString2();
                WebInfo.Instance.WebSEODetail = this.txtWebSEODetail.InnerText.ToString2();
                WebInfo.Instance.WebCloseMessage = this.txtWebCloseMessage.Text.ToString2();
                WebInfo.Instance.IsBogusStatic = this.selIsBogusStatic.Value.ToBoolean2();
                WebInfo.Instance.StaticPageSuffix = this.txtStaticPageSuffix.Value.ToString2();
                WebInfo.Instance.AnnouncementDetail = this.txtAnnouncementDetail.Value.ToString2();
                WebInfo.Instance.WebProvinceName = this.selectProvince.SelectedItem.Text.ToString2();
                WebInfo.Instance.WebProvinceId = this.selectProvince.SelectedValue.ToInt32();
                WebInfo.Instance.WebCityName = this.selectCity.SelectedItem.Text.ToString2();
                WebInfo.Instance.WebCityId = this.selectCity.SelectedValue.ToInt32();
                WebInfo.Instance.VersionNumber = this.txtVersionNumber.Value.ToString2();
                WebInfo.Instance.Update();
                
                page_WebIco = WebInfo.Instance.WebIco;
                page_WebLogo = WebInfo.Instance.WebLogo;
                page_WebDefaultImg = WebInfo.Instance.WebDefaultImg;
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
            JavaScript.MessageBox("操作成功", this);
        }
 
        //清除首页缓存
        protected void btn_ClearHome_Data(object sender, EventArgs e)
        {
            try
            {
                CACHE.RemoveObject(ASSEMBLYFORHomeKEYNews);
                CACHE.RemoveObject(ASSEMBLYFORHomeKEYWebLink);
                CACHE.RemoveObject(ASSEMBLYFORHomeKEYSupply);
                CACHE.RemoveObject(ASSEMBLYFORHomeKEYPrize);
                CACHE.RemoveObject(ASSEMBLYFORHomeKEYMemberScore);
                CACHE.RemoveObject(ASSEMBLYFORHomeKEYAD);
                string filePath1 = Server.MapPath("~/CacheFiles/HomeCache.txt");
                if (File.Exists(filePath1))
                {
                    File.Delete(filePath1);
                }
                string filePath2 = Server.MapPath("~/CacheFiles/Orders.txt");
                if (File.Exists(filePath2))
                {
                    File.Delete(filePath2);
                }
                string filePath3 = Server.MapPath("~/CacheFiles/QuoteDemand.txt");
                if (File.Exists(filePath3))
                {
                    File.Delete(filePath3);
                }
                string filePath4 = Server.MapPath("~/CacheFiles/SeckillBusiness.txt");
                if (File.Exists(filePath4))
                {
                    File.Delete(filePath4);
                }
                JavaScript.MessageBox("清理成功",this);
                Response.Redirect("/Pages/sysglobal/SysSiteConfig.aspx");
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("清理失败", this);
            }
            
        }
 
        //改变省
        protected void ChangeProvince(object sender, EventArgs e)
        {
            this.selectCity.Items.Clear();
            Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(this.selectProvince.SelectedValue.ToInt32()??0);
            this.selectCity.DataSource = bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.Keyid, 0, 2);
            this.selectCity.DataTextField = "Name";
            this.selectCity.DataValueField = "Keyid";
            this.selectCity.DataBind();
            this.selectCity.Items.Insert(0, new ListItem("请选择", ""));
        }
    }
}