private void GetModel() { this.pnlMsg.Visible = false; YXShop.Model.SystemInfo.WebSetting model = null; YXShop.BLL.SystemInfo.WebSetting bll = new YXShop.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.Text = 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() { YXShop.Model.SystemInfo.WebSetting model = new YXShop.Model.SystemInfo.WebSetting(); YXShop.BLL.SystemInfo.WebSetting bll = new YXShop.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.Text; 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; } }