using System; using System.Data; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_Module_Settings_Common : System.Web.UI.Page { DBAccess.DBAccess ClSqlCmd; public void Page_Load(object sender, EventArgs e) { ClSqlCmd = new DBAccess.DBAccess(System.Configuration.ConfigurationSettings.AppSettings["SE_ConnectionString"]); /////////////////////////////////////////////////////////////////////////// if (!Page.IsPostBack) { GetData(); } } void GetData() { DataSet DS = ClSqlCmd.DataSetSel(@" SELECT [ContentWidth] ,[Title] ,[Align_Ver] FROM [dbo].[__StandardEngine_T_ModuleStyles] where [Module_ID]=" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { if (DS.Tables[0].Rows[0]["ContentWidth"] != Convert.DBNull) { ddl_ContentWidth.Value = DS.Tables[0].Rows[0]["ContentWidth"].ToString(); } if (DS.Tables[0].Rows[0]["Align_Ver"] != Convert.DBNull) { ddl_Align_Ver.Value = DS.Tables[0].Rows[0]["Align_Ver"].ToString(); } if (DS.Tables[0].Rows[0]["Title"] != Convert.DBNull) { txt_Title.Text = DS.Tables[0].Rows[0]["Title"].ToString(); } } } protected void Button1_Click(object sender, EventArgs e) { DataSet DS = ClSqlCmd.DataSetSel(@" SELECT [ModuleStyle_ID] FROM [dbo].[__StandardEngine_T_ModuleStyles] where [Module_ID]=" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]); if (DS.Tables.Count < 0 || DS.Tables[0].Rows.Count <= 0) { #region Insert New ModuleStyles ClSqlCmd.CommandExc(@" Insert into [dbo].[__StandardEngine_T_ModuleStyles] ( [ModuleStyle_ID] ,[Module_ID] ) values ( dbo.__StandardEngine_F_MaxID_ModuleStyles()+1 ," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @" )"); #endregion } else { } #region Variables string str_ContentWidth; string str_Title; string str_Align_Ver; #endregion //Get template style text string str_Style_Txt = System.IO.File.ReadAllText(Request.MapPath("") + "/../Templates/Main.css"); str_Style_Txt = str_Style_Txt.Replace("", Request.Params["T"].Trim().Replace("'", "''")); #region update current ModuleStyles str_ContentWidth = ddl_ContentWidth.Value != "" ? ("N'" + ddl_ContentWidth.Value + "'") : "NULL"; str_Align_Ver = ddl_Align_Ver.Value != "" ? ("N'" + ddl_Align_Ver.Value + "'") : "NULL"; str_Title = txt_Title.Text != "" ? ("N'" + txt_Title.Text + "'") : "NULL"; ClSqlCmd.CommandExc(@" update [dbo].[__StandardEngine_T_ModuleStyles] set [ContentWidth]=" + str_ContentWidth + @", [Align_Ver]=" + str_Align_Ver + @", [Title]=" + str_Title + @" where [Module_ID]=" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]); #endregion #region Update Slider width string str_Slider_Skin = System.IO.File.ReadAllText(Request.MapPath("") + "/../AR/res-Slider/skins/plain/quake.skin.css"); str_Slider_Skin = str_Slider_Skin.Replace("990px", ddl_ContentWidth.Value); str_Slider_Skin = str_Slider_Skin.Replace("1000px", ddl_ContentWidth.Value); System.IO.File.WriteAllText(Request.MapPath("") + "/../AR/res-Slider/skins/plain/quake.skin.css", str_Slider_Skin); #endregion #region Update style text str_Style_Txt = str_Style_Txt.Replace("", ddl_ContentWidth.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_ContentWidth.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_Align_Ver.Value); #endregion #region write css files System.IO.File.WriteAllText(Request.MapPath("") + "/../CSS/Main.css", str_Style_Txt); #endregion /////////////////////////////////////////////////////////////////////// if (Request.Params["retP"] != null && Request.Params["retP"] != "") { Response.Redirect(Server.UrlDecode(Request.Params["retP"])); } } }