using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Admin_Border_Style : 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 [ModuleStyle_ID] ,[" + Request.Params["T"].Trim().Replace("'", "''") + @"_BorderMode_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) { DataSet DS_Sub = new DataSet(); if (DS.Tables[0].Rows[0][Request.Params["T"].Trim().Replace("'", "''") + "_BorderMode_ID"] != Convert.DBNull) { #region Get Data DS_Sub = ClSqlCmd.DataSetSel(@" SELECT [BorderMode_ID] ,[Padding] ,[BackColor] ,[Stroke_Size] ,[Stroke_Color] ,[TopBorder_Color] ,[RightBorder_Color] ,[BottomBorder_Color] ,[LeftBorder_Color] ,[TopBorder_Style] ,[RightBorder_Style] ,[BottomBorder_Style] ,[LeftBorder_Style] ,[TopBorder_Size] ,[RightBorder_Size] ,[BottomBorder_Size] ,[LeftBorder_Size] ,[Shadow_Padding_Top] ,[Shadow_Padding_Right] ,[Shadow_Padding_Bottom] ,[Shadow_Padding_Left] ,[Shadow_Hor] ,[Shadow_Vor] ,[Shadow_Blur] ,[Shadow_Color] ,[Curve_Radius] FROM [dbo].[__StandardEngine_T_BorderMode] where [BorderMode_ID]=" + DS.Tables[0].Rows[0][Request.Params["T"].Trim().Replace("'", "''") + "_BorderMode_ID"].ToString()); #endregion #region Set Data if (DS_Sub.Tables.Count > 0 && DS_Sub.Tables[0].Rows.Count > 0) { if (DS_Sub.Tables[0].Rows[0]["Padding"] != Convert.DBNull) ddl_Padding.Value = DS_Sub.Tables[0].Rows[0]["Padding"].ToString(); if (DS_Sub.Tables[0].Rows[0]["BackColor"] != Convert.DBNull) txt_BackColor.Value = DS_Sub.Tables[0].Rows[0]["BackColor"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Stroke_Size"] != Convert.DBNull) ddl_Stroke_Size.Value = DS_Sub.Tables[0].Rows[0]["Stroke_Size"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Stroke_Color"] != Convert.DBNull) txt_Stroke_Color.Value = DS_Sub.Tables[0].Rows[0]["Stroke_Color"].ToString(); if (DS_Sub.Tables[0].Rows[0]["TopBorder_Color"] != Convert.DBNull) txt_TopBorder_Color.Value = DS_Sub.Tables[0].Rows[0]["TopBorder_Color"].ToString(); if (DS_Sub.Tables[0].Rows[0]["RightBorder_Color"] != Convert.DBNull) txt_RightBorder_Color.Value = DS_Sub.Tables[0].Rows[0]["RightBorder_Color"].ToString(); if (DS_Sub.Tables[0].Rows[0]["BottomBorder_Color"] != Convert.DBNull) txt_BottomBorder_Color.Value = DS_Sub.Tables[0].Rows[0]["BottomBorder_Color"].ToString(); if (DS_Sub.Tables[0].Rows[0]["LeftBorder_Color"] != Convert.DBNull) txt_LeftBorder_Color.Value = DS_Sub.Tables[0].Rows[0]["LeftBorder_Color"].ToString(); if (DS_Sub.Tables[0].Rows[0]["TopBorder_Style"] != Convert.DBNull) ddl_TopBorder_Style.Value = DS_Sub.Tables[0].Rows[0]["TopBorder_Style"].ToString(); if (DS_Sub.Tables[0].Rows[0]["RightBorder_Style"] != Convert.DBNull) ddl_RightBorder_Style.Value = DS_Sub.Tables[0].Rows[0]["RightBorder_Style"].ToString(); if (DS_Sub.Tables[0].Rows[0]["BottomBorder_Style"] != Convert.DBNull) ddl_BottomBorder_Style.Value = DS_Sub.Tables[0].Rows[0]["BottomBorder_Style"].ToString(); if (DS_Sub.Tables[0].Rows[0]["LeftBorder_Style"] != Convert.DBNull) ddl_LeftBorder_Style.Value = DS_Sub.Tables[0].Rows[0]["LeftBorder_Style"].ToString(); if (DS_Sub.Tables[0].Rows[0]["TopBorder_Size"] != Convert.DBNull) ddl_TopBorder_Size.Value = DS_Sub.Tables[0].Rows[0]["TopBorder_Size"].ToString(); if (DS_Sub.Tables[0].Rows[0]["RightBorder_Size"] != Convert.DBNull) ddl_RightBorder_Size.Value = DS_Sub.Tables[0].Rows[0]["RightBorder_Size"].ToString(); if (DS_Sub.Tables[0].Rows[0]["BottomBorder_Size"] != Convert.DBNull) ddl_BottomBorder_Size.Value = DS_Sub.Tables[0].Rows[0]["BottomBorder_Size"].ToString(); if (DS_Sub.Tables[0].Rows[0]["LeftBorder_Size"] != Convert.DBNull) ddl_LeftBorder_Size.Value = DS_Sub.Tables[0].Rows[0]["LeftBorder_Size"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Top"] != Convert.DBNull) ddl_Shadow_Padding_Top.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Top"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Right"] != Convert.DBNull) ddl_Shadow_Padding_Right.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Right"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Bottom"] != Convert.DBNull) ddl_Shadow_Padding_Bottom.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Bottom"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Left"] != Convert.DBNull) ddl_Shadow_Padding_Left.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Padding_Left"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Shadow_Hor"] != Convert.DBNull) { ddl_Shadow_Hor.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Hor"].ToString().Replace("-", "").Replace("+", "").Trim(); if (Convert.ToInt32(DS_Sub.Tables[0].Rows[0]["Shadow_Hor"].ToString().Replace("px", "")) < 0) { rbl_Shadow_Hor.SelectedValue = "-"; } else { rbl_Shadow_Hor.SelectedValue = ""; } } if (DS_Sub.Tables[0].Rows[0]["Shadow_Vor"] != Convert.DBNull) { ddl_Shadow_Ver.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Vor"].ToString().Replace("-", "").Replace("+", "").Trim(); if (Convert.ToInt32(DS_Sub.Tables[0].Rows[0]["Shadow_Vor"].ToString().Replace("px", "")) < 0) { rbl_Shadow_Ver.SelectedValue = "-"; } else { rbl_Shadow_Ver.SelectedValue = ""; } } if (DS_Sub.Tables[0].Rows[0]["Shadow_Blur"] != Convert.DBNull) ddl_Shadow_Blur.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Blur"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Shadow_Color"] != Convert.DBNull) txt_Shadow_Color.Value = DS_Sub.Tables[0].Rows[0]["Shadow_Color"].ToString(); if (DS_Sub.Tables[0].Rows[0]["Curve_Radius"] != Convert.DBNull) ddl_Curve_Radius.Value = DS_Sub.Tables[0].Rows[0]["Curve_Radius"].ToString(); } #endregion } } } protected void Button1_Click(object sender, EventArgs e) { DataSet DS = ClSqlCmd.DataSetSel(@" SELECT [ModuleStyle_ID] ,[" + Request.Params["T"].Trim().Replace("'", "''") + @"_BorderMode_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 Update in current ModuleStyles to NULL ClSqlCmd.CommandExc(@" update [dbo].[__StandardEngine_T_ModuleStyles] set [" + Request.Params["T"].Trim().Replace("'", "''") + @"_BorderMode_ID]=NULL where [Module_ID]=" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]); #endregion //////////////////////////////////////////////////////////////////// if (DS.Tables[0].Rows[0][Request.Params["T"].Trim().Replace("'", "''") + "_BorderMode_ID"] != Convert.DBNull) { #region Delete Current ClSqlCmd.CommandExc(@" Delete FROM [dbo].[__StandardEngine_T_BorderMode] where [BorderMode_ID]=" + DS.Tables[0].Rows[0][Request.Params["T"].Trim().Replace("'", "''") + "_BorderMode_ID"].ToString()); #endregion } } #region Variables string str_BorderMode_ID; string str_TopBorder_Size; string str_RightBorder_Size; string str_BottomBorder_Size; string str_LeftBorder_Size; string str_Padding; string str_BackColor; string str_TopBorder_Color; string str_RightBorder_Color; string str_BottomBorder_Color; string str_LeftBorder_Color; string str_TopBorder_Style; string str_RightBorder_Style; string str_BottomBorder_Style; string str_LeftBorder_Style; string str_Stroke_Style; string str_Stroke_Color; string str_Stroke_Size; string str_Shadow_Padding_Top; string str_Shadow_Padding_Right; string str_Shadow_Padding_Bottom; string str_Shadow_Padding_Left; string str_Shadow_Hor; string str_Shadow_Vor; string str_Shadow_Blur; string str_Shadow_Color; string str_Curve_Radius; #endregion //Get template style text string str_Style_Txt = System.IO.File.ReadAllText(Request.MapPath("") + "/../Templates/BorderStyle.css"); str_Style_Txt = str_Style_Txt.Replace("", Request.Params["T"].Trim().Replace("'", "''")); #region Insert _BorderMode_ID str_BorderMode_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_BorderMode()+1").Tables[0].Rows[0][0].ToString(); str_TopBorder_Size = "N'" + ddl_TopBorder_Size.Value + "'"; str_RightBorder_Size = "N'" + ddl_RightBorder_Size.Value + "'"; str_BottomBorder_Size = "N'" + ddl_BottomBorder_Size.Value + "'"; str_LeftBorder_Size = "N'" + ddl_LeftBorder_Size.Value + "'"; str_Padding = "N'" + ddl_Padding.Value + "'"; str_BackColor = "N'" + txt_BackColor.Value + "'"; str_TopBorder_Color = txt_TopBorder_Color.Value != "" ? ("N'" + txt_TopBorder_Color.Value + "'") : "NULL"; str_RightBorder_Color = txt_RightBorder_Color.Value != "" ? ("N'" + txt_RightBorder_Color.Value + "'") : "NULL"; str_BottomBorder_Color = txt_BottomBorder_Color.Value != "" ? ("N'" + txt_BottomBorder_Color.Value + "'") : "NULL"; str_LeftBorder_Color = txt_LeftBorder_Color.Value != "" ? ("N'" + txt_LeftBorder_Color.Value + "'") : "NULL"; str_TopBorder_Style = "N'" + ddl_TopBorder_Style.Value + "'"; str_RightBorder_Style = "N'" + ddl_RightBorder_Style.Value + "'"; str_BottomBorder_Style = "N'" + ddl_BottomBorder_Style.Value + "'"; str_LeftBorder_Style = "N'" + ddl_LeftBorder_Style.Value + "'"; str_Stroke_Style = "N'" + ddl_Stroke_Style.Value + "'"; str_Stroke_Color = "N'" + txt_Stroke_Color.Value + "'"; str_Stroke_Size = "N'" + ddl_Stroke_Size.Value + "'"; str_Shadow_Padding_Top = "N'" + ddl_Shadow_Padding_Top.Value + "'"; str_Shadow_Padding_Right = "N'" + ddl_Shadow_Padding_Right.Value + "'"; str_Shadow_Padding_Bottom = "N'" + ddl_Shadow_Padding_Bottom.Value + "'"; str_Shadow_Padding_Left = "N'" + ddl_Shadow_Padding_Left.Value + "'"; str_Shadow_Hor = "N'" +rbl_Shadow_Hor.SelectedValue + ddl_Shadow_Hor.Value + "'"; str_Shadow_Vor = "N'" + rbl_Shadow_Ver.SelectedValue + ddl_Shadow_Ver.Value + "'"; str_Shadow_Blur = "N'" + ddl_Shadow_Blur.Value + "'"; str_Shadow_Color = "N'" + txt_Shadow_Color.Value + "'"; str_Curve_Radius = "N'" + ddl_Curve_Radius.Value + "'"; ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_BorderMode] ([BorderMode_ID] ,[TopBorder_Size] ,[RightBorder_Size] ,[BottomBorder_Size] ,[LeftBorder_Size] ,[Padding] ,[BackColor] ,[TopBorder_Color] ,[RightBorder_Color] ,[BottomBorder_Color] ,[LeftBorder_Color] ,[TopBorder_Style] ,[RightBorder_Style] ,[BottomBorder_Style] ,[LeftBorder_Style] ,[Stroke_Style] ,[Stroke_Color] ,[Stroke_Size] ,[Shadow_Padding_Top] ,[Shadow_Padding_Right] ,[Shadow_Padding_Bottom] ,[Shadow_Padding_Left] ,[Shadow_Hor] ,[Shadow_Vor] ,[Shadow_Blur] ,[Shadow_Color] ,[Curve_Radius] ) VALUES ( " + str_BorderMode_ID + @", " + str_TopBorder_Size + @", " + str_RightBorder_Size + @", " + str_BottomBorder_Size + @", " + str_LeftBorder_Size + @", " + str_Padding + @", " + str_BackColor + @", " + str_TopBorder_Color + @", " + str_RightBorder_Color + @", " + str_BottomBorder_Color + @", " + str_LeftBorder_Color + @", " + str_TopBorder_Style + @", " + str_RightBorder_Style + @", " + str_BottomBorder_Style + @", " + str_LeftBorder_Style + @", " + str_Stroke_Style + @", " + str_Stroke_Color + @", " + str_Stroke_Size + @", " + str_Shadow_Padding_Top + @", " + str_Shadow_Padding_Right + @", " + str_Shadow_Padding_Bottom + @", " + str_Shadow_Padding_Left + @", " + str_Shadow_Hor + @", " + str_Shadow_Vor + @", " + str_Shadow_Blur + @", " + str_Shadow_Color + @", " + str_Curve_Radius + @" )"); #region Update style text str_Style_Txt = str_Style_Txt.Replace("", txt_BackColor.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_Padding.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_TopBorder_Style.Value + " " + ddl_TopBorder_Size.Value + " " + txt_TopBorder_Color.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_RightBorder_Style.Value + " " + ddl_RightBorder_Size.Value + " " + txt_RightBorder_Color.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_BottomBorder_Style.Value + " " + ddl_BottomBorder_Size.Value + " " + txt_BottomBorder_Color.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_LeftBorder_Style.Value + " " + ddl_LeftBorder_Size.Value + " " + txt_LeftBorder_Color.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_Stroke_Style.Value + " " + ddl_Stroke_Size.Value + " " + txt_Stroke_Color.Value); str_Style_Txt = str_Style_Txt.Replace("", rbl_Shadow_Hor.SelectedValue + ddl_Shadow_Hor.Value); str_Style_Txt = str_Style_Txt.Replace("", rbl_Shadow_Ver.SelectedValue + ddl_Shadow_Ver.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_Shadow_Blur.Value); str_Style_Txt = str_Style_Txt.Replace("", txt_Shadow_Color.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_Curve_Radius.Value); str_Style_Txt = str_Style_Txt.Replace("", ddl_Shadow_Padding_Top.Value + " " + ddl_Shadow_Padding_Right.Value + " " + ddl_Shadow_Padding_Bottom.Value + " " + ddl_Shadow_Padding_Left.Value); #endregion #endregion #region update current ModuleStyles ClSqlCmd.CommandExc(@" update [dbo].[__StandardEngine_T_ModuleStyles] set [" + Request.Params["T"].Trim().Replace("'", "''") + @"_BorderMode_ID]=" + str_BorderMode_ID + @" where [Module_ID]=" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]); #endregion #region write css files System.IO.File.WriteAllText(Request.MapPath("") + "/../CSS/" + Request.Params["T"].Trim().Replace("'", "") + ".css", str_Style_Txt); #endregion /////////////////////////////////////////////////////////////////////// if (Request.Params["retP"] != null && Request.Params["retP"] != "") { Response.Redirect(Server.UrlDecode(Request.Params["retP"])); } } }