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_InitiateModule : System.Web.UI.Page { DBAccess.DBAccess ClSqlCmd; public void Page_Load(object sender, EventArgs e) { string str_EditorPage = ""; /////////////////////////////////////////////////////////////////////////// ClSqlCmd = new DBAccess.DBAccess(System.Configuration.ConfigurationSettings.AppSettings["SE_ConnectionString"]); #region Insert Header EdiorPages str_EditorPage = ClSqlCmd.DataSetSel(@" select dbo.__StandardEngine_F_MaxID_EditorPages()+1").Tables[0].Rows[0][0].ToString(); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ( [EditorPage_ID] ,[EditorPage_Type_ID] ,[Module_ID] ) VALUES ( " + str_EditorPage+@" ,1001 ," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @" )"); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ( [EditorPage_ID] ,[Parent_EditorPage_ID] ,[IsStartPage] ,[EditorPage_Type_ID] ,[Order] ,[Module_ID] ) VALUES ( dbo.__StandardEngine_F_MaxID_EditorPages()+1 ," + str_EditorPage+@" ,1 ,7 ,1 ," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @" )"); #endregion #region Insert Footer EdiorPages str_EditorPage = ClSqlCmd.DataSetSel(@" select dbo.__StandardEngine_F_MaxID_EditorPages()+1").Tables[0].Rows[0][0].ToString(); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ( [EditorPage_ID] ,[EditorPage_Type_ID] ,[Module_ID] ) VALUES ( " + str_EditorPage + @" ,2001 ," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @" )"); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ( [EditorPage_ID] ,[Parent_EditorPage_ID] ,[IsStartPage] ,[EditorPage_Type_ID] ,[Order] ,[Module_ID] ) VALUES ( dbo.__StandardEngine_F_MaxID_EditorPages()+1 ," + str_EditorPage + @" ,1 ,7 ,1 ," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @" )"); #endregion #region Insert Group #region Variables string str_Group_ID; string str_GroupName; string str_Module_ID; string str_Order; string str_UpperMenu_Name; string str_FooterMenu_Name; string str_Active; string str_EditorPage_ID_Main; string str_EditorPage_ID; string str_LinkHref_ID; string str_LinkHref_Href; string str_LinkHref_Target; string str_Link_ID; string str_Text; #endregion #region Insert str_Group_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_Groups()+1").Tables[0].Rows[0][0].ToString(); str_GroupName = "N'الصفحة الرئيسية'"; str_Module_ID = System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]; str_Order = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxOrder_Groups(" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + ")+1").Tables[0].Rows[0][0].ToString(); str_UpperMenu_Name = str_GroupName; str_FooterMenu_Name = str_GroupName; str_Active = "1"; ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_Groups] ([Group_ID] ,[GroupName] ,[Module_ID] ,[Order] ,[UpperMenu_Name] ,[FooterMenu_Name] ,[Active]) VALUES ( " + str_Group_ID + @", " + str_GroupName + @", " + str_Module_ID + @", " + str_Order + @", " + str_UpperMenu_Name + @", " + str_FooterMenu_Name + @", " + str_Active + @" )"); //insert editor page for group str_EditorPage_ID_Main = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_EditorPages()+1").Tables[0].Rows[0][0].ToString(); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ([EditorPage_ID] ,[PageName] ,[IsStartPage] ,[Module_ID] ,[Group_ID]) VALUES (" + str_EditorPage_ID_Main + @" , N'" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @"-الصفحة الرئيسية', 1, " + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @", " + str_Group_ID + @" )" ); #endregion //if (cb_UpperMenu_Name.Checked) //{ #region Insert Upper Menu #region Insert Editorpage //insert editor page for group str_EditorPage_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_EditorPages()+1").Tables[0].Rows[0][0].ToString(); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ([EditorPage_ID] ,[Module_ID] ,[Parent_EditorPage_ID] ,[EditorPage_Type_ID] ,[Group_ID]) VALUES (" + str_EditorPage_ID + @" , " + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @", [dbo].[__StandardEngine_F_EditorPage__Type](1001," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @"), 9, " + str_Group_ID + @" )" ); #endregion #region Insert LinkHref_ID str_LinkHref_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_LinkHref()+1").Tables[0].Rows[0][0].ToString(); str_LinkHref_Href = "N'Page.aspx?ID=" + str_EditorPage_ID_Main + "'"; str_LinkHref_Target = "N'_self'"; ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_LinkHref] ([LinkHref_ID] ,[LinkHref_Href] ,[LinkHref_Target]) VALUES ( " + str_LinkHref_ID + @", " + str_LinkHref_Href + @", " + str_LinkHref_Target + @" )"); #endregion #region Insert Link str_Link_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_Link()+1").Tables[0].Rows[0][0].ToString(); str_Text = str_GroupName; ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_Link] ([Link_ID] ,[Text] ,[Class] ,[LinkHref_ID] ,[EditorPage_ID] ,[Order]) VALUES (" + str_Link_ID + @" ," + str_Text + @" ," + "N'UpperMenu_Menu'" + @" ," + str_LinkHref_ID + @" ," + str_EditorPage_ID + @" ,1)" ); #endregion #endregion //} //if (cb_FooterMenu_Name.Checked) //{ #region Insert Footer Menu #region Insert Editorpage //insert editor page for group str_EditorPage_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_EditorPages()+1").Tables[0].Rows[0][0].ToString(); ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_EditorPages] ([EditorPage_ID] ,[Module_ID] ,[Parent_EditorPage_ID] ,[EditorPage_Type_ID] ,[Group_ID]) VALUES (" + str_EditorPage_ID + @" , " + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @", [dbo].[__StandardEngine_F_EditorPage__Type](2001," + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"] + @"), 9, " + str_Group_ID + @" )" ); #endregion #region Insert LinkHref_ID str_LinkHref_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_LinkHref()+1").Tables[0].Rows[0][0].ToString(); str_LinkHref_Href = "N'Page.aspx?ID=" + str_EditorPage_ID_Main + "'"; str_LinkHref_Target = "N'_self'"; ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_LinkHref] ([LinkHref_ID] ,[LinkHref_Href] ,[LinkHref_Target]) VALUES ( " + str_LinkHref_ID + @", " + str_LinkHref_Href + @", " + str_LinkHref_Target + @" )"); #endregion #region Insert Link str_Link_ID = ClSqlCmd.DataSetSel("select dbo.__StandardEngine_F_MaxID_Link()+1").Tables[0].Rows[0][0].ToString(); str_Text = str_GroupName; ClSqlCmd.CommandExc(@" INSERT INTO [dbo].[__StandardEngine_T_Link] ([Link_ID] ,[Text] ,[Class] ,[LinkHref_ID] ,[EditorPage_ID] ,[Order]) VALUES (" + str_Link_ID + @" ," + str_Text + @" ," + "N'FooterMenu_Menu'" + @" ," + str_LinkHref_ID + @" ," + str_EditorPage_ID + @" ,1)" ); #endregion #endregion //} /////////////////////////////////////////////////////////////////////// #endregion #region Set Start Group 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_Start_Group_ID; #endregion #region update current ModuleStyles str_Start_Group_ID = str_Group_ID; ClSqlCmd.CommandExc(@" update [dbo].[__StandardEngine_T_ModuleStyles] set [Start_Group_ID]=" + str_Start_Group_ID + @" where [Module_ID]=" + System.Configuration.ConfigurationSettings.AppSettings["SE_ModuleID"]); #endregion #endregion if (Request.Params["retP"] != null && Request.Params["retP"] != "") { Response.Redirect(Server.UrlDecode(Request.Params["retP"])); } } }