/// <summary> /// Connect to database and obtain user module details. /// </summary> /// <param name="UserModuleID">UserModuleID</param> /// <param name="PortalID"></param> /// <returns>Object of UserModuleInfo class.</returns> public static UserModuleInfo GetUserModuleDetails(int UserModuleID, int PortalID) { UserModuleInfo objUserModule = new UserModuleInfo(); string StoredProcedureName = "[dbo].[usp_UserModulesGetDetails]"; List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "@UserModuleID", UserModuleID), new KeyValuePair <string, object>( "@PortalID", PortalID) }; try { SQLHandler sagesql = new SQLHandler(); objUserModule = sagesql.ExecuteAsObject <UserModuleInfo>(StoredProcedureName, ParaMeterCollection); objUserModule.LSTUserModulePermission = GetModulePermission(UserModuleID, PortalID); } catch (Exception e) { throw e; } return(objUserModule); }
private void AssignModuletoPage(ModuleInfo moduleinfo_) { if (moduleinfo_.ModuleDefID > 0) { UserModuleInfo objModuleInfo = GetModuleInfo(moduleinfo_); objModuleInfo.UserModuleID = 0; objModuleInfo.ModuleDefID = moduleinfo_.ModuleDefID; SageFrame.ModuleManager.Controller.ModuleController.AddUserModule(objModuleInfo); } }
/// <summary> /// Update user modules. /// </summary> /// <param name="module">Object of UserModuleInfo class.</param> public static void UpdateUserModule(UserModuleInfo module) { try { ModuleDataProvider.UpdateUserModule(module); } catch (Exception) { throw; } }
/// <summary> /// Add user module. /// </summary> /// <param name="usermodule"></param> /// <returns>Object of UserModuleInfo class.</returns> public static string AddUserModule(UserModuleInfo usermodule) { try { ModuleDataProvider mod = new ModuleDataProvider(); return(mod.AddUserModule(usermodule)); } catch (Exception) { throw; } }
public void SetPageModules(UserModuleInfo module, OracleTransaction tran, int UserModuleID, int PortalID, string AddedBy) { try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "PageID", module.PageID), new KeyValuePair <string, object>( "UserModuleID", UserModuleID), new KeyValuePair <string, object>( "PaneName", module.PaneName), new KeyValuePair <string, object>( "ModuleOrder", module.ModuleOrder), new KeyValuePair <string, object>( "CacheTime", module.CacheTime), new KeyValuePair <string, object>( "Alignment", module.Alignment), new KeyValuePair <string, object>( "Color", module.Color), new KeyValuePair <string, object>( "Border", ""), new KeyValuePair <string, object>( "IconFile", "none"), new KeyValuePair <string, object>( "Visibility", true), new KeyValuePair <string, object>( "IsActive", true), new KeyValuePair <string, object>( "AddedOn", DateTime.Now), new KeyValuePair <string, object>( "PortalID", PortalID), new KeyValuePair <string, object>( "AddedBy", AddedBy) }; //SQLHandler sqlH = new SQLHandler(); OracleHandler sqlH = new OracleHandler(); sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "usp_PageModulesAdd", ParaMeterCollection); } catch (Exception ex) { throw ex; } }
/// <summary> /// Connect to database and set page modules. /// </summary> /// <param name="module">Object of UserModuleInfo class.</param> /// <param name="tran">Object of SqlTransaction class.</param> /// <param name="UserModuleID">UserModuleID</param> /// <param name="PortalID">PortalID</param> /// <param name="AddedBy">User name.</param> public void SetPageModules(UserModuleInfo module, SqlTransaction tran, int UserModuleID, int PortalID, string AddedBy) { try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "@PageID", module.PageID), new KeyValuePair <string, object>( "@UserModuleID", UserModuleID), new KeyValuePair <string, object>( "@PaneName", module.PaneName), new KeyValuePair <string, object>( "@ModuleOrder", module.ModuleOrder), new KeyValuePair <string, object>( "@CacheTime", module.CacheTime), new KeyValuePair <string, object>( "@Alignment", module.Alignment), new KeyValuePair <string, object>( "@Color", module.Color), new KeyValuePair <string, object>( "@Border", ""), new KeyValuePair <string, object>( "@IconFile", "none"), new KeyValuePair <string, object>( "@Visibility", true), new KeyValuePair <string, object>( "@IsActive", true), new KeyValuePair <string, object>( "@AddedOn", DateTimeHelper.GetUtcTime(DateTime.Now)), new KeyValuePair <string, object>( "@PortalID", PortalID), new KeyValuePair <string, object>( "@AddedBy", AddedBy) }; SQLHandler sqlH = new SQLHandler(); sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_PageModulesAdd]", ParaMeterCollection); } catch (Exception ex) { throw ex; } }
/// <summary> /// Connect to database and update user module. /// </summary> /// <param name="module">Object of UserModuleInfo class.</param> public static void UpdateUserModule(UserModuleInfo module) { SQLHandler sqlH = new SQLHandler(); SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction(); try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "@UserModuleID", module.UserModuleID), new KeyValuePair <string, object>( "@ModuleDefID", module.ModuleDefID), new KeyValuePair <string, object>( "@UserModuleTitle", module.UserModuleTitle), new KeyValuePair <string, object>( "@AllPages", module.AllPages), new KeyValuePair <string, object>( "@ShowInPages", module.ShowInPages), new KeyValuePair <string, object>( "@InheritViewPermissions", module.InheritViewPermissions), new KeyValuePair <string, object>( "@IsActive", module.IsActive), new KeyValuePair <string, object>( "@AddedOn", DateTimeHelper.GetUtcTime(DateTime.Now)), new KeyValuePair <string, object>( "@PortalID", module.PortalID), new KeyValuePair <string, object>( "@AddedBy", module.PortalID), new KeyValuePair <string, object>( "@SEOName", module.SEOName), new KeyValuePair <string, object>( "@IsHandheld", module.IsHandheld), new KeyValuePair <string, object>( "@SuffixClass", module.SuffixClass), new KeyValuePair <string, object>( "@HeaderText", module.HeaderText), new KeyValuePair <string, object>( "@ShowHeaderText", module.ShowHeaderText) }; sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_UserModulesUpdate]", ParaMeterCollection); if (module.InheritViewPermissions) { UpdateUserModuleInheritedPermission(module.PageID, tran, module.UserModuleID, module.PortalID, module.AddedBy, module.ModuleDefID); } else { UpdateUserModulePermission(module.LSTUserModulePermission, tran, module.UserModuleID, module.PortalID, module.AddedBy, module.ModuleDefID); } tran.Commit(); } catch (SqlException sqlEx) { tran.Rollback(); throw sqlEx; } catch (Exception ex) { throw ex; } }
/// <summary> /// Connect to database and add user module. /// </summary> /// <param name="module">Object of UserModuleInfo class.</param> /// <returns>Newly added user module ID.</returns> public string AddUserModule(UserModuleInfo module) { SageFrameSQLHelper sqlH = new SageFrameSQLHelper(); SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction(); try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "@ModuleDefID", module.ModuleDefID), new KeyValuePair <string, object>( "@UserModuleTitle", module.UserModuleTitle), new KeyValuePair <string, object>( "@AllPages", module.AllPages), new KeyValuePair <string, object>( "@ShowInPages", module.ShowInPages), new KeyValuePair <string, object>( "@InheritViewPermissions", module.InheritViewPermissions), new KeyValuePair <string, object>( "@IsActive", module.IsActive), new KeyValuePair <string, object>( "@AddedOn", DateTimeHelper.GetUtcTime(DateTime.Now)), new KeyValuePair <string, object>( "@PortalID", module.PortalID), new KeyValuePair <string, object>( "@AddedBy", module.PortalID), new KeyValuePair <string, object>( "@SEOName", module.SEOName), new KeyValuePair <string, object>( "@IsHandheld", module.IsHandheld), new KeyValuePair <string, object>( "@SuffixClass", module.SuffixClass), new KeyValuePair <string, object>( "@HeaderText", module.HeaderText), new KeyValuePair <string, object>( "@ShowHeaderText", module.ShowHeaderText), new KeyValuePair <string, object>( "@IsInAdmin", module.IsInAdmin) }; List <KeyValuePair <string, object> > ParaMeterInputCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "@UserModuleID", 0), new KeyValuePair <string, object>( "@ControlCount", 0) }; List <KeyValuePair <int, string> > resultColl = new List <KeyValuePair <int, string> >(); try { resultColl = sqlH.ExecuteNonQueryWithMultipleOutput(tran, CommandType.StoredProcedure, "[dbo].[usp_UserModulesAdd]", ParaMeterCollection, ParaMeterInputCollection); } catch (Exception ex) { } if (int.Parse(resultColl[0].Value) > 0) { if (module.InheritViewPermissions) { //if (module.IsInAdmin) //{ // module.PortalID = -1; //} SetUserModuleInheritedPermission(module.PageID, tran, int.Parse(resultColl[0].Value), module.PortalID, module.AddedBy, module.ModuleDefID); } else { SetUserModulePermission(module.LSTUserModulePermission, tran, int.Parse(resultColl[0].Value), module.PortalID, module.AddedBy, module.ModuleDefID); } if (module.IsInAdmin) { module.PortalID = -1; } SetPageModules(module, tran, int.Parse(resultColl[0].Value), module.PortalID, module.AddedBy); } tran.Commit(); return(string.Format("{0}_{1}", resultColl[0].Value.ToString(), resultColl[1].Value.ToString())); } catch (SqlException sqlEx) { tran.Rollback(); throw sqlEx; } catch (Exception ex) { throw ex; } }
public static void UpdateUserModule(UserModuleInfo module) { SQLHandler sqlH = new SQLHandler(); SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction(); try { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>( "@UserModuleID", module.UserModuleID), new KeyValuePair<string, object>( "@ModuleDefID", module.ModuleDefID), new KeyValuePair<string, object>( "@UserModuleTitle", module.UserModuleTitle), new KeyValuePair<string, object>( "@AllPages", module.AllPages), new KeyValuePair<string, object>( "@ShowInPages", module.ShowInPages), new KeyValuePair<string, object>( "@InheritViewPermissions", module.InheritViewPermissions), new KeyValuePair<string, object>( "@IsActive", module.IsActive), new KeyValuePair<string, object>( "@AddedOn", DateTime.Now), new KeyValuePair<string, object>( "@PortalID", module.PortalID), new KeyValuePair<string, object>( "@AddedBy", module.PortalID), new KeyValuePair<string, object>( "@SEOName", module.SEOName), new KeyValuePair<string,object>( "@IsHandheld",module.IsHandheld), new KeyValuePair<string,object>( "@SuffixClass",module.SuffixClass), new KeyValuePair<string,object>( "@HeaderText",module.HeaderText), new KeyValuePair<string,object>( "@ShowHeaderText",module.ShowHeaderText) }; sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_UserModulesUpdate]", ParaMeterCollection); if (module.InheritViewPermissions) { UpdateUserModuleInheritedPermission(module.PageID, tran, module.UserModuleID, module.PortalID, module.AddedBy, module.ModuleDefID); } else { UpdateUserModulePermission(module.LSTUserModulePermission, tran, module.UserModuleID, module.PortalID, module.AddedBy, module.ModuleDefID); } tran.Commit(); } catch (SqlException sqlEx) { tran.Rollback(); throw sqlEx; } catch (Exception ex) { throw ex; } }
public string AddUserModule(UserModuleInfo module) { SageFrameSQLHelper sqlH = new SageFrameSQLHelper(); SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction(); try { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>( "@ModuleDefID", module.ModuleDefID), new KeyValuePair<string, object>( "@UserModuleTitle", module.UserModuleTitle), new KeyValuePair<string, object>( "@AllPages", module.AllPages), new KeyValuePair<string, object>( "@ShowInPages", module.ShowInPages), new KeyValuePair<string, object>( "@InheritViewPermissions", module.InheritViewPermissions), new KeyValuePair<string, object>( "@IsActive", module.IsActive), new KeyValuePair<string, object>( "@AddedOn", DateTime.Now), new KeyValuePair<string, object>( "@PortalID", module.PortalID), new KeyValuePair<string, object>( "@AddedBy", module.PortalID), new KeyValuePair<string, object>( "@SEOName", module.SEOName), new KeyValuePair<string,object>( "@IsHandheld",module.IsHandheld), new KeyValuePair<string,object>( "@SuffixClass",module.SuffixClass), new KeyValuePair<string,object>( "@HeaderText",module.HeaderText), new KeyValuePair<string,object>( "@ShowHeaderText",module.ShowHeaderText), new KeyValuePair<string,object>( "@IsInAdmin",module.IsInAdmin) }; List<KeyValuePair<string, object>> ParaMeterInputCollection = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>( "@UserModuleID", 0), new KeyValuePair<string, object>( "@ControlCount", 0) }; List<KeyValuePair<int, string>> resultColl = new List<KeyValuePair<int, string>>(); resultColl = sqlH.ExecuteNonQueryWithMultipleOutput(tran, CommandType.StoredProcedure, "[dbo].[usp_UserModulesAdd]", ParaMeterCollection, ParaMeterInputCollection); if (int.Parse(resultColl[0].Value) > 0) { if (module.InheritViewPermissions) { //if (module.IsInAdmin) //{ // module.PortalID = -1; //} SetUserModuleInheritedPermission(module.PageID, tran, int.Parse(resultColl[0].Value), module.PortalID, module.AddedBy, module.ModuleDefID); } else { SetUserModulePermission(module.LSTUserModulePermission, tran, int.Parse(resultColl[0].Value), module.PortalID, module.AddedBy, module.ModuleDefID); } if(module.IsInAdmin) { module.PortalID = -1; } SetPageModules(module, tran, int.Parse(resultColl[0].Value), module.PortalID, module.AddedBy); } tran.Commit(); return (string.Format("{0}_{1}", resultColl[0].Value.ToString(), resultColl[1].Value.ToString())); } catch (SqlException sqlEx) { tran.Rollback(); throw sqlEx; } catch (Exception ex) { throw ex; } }
public static UserModuleInfo GetUserModuleDetails(int UserModuleID, int PortalID) { UserModuleInfo objUserModule = new UserModuleInfo(); string StoredProcedureName = "[dbo].[usp_UserModulesGetDetails]"; List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>( "@UserModuleID", UserModuleID), new KeyValuePair<string, object>( "@PortalID",PortalID) }; try { SQLHandler sagesql = new SQLHandler(); objUserModule = sagesql.ExecuteAsObject<UserModuleInfo>(StoredProcedureName, ParaMeterCollection); objUserModule.LSTUserModulePermission = GetModulePermission(UserModuleID, PortalID); } catch (Exception e) { throw e; } return objUserModule; }
public void SetPageModules(UserModuleInfo module, SqlTransaction tran, int UserModuleID, int PortalID, string AddedBy) { try { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>( "@PageID", module.PageID), new KeyValuePair<string, object>( "@UserModuleID",UserModuleID), new KeyValuePair<string, object>( "@PaneName",module.PaneName), new KeyValuePair<string, object>( "@ModuleOrder", module.ModuleOrder), new KeyValuePair<string, object>( "@CacheTime",module.CacheTime), new KeyValuePair<string, object>( "@Alignment", module.Alignment), new KeyValuePair<string, object>( "@Color", module.Color), new KeyValuePair<string, object>( "@Border", ""), new KeyValuePair<string, object>( "@IconFile", "none"), new KeyValuePair<string, object>( "@Visibility", true), new KeyValuePair<string, object>( "@IsActive", true), new KeyValuePair<string, object>( "@AddedOn", DateTime.Now), new KeyValuePair<string, object>( "@PortalID",PortalID), new KeyValuePair<string, object>( "@AddedBy", AddedBy) }; SQLHandler sqlH = new SQLHandler(); sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_PageModulesAdd]", ParaMeterCollection); } catch (Exception ex) { throw ex; } }
private UserModuleInfo GetModuleInfo(ModuleInfo objModuleInfo) { UserModuleInfo objModuleInfo_ = new UserModuleInfo(); string pageNames = string.Empty; string usermodules = string.Empty; string templateName = TemplateName; string templatePath = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName); string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath); if (File.Exists(authorDetailPath)) { XmlDocument doc = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath); XmlNode node = doc.SelectSingleNode("themedetail/notinstallmoduleList"); string pageModuleList = string.Empty; if (node != null) { int notinstallModule = 0; XmlNodeList nodeListList = doc.GetElementsByTagName("notinstallmodules"); notinstallModule = nodeListList.Count; if (notinstallModule > 0) { foreach (XmlNode xn in nodeListList) { XmlNode newNode = xn.SelectSingleNode("ModuleName"); if (newNode != null) { if (newNode.InnerText == objModuleInfo.ModuleName) { newNode = xn.SelectSingleNode("UserModuleTitle"); if (newNode != null) { objModuleInfo_.UserModuleTitle = newNode.InnerText; } else { objModuleInfo_.UserModuleTitle = string.Empty; } newNode = xn.SelectSingleNode("AllPages"); if (newNode != null) { bool allpages = false; bool.TryParse(newNode.InnerText, out allpages); objModuleInfo_.AllPages = allpages; } else { objModuleInfo_.AllPages = false; } newNode = xn.SelectSingleNode("ShowInPages"); if (newNode != null) { objModuleInfo_.ShowInPages = newNode.InnerText; } else { objModuleInfo_.ShowInPages = string.Empty; } objModuleInfo_.InheritViewPermissions = true; objModuleInfo_.IsActive = true; objModuleInfo_.SEOName = objModuleInfo.ModuleName.Replace(" ", "_"); newNode = xn.SelectSingleNode("NewPageID"); if (newNode != null) { objModuleInfo_.PageID = int.Parse(newNode.InnerText); } else { objModuleInfo_.PageID = 0; } newNode = xn.SelectSingleNode("PaneName"); if (newNode != null) { objModuleInfo_.PaneName = newNode.InnerText; } else { objModuleInfo_.PaneName = string.Empty; } newNode = xn.SelectSingleNode("ModuleOrder"); if (newNode != null) { objModuleInfo_.ModuleOrder = int.Parse(newNode.InnerText); } else { objModuleInfo_.ModuleOrder = 0; } objModuleInfo_.CacheTime = "10"; objModuleInfo_.Alignment = "test"; objModuleInfo_.Color = "black"; objModuleInfo_.Visibility = true; objModuleInfo_.PortalID = GetPortalID; objModuleInfo_.IsHandheld = false; newNode = xn.SelectSingleNode("SuffixClass"); if (newNode != null) { objModuleInfo_.SuffixClass = newNode.InnerText; } else { objModuleInfo_.SuffixClass = string.Empty; } newNode = xn.SelectSingleNode("HeaderText"); if (newNode != null) { objModuleInfo_.HeaderText = newNode.InnerText; } else { objModuleInfo_.HeaderText = string.Empty; } newNode = xn.SelectSingleNode("ShowHeaderText"); if (newNode != null) { bool showHeaderText = false; bool.TryParse(newNode.InnerText, out showHeaderText); objModuleInfo_.ShowHeaderText = showHeaderText; } else { objModuleInfo_.ShowHeaderText = false; } objModuleInfo_.AddedBy = GetUsername; objModuleInfo_.LSTUserModulePermission = null; objModuleInfo_.IsInAdmin = false; xn.ParentNode.RemoveChild(xn); doc.Save(authorDetailPath); break; } } } } } } return(objModuleInfo_); }