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; } }
/// <summary> /// 得到一个对象实体 /// </summary> public ShowShop.Model.SystemInfo.WebSetting GetModel() { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,websitetitle,tel,fax,email,websitepath,logopath,bannerpath,copyright,metekey,meteinfo,publicmethod,closewebsite,closewebsiteinfo,closebbs,closebbsinfo,websitename,closeshop,closestation,websitedomain,usersagreement,loginmothod,staticpagefiletype,tmplatepath,statisticscode,filesize from yxs_websetting "); ShowShop.Model.SystemInfo.WebSetting model = new ShowShop.Model.SystemInfo.WebSetting(); DataSet ds = ChangeHope.DataBase.SQLServerHelper.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.WebSiteTitle = ds.Tables[0].Rows[0]["websitetitle"].ToString(); model.Tel = ds.Tables[0].Rows[0]["tel"].ToString(); model.Fax = ds.Tables[0].Rows[0]["fax"].ToString(); model.Email = ds.Tables[0].Rows[0]["email"].ToString(); model.WebSitePath = ds.Tables[0].Rows[0]["websitepath"].ToString(); model.LogoPath = ds.Tables[0].Rows[0]["logopath"].ToString(); model.BannerPath = ds.Tables[0].Rows[0]["bannerpath"].ToString(); model.CopyRight = ds.Tables[0].Rows[0]["copyright"].ToString(); model.MeteKey = ds.Tables[0].Rows[0]["metekey"].ToString(); model.MeteInfo = ds.Tables[0].Rows[0]["meteinfo"].ToString(); model.Statisticscode = ds.Tables[0].Rows[0]["statisticscode"].ToString();// if (ds.Tables[0].Rows[0]["filesize"].ToString() != "")// { model.Filesize = int.Parse(ds.Tables[0].Rows[0]["filesize"].ToString()); } if (ds.Tables[0].Rows[0]["publicmethod"].ToString() != "") { model.PublicMethod = int.Parse(ds.Tables[0].Rows[0]["publicmethod"].ToString()); } if (ds.Tables[0].Rows[0]["closewebsite"].ToString() != "") { model.CloseWebSite = int.Parse(ds.Tables[0].Rows[0]["closewebsite"].ToString()); } model.CloseWebSiteInfo = ds.Tables[0].Rows[0]["closewebsiteinfo"].ToString(); if (ds.Tables[0].Rows[0]["closebbs"].ToString() != "") { model.CloseBBS = int.Parse(ds.Tables[0].Rows[0]["closebbs"].ToString()); } model.CloseBBSInfo = ds.Tables[0].Rows[0]["closebbsinfo"].ToString(); model.WebSiteName = ds.Tables[0].Rows[0]["websitename"].ToString(); if (ds.Tables[0].Rows[0]["closeshop"].ToString() != "") { model.CloseShop = int.Parse(ds.Tables[0].Rows[0]["closeshop"].ToString()); } if (ds.Tables[0].Rows[0]["closestation"].ToString() != "") { model.CloseStation = int.Parse(ds.Tables[0].Rows[0]["closestation"].ToString()); } model.WebSiteDomain = ds.Tables[0].Rows[0]["websitedomain"].ToString(); model.UsersAgreement = ds.Tables[0].Rows[0]["usersagreement"].ToString(); if (ds.Tables[0].Rows[0]["loginmothod"].ToString() != "") { model.LoginMothod = int.Parse(ds.Tables[0].Rows[0]["loginmothod"].ToString()); } model.StaticPageFileType = ds.Tables[0].Rows[0]["staticpagefiletype"].ToString(); model.TmplatePath = ds.Tables[0].Rows[0]["tmplatepath"].ToString(); return model; } else { return null; } }