private void GetModel()
        {
            this.pnlMsg.Visible = false;
            ShowShop.Model.SystemInfo.WebSetting model =null;
            ShowShop.BLL.SystemInfo.WebSetting bll = new ShowShop.BLL.SystemInfo.WebSetting();
            try
            {
                model = bll.GetModel();
                if(model!=null)
                {
                    this.txtId.Value = model.Id.ToString();
                    this.txtBannerPath.Text = model.BannerPath;
                    this.txtStatisticsCode.Text = model.Statisticscode;//
                    this.txtFileSize.Text = model.Filesize.ToString();//
                    this.txtCloseBBSInfo.Text = model.CloseBBSInfo;
                    this.txtCloseWebSiteInfo.Text = model.CloseWebSiteInfo;
                    this.txtCopyRight.Text = model.CopyRight;
                    this.txtEmail.Text = model.Email;
                    this.txtFax.Text = model.Fax;
                    this.txtLogoPath.Text = model.LogoPath;
                    this.txtMeteInfo.Text = model.MeteInfo;
                    this.txtMeteKey.Text = model.MeteKey;
                    this.txtTel.Text = model.Tel;
                    this.txtTemplatePath.Text = model.TmplatePath;
                    this.txtUsersAgreement.Value = model.UsersAgreement;
                    this.txtWebSiteDomain.Text = model.WebSiteDomain;
                    this.txtWebSiteName.Text = model.WebSiteName;
                    this.txtWebSitePath.Text = model.WebSitePath;
                    this.txtWebSiteTitle.Text = model.WebSiteTitle;

                    this.ckbCloseBBS.Checked = model.CloseBBS.Equals(1);
                    this.ddlCloseShop.SelectedValue = model.CloseShop.ToString();
                    this.ddlCloseStation.SelectedValue = model.CloseStation.ToString();
                    this.ckbCloseWebSite.Checked = model.CloseWebSite.Equals(1);
                    this.ddlLoginMothod.SelectedValue = model.LoginMothod.ToString();
                    this.ddlPublicMethod.SelectedValue = model.PublicMethod.ToString();
                    this.ddlStaticPageFileType.SelectedValue = model.StaticPageFileType;
                }
            }
            catch { }
            finally
            {
                model = null;
                bll = null;
            }
        }
        private void Save()
        {
            ShowShop.Model.SystemInfo.WebSetting model = new ShowShop.Model.SystemInfo.WebSetting();
            ShowShop.BLL.SystemInfo.WebSetting bll = new ShowShop.BLL.SystemInfo.WebSetting();
            try
            {
                if (this.txtTel.Text!="")
                {
                    if(!ChangeHope.Common.ValidateHelper.IsPhone(txtTel.Text))
                    {
                        this.ltlMsg.Text = "操作失败,请输入正确电话号码!";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                }
                if (this.txtFax.Text!="")
                {
                    if(!ChangeHope.Common.ValidateHelper.IsPhone(txtFax.Text))
                    {
                        this.ltlMsg.Text = "操作失败,请输入正确传真号码!";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                }
                if (this.txtEmail.Text!="")
                {
                    if(!ChangeHope.Common.ValidateHelper.IsEmail(txtEmail.Text))
                    {
                        this.ltlMsg.Text = "操作失败,请输入正确邮件地址!";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                }
                if (this.txtFileSize.Text!="")
                {
                    if(!ChangeHope.Common.ValidateHelper.IsNumber(txtFileSize.Text))
                    {
                        this.ltlMsg.Text = "操作失败,整站上传文件大小必须为整数!";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                }

                model.Id = ChangeHope.Common.StringHelper.StringToInt(this.txtId.Value);
                model.Statisticscode = this.txtStatisticsCode.Text;//
                model.Filesize = ChangeHope.Common.StringHelper.StringToInt(this.txtFileSize.Text);//
                model.BannerPath = this.txtBannerPath.Text;
                model.CloseBBSInfo = this.txtCloseBBSInfo.Text;
                model.CloseWebSiteInfo = this.txtCloseWebSiteInfo.Text;
                model.CopyRight = this.txtCopyRight.Text;
                model.Email = this.txtEmail.Text;
                model.Fax = this.txtFax.Text;
                model.LogoPath = this.txtLogoPath.Text;
                model.MeteInfo = this.txtMeteInfo.Text;
                model.MeteKey = this.txtMeteKey.Text;
                model.Tel = this.txtTel.Text;
                model.TmplatePath = this.txtTemplatePath.Text;
                model.UsersAgreement = this.txtUsersAgreement.Value;
                model.WebSiteDomain = this.txtWebSiteDomain.Text;
                model.WebSiteName = this.txtWebSiteName.Text;
                model.WebSitePath = this.txtWebSitePath.Text;
                model.WebSiteTitle = this.txtWebSiteTitle.Text;

                model.CloseBBS = this.ckbCloseBBS.Checked?1:0;
                model.CloseShop = ChangeHope.Common.StringHelper.StringToInt(this.ddlCloseShop.SelectedValue);
                model.CloseStation =ChangeHope.Common.StringHelper.StringToInt( this.ddlCloseStation.SelectedValue);
                model.CloseWebSite = this.ckbCloseWebSite.Checked?1:0;
                model.LoginMothod = ChangeHope.Common.StringHelper.StringToInt(this.ddlLoginMothod.SelectedValue);
                model.PublicMethod = ChangeHope.Common.StringHelper.StringToInt(this.ddlPublicMethod.SelectedValue);
                model.StaticPageFileType = this.ddlStaticPageFileType.SelectedValue;
                bll.AddOrUpdate(model);
                this.ltlMsg.Text = "操作成功,已经保存了您的设置";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            catch (Exception e) {
                this.ltlMsg.Text = "操作失败<br/>"+e.ToString();
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
            }

            finally
            {
                ChangeHope.Common.CacheClass.RemoveOneCache("WebSetting");
                model = null;
                bll = null;
            }
        }
Example #3
0
        public SysParameter()
        {
            int intCache = 30;//缓存时间
            string cc_WebSetting = "WebSetting";
            string cc_CustomerSetting = "CustomerSetting";
            //string cc_ThumbnailsSetting = "ThumbnailsSetting";
               // string cc_ShopSetting = "ShopSetting";

            #region 系统参数设置
            object objWebSetting=ChangeHope.Common.CacheClass.GetCache(cc_WebSetting);
            ShowShop.Model.SystemInfo.WebSetting wsmodel = null;
            if (objWebSetting != null)
            {
                wsmodel = (ShowShop.Model.SystemInfo.WebSetting)objWebSetting;
            }
            else
            {
                ShowShop.BLL.SystemInfo.WebSetting wsbll = new ShowShop.BLL.SystemInfo.WebSetting();
                wsmodel = wsbll.GetModel();
                ChangeHope.Common.CacheClass.SetCache(cc_WebSetting, wsmodel, DateTime.Now.AddMinutes(intCache), TimeSpan.Zero);
            }
            if (wsmodel != null)
            {
                imageSize = wsmodel.Filesize;
                _isopensite = wsmodel.CloseWebSite == 1 ? true : false;
                _isopenshops = wsmodel.CloseShop == 1 ? true : false;
                _isopenbbs = wsmodel.CloseBBS == 1 ? true : false;
                _sitehttp = wsmodel.WebSiteDomain;
                _dummypath = wsmodel.WebSitePath;
                _websitename = wsmodel.WebSiteName;
                _websitetitle = wsmodel.WebSiteTitle;
                _websitedescription = wsmodel.MeteInfo;
                _websitekey = wsmodel.MeteKey;
                _websitetemplatepath = wsmodel.TmplatePath;
                _websitelogo = wsmodel.LogoPath;
                _websitebanner = wsmodel.BannerPath;
                _isrewrite = wsmodel.PublicMethod == 0 ? true : false;
                _staticpagefiletype = wsmodel.StaticPageFileType;
                _isclosestation = wsmodel.CloseStation == 1 ? true : false;
                _sitetel = wsmodel.Tel;
                _sitefax = wsmodel.Fax;
                _siteemail = wsmodel.Email;
                _copyright = wsmodel.CopyRight;
                _issession = wsmodel.LoginMothod == 0 ? true : false;
                _colecsitedescription = wsmodel.CloseWebSiteInfo;
                _statisticalCode = wsmodel.Statisticscode;
            }

            #endregion

            #region 用户参数设置
            object objCustomerSetting = ChangeHope.Common.CacheClass.GetCache(cc_CustomerSetting);
            ShowShop.Model.SystemInfo.CustomerSetting csmodel = null;
            if (objCustomerSetting != null)
            {
                csmodel = (ShowShop.Model.SystemInfo.CustomerSetting)objCustomerSetting;
            }
            else
            {
                ShowShop.BLL.SystemInfo.CustomerSetting csbll = new ShowShop.BLL.SystemInfo.CustomerSetting();
                csmodel = csbll.GetModel();
                ChangeHope.Common.CacheClass.SetCache(cc_CustomerSetting, csmodel, DateTime.Now.AddMinutes(intCache), TimeSpan.Zero);
            }
            if (csmodel != null)
            {
                _isregistered = csmodel.AllowRegister.Trim() == "1" ? true : false;
                _sameemailregister = csmodel.SameEmailRegister == 1 ? true : false;
                _adminvalidate = csmodel.AdminValidate == 1 ? true : false;
                _emailvalidate = csmodel.EmailValidate == 1 ? true : false;
                _emailvalidatecontent = csmodel.EmailValidateContent.Trim();
                _handselcoupons = csmodel.HandselCoupons == 1 ? true : false;
                _handselcouponsnumber = Convert.ToInt32(csmodel.HandselCouponsNumber);
                _handselcouponsbegintime = Convert.ToDateTime(csmodel.HandselCouponsBeginTime);
                _handselcouponsendtime = Convert.ToDateTime(csmodel.HandselCouponsEndTime);
                _handselpoint = csmodel.HandselPoint;
                _forbiduserid = csmodel.ForbidUserId;
                _userdefaultgroup = csmodel.UserDefaultGroup;
                _loginpoint = Convert.ToDecimal(csmodel.LoginPoint);
                _isloginvalidate = csmodel.LoginIsNeedCheckCode == 1 ? true : false;
                _ismultilogin = csmodel.AllowOtherLogin == 1 ? true : false;
            }
            #endregion

            #region 缩略图参数设置
            //object objThumbnailsSetting = ChangeHope.Common.CacheClass.GetCache(cc_ThumbnailsSetting);
            //ShowShop.Model.SystemInfo.ThumbnailsSetting tsmodel = null;
            //if (objThumbnailsSetting != null)
            //{
            //    tsmodel = (ShowShop.Model.SystemInfo.ThumbnailsSetting)objThumbnailsSetting;
            //}
            //else
            //{
            //    ShowShop.BLL.SystemInfo.ThumbnailsSetting tsbll = new ShowShop.BLL.SystemInfo.ThumbnailsSetting();
            //    tsmodel = tsbll.GetModel();
            //    ChangeHope.Common.CacheClass.SetCache(cc_ThumbnailsSetting, tsmodel, DateTime.Now.AddMinutes(intCache), TimeSpan.Zero);
            //}

            //if (tsmodel != null)
            //{
            //    _thumbnailsheight = Convert.ToInt32(tsmodel.ThumbnailsHeight);
            //    _thumbnailswidth =  Convert.ToInt32(tsmodel.ThumbnailsWidth);
            //    _imagesthumbnailsheight =  Convert.ToInt32(tsmodel.ImageHeight);
            //    _imagesthumbnailswidth = Convert.ToInt32(tsmodel.ImageWidth);
            //    _imagewatermarktransparent =  Convert.ToInt32(tsmodel.ImgTransparent) ;
            //    _textwatermarktransparent = Convert.ToInt32(tsmodel.CharTransparent);
            //    _watermarktext = tsmodel.Characters;
            //    _watermarkimage = tsmodel.WatermarkPicturePath;
            //    _watermarkposition = tsmodel.WatermarkPosition;
            //    _textorimageswatermark = tsmodel.Type;
            //}
            #endregion

            #region 商铺参数设置
            //object objShopSetting = ChangeHope.Common.CacheClass.GetCache(cc_ShopSetting);
            //ShowShop.Model.SystemInfo.ShopSetting ssmodel = null;
            //if (objShopSetting != null)
            //{
            //    ssmodel = (ShowShop.Model.SystemInfo.ShopSetting)objShopSetting;
            //}
            //else
            //{
            //    ShowShop.BLL.SystemInfo.ShopSetting ssbll = new ShowShop.BLL.SystemInfo.ShopSetting();
            //    ssmodel = ssbll.GetModel();
            //    ChangeHope.Common.CacheClass.SetCache(cc_ShopSetting, ssmodel, DateTime.Now.AddMinutes(intCache), TimeSpan.Zero);
            //}
            //if (ssmodel != null)
            //{
            //    _isthumbnails = ssmodel.Thumbnails == 1 ? true : false;
            //    _iswatermark = ssmodel.WaterMark == 1 ? true : false;
            //    _allowgroupbuydeposit = ssmodel.AllowGroupbuyDeposit == 1 ? true : false;
            //    _allowauctiondeposit = ssmodel.AllowAuctionDeposit == 1 ? true : false;
            //    _ispaymentweboperation = ssmodel.OrdersReceive == 1 ? true : false;
            //    _ordersText = ssmodel.OrdersText;
            //}
            #endregion
        }