/// <summary> /// Add or update one record /// </summary> public void AddOrUpdate(Johnny.CMS.OM.SystemInfo.WebSettings model) { if (!dal.IsExist(1)) { dal.Add(model); } else { dal.Update(model); } }
/// <summary> /// Method to get one recoder by primary key /// </summary> public Johnny.CMS.OM.SystemInfo.WebSettings GetModel() { //Set up a return value Johnny.CMS.OM.SystemInfo.WebSettings model = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT [Id], [WebsiteName], [WebsiteTitle], [ShortDescription], [Tel], [Fax], [Email], [WebsiteAddress], [WebsitePath], [FileSize], [LogoPath], [BannerPath], [Copyright], [MetaKeywords], [MetaDescription], [IsClosed], [ClosedInfo], [UserAgreement], [LoginType] "); strSql.Append(" FROM [cms_websettings] "); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { if (sdr.Read()) model = new Johnny.CMS.OM.SystemInfo.WebSettings(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetInt32(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetString(13), sdr.GetString(14), sdr.GetBoolean(15), sdr.GetString(16), sdr.GetString(17), sdr.GetBoolean(18)); else model = new Johnny.CMS.OM.SystemInfo.WebSettings(); } return model; }
protected void Page_Load(object sender, EventArgs e) { //about Johnny.CMS.BLL.SystemInfo.WebSettings bll = new Johnny.CMS.BLL.SystemInfo.WebSettings(); Johnny.CMS.OM.SystemInfo.WebSettings model = bll.GetModel(); if (model != null) { lblShortDescription.Text = model.ShortDescription; } //website Johnny.CMS.BLL.SeH.OpenSource bllOpenSource = new Johnny.CMS.BLL.SeH.OpenSource(); IList <Johnny.CMS.OM.SeH.OpenSource> listOpenSource = bllOpenSource.GetList(); StringBuilder sb = new StringBuilder(); int ix = 0; for (ix = 0; ix < listOpenSource.Count; ix++) { if (ix % 4 == 0) { sb.Append("<ul>"); } sb.Append(string.Format("<li><a href=\"{0}\" target=\"_blank\" title=\"{1}\">{2}</a></li>", listOpenSource[ix].URL, listOpenSource[ix].Description, listOpenSource[ix].OpenSourceName)); if (ix != 0 && (ix == listOpenSource.Count - 1 || ix % 3 == 0)) { sb.Append("</ul>"); } } lblWebsites.Text = sb.ToString(); //best practice sb.Length = 0; Johnny.CMS.BLL.SeH.BestPractice bllBestPractice = new Johnny.CMS.BLL.SeH.BestPractice(); IList <Johnny.CMS.OM.SeH.BestPractice> listBestPractice = bllBestPractice.GetList(); foreach (Johnny.CMS.OM.SeH.BestPractice bestpractice in listBestPractice) { sb.Append(string.Format(" <h4><a href=\"bestpracticedetails.aspx?bestpracticeid={0}\">{1}</a></h4>", bestpractice.BestPracticeId, bestpractice.BestPracticeName)); } lblBestPractice.Text = sb.ToString(); }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { Johnny.CMS.BLL.SystemInfo.WebSettings bll = new Johnny.CMS.BLL.SystemInfo.WebSettings(); Johnny.CMS.OM.SystemInfo.WebSettings model = new Johnny.CMS.OM.SystemInfo.WebSettings(); model = bll.GetModel(); txtWebsiteName.Text = model.WebsiteName; txtWebsiteTitle.Text = model.WebsiteTitle; txtShortDescription.Text = model.ShortDescription; txtTel.Text = model.Tel; txtFax.Text = model.Fax; txtEmail.Text = model.Email; txtWebsiteAddress.Text = model.WebsiteAddress; txtWebsitePath.Text = model.WebsitePath; txtFileSize.Text = DataConvert.GetString(model.FileSize); txtLogoPath.Text = model.LogoPath; txtBannerPath.Text = model.BannerPath; txtCopyright.Text = model.Copyright; txtMetaKeywords.Text = model.MetaKeywords; txtMetaDescription.Text = model.MetaDescription; if (model.IsClosed) { rdbIsClosed1.Checked = true; } else { rdbIsClosed0.Checked = true; } txtClosedInfo.Text = model.ClosedInfo; txtUserAgreement.Text = model.UserAgreement; if (model.LoginType) { rdbLoginType0.Checked = true; } else { rdbLoginType1.Checked = true; } btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save; } }
public SysParameter() { int intCache = 30;//缓存时间 string cc_WebSettings = "WebSettings"; object objWebSetting = Johnny.Library.Helper.CacheHelper.GetCache(cc_WebSettings); Johnny.CMS.OM.SystemInfo.WebSettings wsmodel = new Johnny.CMS.OM.SystemInfo.WebSettings(); if (objWebSetting != null) { wsmodel = (Johnny.CMS.OM.SystemInfo.WebSettings)objWebSetting; } else { Johnny.CMS.BLL.SystemInfo.WebSettings wsbll = new Johnny.CMS.BLL.SystemInfo.WebSettings(); wsmodel = wsbll.GetModel(); Johnny.Library.Helper.CacheHelper.SetCache(cc_WebSettings, wsmodel, DateTime.Now.AddMinutes(intCache), TimeSpan.Zero); } _websettings = wsmodel; }
/// <summary> /// Method to get recoders with condition /// </summary> public IList<Johnny.CMS.OM.SystemInfo.WebSettings> GetList() { IList<Johnny.CMS.OM.SystemInfo.WebSettings> list = new List<Johnny.CMS.OM.SystemInfo.WebSettings>(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT [Id], [WebsiteName], [WebsiteTitle], [ShortDescription], [Tel], [Fax], [Email], [WebsiteAddress], [WebsitePath], [FileSize], [LogoPath], [BannerPath], [Copyright], [MetaKeywords], [MetaDescription], [IsClosed], [ClosedInfo], [UserAgreement], [LoginType] "); strSql.Append(" FROM [cms_websettings] "); strSql.Append(" ORDER BY [Sequence]"); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { Johnny.CMS.OM.SystemInfo.WebSettings item = new Johnny.CMS.OM.SystemInfo.WebSettings(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetInt32(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetString(13), sdr.GetString(14), sdr.GetBoolean(15), sdr.GetString(16), sdr.GetString(17), sdr.GetBoolean(18)); list.Add(item); } } return list; }
/// <summary> /// Method to get recoders with condition /// </summary> public IList <Johnny.CMS.OM.SystemInfo.WebSettings> GetList() { IList <Johnny.CMS.OM.SystemInfo.WebSettings> list = new List <Johnny.CMS.OM.SystemInfo.WebSettings>(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT [Id], [WebsiteName], [WebsiteTitle], [ShortDescription], [Tel], [Fax], [Email], [WebsiteAddress], [WebsitePath], [FileSize], [LogoPath], [BannerPath], [Copyright], [MetaKeywords], [MetaDescription], [IsClosed], [ClosedInfo], [UserAgreement], [LoginType] "); strSql.Append(" FROM [cms_websettings] "); strSql.Append(" ORDER BY [Sequence]"); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { Johnny.CMS.OM.SystemInfo.WebSettings item = new Johnny.CMS.OM.SystemInfo.WebSettings(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetInt32(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetString(13), sdr.GetString(14), sdr.GetBoolean(15), sdr.GetString(16), sdr.GetString(17), sdr.GetBoolean(18)); list.Add(item); } } return(list); }
/// <summary> /// Method to get one recoder by primary key /// </summary> public Johnny.CMS.OM.SystemInfo.WebSettings GetModel() { //Set up a return value Johnny.CMS.OM.SystemInfo.WebSettings model = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT [Id], [WebsiteName], [WebsiteTitle], [ShortDescription], [Tel], [Fax], [Email], [WebsiteAddress], [WebsitePath], [FileSize], [LogoPath], [BannerPath], [Copyright], [MetaKeywords], [MetaDescription], [IsClosed], [ClosedInfo], [UserAgreement], [LoginType] "); strSql.Append(" FROM [cms_websettings] "); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { if (sdr.Read()) { model = new Johnny.CMS.OM.SystemInfo.WebSettings(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetInt32(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetString(13), sdr.GetString(14), sdr.GetBoolean(15), sdr.GetString(16), sdr.GetString(17), sdr.GetBoolean(18)); } else { model = new Johnny.CMS.OM.SystemInfo.WebSettings(); } } return(model); }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { Johnny.CMS.BLL.SystemInfo.WebSettings bll = new Johnny.CMS.BLL.SystemInfo.WebSettings(); Johnny.CMS.OM.SystemInfo.WebSettings model = new Johnny.CMS.OM.SystemInfo.WebSettings(); model = bll.GetModel(); txtWebsiteName.Text = model.WebsiteName; txtWebsiteTitle.Text = model.WebsiteTitle; txtShortDescription.Text = model.ShortDescription; txtTel.Text = model.Tel; txtFax.Text = model.Fax; txtEmail.Text = model.Email; txtWebsiteAddress.Text = model.WebsiteAddress; txtWebsitePath.Text = model.WebsitePath; txtFileSize.Text = DataConvert.GetString(model.FileSize); txtLogoPath.Text = model.LogoPath; txtBannerPath.Text = model.BannerPath; txtCopyright.Text = model.Copyright; txtMetaKeywords.Text = model.MetaKeywords; txtMetaDescription.Text = model.MetaDescription; if (model.IsClosed) rdbIsClosed1.Checked = true; else rdbIsClosed0.Checked = true; txtClosedInfo.Text = model.ClosedInfo; txtUserAgreement.Text = model.UserAgreement; if (model.LoginType) rdbLoginType0.Checked = true; else rdbLoginType1.Checked = true; btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save; } }
protected void btnAdd_Click(object sender, System.EventArgs e) { SetMessage(""); //validation if (!CheckInputEmptyAndLength(txtWebsiteName, "E00101", "E00102", false)) return; if (!CheckInputEmptyAndLength(txtWebsiteTitle, "E00101", "E00102", false)) return; if (!CheckInputLength(txtTel, "E00104")) return; if (!CheckInputLength(txtFax, "E00106")) return; if (!CheckInputLength(txtEmail, "E00106")) return; if (!CheckInputEmptyAndLength(txtWebsiteAddress, "E00101", "E00102")) return; if (!CheckInputEmptyAndLength(txtWebsitePath, "E00101", "E00102")) return; if (!CheckInputEmptyAndLength(txtFileSize, "E00101", "E00102")) return; if (!DataValidation.IsNaturalNumberRange(txtFileSize.Text, 0, 5120)) return; if (!CheckInputEmptyAndLength(txtLogoPath, "E00101", "E00102")) return; if (!CheckInputEmptyAndLength(txtBannerPath, "E00101", "E00102")) return; if (!CheckInputLength(txtCopyright, "E00106")) return; if (!CheckInputLength(txtMetaKeywords, "E00106")) return; if (!CheckInputLength(txtMetaDescription, "E00106")) return; if (!CheckInputLength(txtClosedInfo, "E00106")) return; Johnny.CMS.BLL.SystemInfo.WebSettings bll = new Johnny.CMS.BLL.SystemInfo.WebSettings(); Johnny.CMS.OM.SystemInfo.WebSettings model = new Johnny.CMS.OM.SystemInfo.WebSettings(); model.WebsiteName = txtWebsiteName.Text; model.WebsiteTitle = txtWebsiteTitle.Text; model.ShortDescription = txtShortDescription.Text; model.Tel = txtTel.Text; model.Fax = txtFax.Text; model.Email = txtEmail.Text; model.WebsiteAddress = txtWebsiteAddress.Text; model.WebsitePath = txtWebsitePath.Text; model.FileSize = DataConvert.GetInt32(txtFileSize.Text); model.LogoPath = txtLogoPath.Text; model.BannerPath = txtBannerPath.Text; model.Copyright = txtCopyright.Text; model.MetaKeywords = txtMetaKeywords.Text; model.MetaDescription = txtMetaDescription.Text; model.IsClosed = rdbIsClosed1.Checked; model.ClosedInfo = txtClosedInfo.Text; model.UserAgreement = txtUserAgreement.Text; model.LoginType = rdbLoginType0.Checked; bll.AddOrUpdate(model); SetMessage(GetMessage("C00003")); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.WebSettings model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO [cms_websettings]("); strSql.Append("[WebsiteName],[WebsiteTitle],[ShortDescription],[Tel],[Fax],[Email],[WebsiteAddress],[WebsitePath],[FileSize],[LogoPath],[BannerPath],[Copyright],[MetaKeywords],[MetaDescription],[IsClosed],[ClosedInfo],[UserAgreement],[LoginType]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@websitename,@websitetitle,@shortdescription,@tel,@fax,@email,@websiteaddress,@websitepath,@filesize,@logopath,@bannerpath,@copyright,@metakeywords,@metadescription,@isclosed,@closedinfo,@useragreement,@logintype"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@websitename", SqlDbType.NVarChar, 40), new SqlParameter("@websitetitle", SqlDbType.NVarChar, 100), new SqlParameter("@shortdescription", SqlDbType.VarChar, 500), new SqlParameter("@tel", SqlDbType.VarChar, 50), new SqlParameter("@fax", SqlDbType.VarChar, 50), new SqlParameter("@email", SqlDbType.VarChar, 50), new SqlParameter("@websiteaddress", SqlDbType.VarChar, 200), new SqlParameter("@websitepath", SqlDbType.VarChar, 50), new SqlParameter("@filesize", SqlDbType.Int, 4), new SqlParameter("@logopath", SqlDbType.VarChar, 100), new SqlParameter("@bannerpath", SqlDbType.VarChar, 100), new SqlParameter("@copyright", SqlDbType.NVarChar, 500), new SqlParameter("@metakeywords", SqlDbType.NVarChar, 100), new SqlParameter("@metadescription", SqlDbType.NVarChar, 400), new SqlParameter("@isclosed", SqlDbType.Bit), new SqlParameter("@closedinfo", SqlDbType.NVarChar, 1000), new SqlParameter("@useragreement", SqlDbType.Text), new SqlParameter("@logintype", SqlDbType.Int, 4) }; parameters[0].Value = model.WebsiteName; parameters[1].Value = model.WebsiteTitle; parameters[2].Value = model.ShortDescription; parameters[3].Value = model.Tel; parameters[4].Value = model.Fax; parameters[5].Value = model.Email; parameters[6].Value = model.WebsiteAddress; parameters[7].Value = model.WebsitePath; parameters[8].Value = model.FileSize; parameters[9].Value = model.LogoPath; parameters[10].Value = model.BannerPath; parameters[11].Value = model.Copyright; parameters[12].Value = model.MetaKeywords; parameters[13].Value = model.MetaDescription; parameters[14].Value = model.IsClosed; parameters[15].Value = model.ClosedInfo; parameters[16].Value = model.UserAgreement; parameters[17].Value = model.LoginType; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SystemInfo.WebSettings model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [cms_websettings] SET "); strSql.Append("[WebsiteName]=@websitename,"); strSql.Append("[WebsiteTitle]=@websitetitle,"); strSql.Append("[ShortDescription]=@shortdescription,"); strSql.Append("[Tel]=@tel,"); strSql.Append("[Fax]=@fax,"); strSql.Append("[Email]=@email,"); strSql.Append("[WebsiteAddress]=@websiteaddress,"); strSql.Append("[WebsitePath]=@websitepath,"); strSql.Append("[FileSize]=@filesize,"); strSql.Append("[LogoPath]=@logopath,"); strSql.Append("[BannerPath]=@bannerpath,"); strSql.Append("[Copyright]=@copyright,"); strSql.Append("[MetaKeywords]=@metakeywords,"); strSql.Append("[MetaDescription]=@metadescription,"); strSql.Append("[IsClosed]=@isclosed,"); strSql.Append("[ClosedInfo]=@closedinfo,"); strSql.Append("[UserAgreement]=@useragreement,"); strSql.Append("[LoginType]=@logintype"); //strSql.Append(" WHERE [Id]=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@websitename", SqlDbType.NVarChar, 40), new SqlParameter("@websitetitle", SqlDbType.NVarChar, 100), new SqlParameter("@shortdescription", SqlDbType.VarChar, 500), new SqlParameter("@tel", SqlDbType.VarChar, 50), new SqlParameter("@fax", SqlDbType.VarChar, 50), new SqlParameter("@email", SqlDbType.VarChar, 50), new SqlParameter("@websiteaddress", SqlDbType.VarChar, 200), new SqlParameter("@websitepath", SqlDbType.VarChar, 50), new SqlParameter("@filesize", SqlDbType.Int, 4), new SqlParameter("@logopath", SqlDbType.VarChar, 100), new SqlParameter("@bannerpath", SqlDbType.VarChar, 100), new SqlParameter("@copyright", SqlDbType.NVarChar, 500), new SqlParameter("@metakeywords", SqlDbType.NVarChar, 100), new SqlParameter("@metadescription", SqlDbType.NVarChar, 400), new SqlParameter("@isclosed", SqlDbType.Bit), new SqlParameter("@closedinfo", SqlDbType.NVarChar, 1000), new SqlParameter("@useragreement", SqlDbType.Text), new SqlParameter("@logintype", SqlDbType.Int, 4) }; parameters[0].Value = model.Id; parameters[1].Value = model.WebsiteName; parameters[2].Value = model.WebsiteTitle; parameters[3].Value = model.ShortDescription; parameters[4].Value = model.Tel; parameters[5].Value = model.Fax; parameters[6].Value = model.Email; parameters[7].Value = model.WebsiteAddress; parameters[8].Value = model.WebsitePath; parameters[9].Value = model.FileSize; parameters[10].Value = model.LogoPath; parameters[11].Value = model.BannerPath; parameters[12].Value = model.Copyright; parameters[13].Value = model.MetaKeywords; parameters[14].Value = model.MetaDescription; parameters[15].Value = model.IsClosed; parameters[16].Value = model.ClosedInfo; parameters[17].Value = model.UserAgreement; parameters[18].Value = model.LoginType; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SystemInfo.WebSettings model) { dal.Update(model); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SystemInfo.WebSettings model) { return(dal.Add(model)); }
protected void btnAdd_Click(object sender, System.EventArgs e) { SetMessage(""); //validation if (!CheckInputEmptyAndLength(txtWebsiteName, "E00101", "E00102", false)) { return; } if (!CheckInputEmptyAndLength(txtWebsiteTitle, "E00101", "E00102", false)) { return; } if (!CheckInputLength(txtTel, "E00104")) { return; } if (!CheckInputLength(txtFax, "E00106")) { return; } if (!CheckInputLength(txtEmail, "E00106")) { return; } if (!CheckInputEmptyAndLength(txtWebsiteAddress, "E00101", "E00102")) { return; } if (!CheckInputEmptyAndLength(txtWebsitePath, "E00101", "E00102")) { return; } if (!CheckInputEmptyAndLength(txtFileSize, "E00101", "E00102")) { return; } if (!DataValidation.IsNaturalNumberRange(txtFileSize.Text, 0, 5120)) { return; } if (!CheckInputEmptyAndLength(txtLogoPath, "E00101", "E00102")) { return; } if (!CheckInputEmptyAndLength(txtBannerPath, "E00101", "E00102")) { return; } if (!CheckInputLength(txtCopyright, "E00106")) { return; } if (!CheckInputLength(txtMetaKeywords, "E00106")) { return; } if (!CheckInputLength(txtMetaDescription, "E00106")) { return; } if (!CheckInputLength(txtClosedInfo, "E00106")) { return; } Johnny.CMS.BLL.SystemInfo.WebSettings bll = new Johnny.CMS.BLL.SystemInfo.WebSettings(); Johnny.CMS.OM.SystemInfo.WebSettings model = new Johnny.CMS.OM.SystemInfo.WebSettings(); model.WebsiteName = txtWebsiteName.Text; model.WebsiteTitle = txtWebsiteTitle.Text; model.ShortDescription = txtShortDescription.Text; model.Tel = txtTel.Text; model.Fax = txtFax.Text; model.Email = txtEmail.Text; model.WebsiteAddress = txtWebsiteAddress.Text; model.WebsitePath = txtWebsitePath.Text; model.FileSize = DataConvert.GetInt32(txtFileSize.Text); model.LogoPath = txtLogoPath.Text; model.BannerPath = txtBannerPath.Text; model.Copyright = txtCopyright.Text; model.MetaKeywords = txtMetaKeywords.Text; model.MetaDescription = txtMetaDescription.Text; model.IsClosed = rdbIsClosed1.Checked; model.ClosedInfo = txtClosedInfo.Text; model.UserAgreement = txtUserAgreement.Text; model.LoginType = rdbLoginType0.Checked; bll.AddOrUpdate(model); SetMessage(GetMessage("C00003")); }