public static List <MenuInfo> GetSideMenu(int PortalID, string UserName, string PageName, string CultureCode)
        {
            List <MenuInfo> lstPages            = new List <MenuInfo>();
            string          StoredProcedureName = "[dbo].[usp_SageMenuGetSideMenu]";
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", UserName));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@PageName", PageName));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@CultureCode", CultureCode));
            SqlDataReader SQLReader;

            try
            {
                SQLHandler sagesql = new SQLHandler();
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (SQLReader.Read())
            {
                MenuInfo objMenu = new MenuInfo();
                objMenu.PageID    = int.Parse(SQLReader["PageID"].ToString());
                objMenu.PageOrder = int.Parse(SQLReader["PageOrder"].ToString());
                objMenu.PageName  = SQLReader["PageName"].ToString();
                objMenu.ParentID  = int.Parse(SQLReader["ParentID"].ToString());
                objMenu.Level     = int.Parse(SQLReader["Level"].ToString());
                objMenu.TabPath   = SQLReader["TabPath"].ToString();
                lstPages.Add(objMenu);
            }
            return(lstPages);
        }
        public static List <MenuInfo> GetMenuFront(int PortalID, string UserName, string CultureCode)
        {
            List <MenuInfo> lstPages            = new List <MenuInfo>();
            string          StoredProcedureName = "[dbo].[usp_SageMenuGetClientView]";
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@prefix", "---"));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@IsDeleted", 0));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", UserName));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@CultureCode", CultureCode));
            SqlDataReader SQLReader;

            try
            {
                SQLHandler sagesql = new SQLHandler();
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (SQLReader.Read())
            {
                lstPages.Add(new MenuInfo(int.Parse(SQLReader["PageID"].ToString()), int.Parse(SQLReader["PageOrder"].ToString()), SQLReader["PageName"].ToString(), int.Parse(SQLReader["ParentID"].ToString()), int.Parse(SQLReader["Level"].ToString()), SQLReader["LevelPageName"].ToString(), SQLReader["SEOName"].ToString(), SQLReader["TabPath"].ToString(), bool.Parse(SQLReader["IsVisible"].ToString()), bool.Parse(SQLReader["ShowInMenu"].ToString())));
            }
            return(lstPages);
        }
        public static List <Language> GetAvailableLocales()
        {
            List <Language> lstAvailableLocales = new List <Language>();
            string          StoredProcedureName = "sp_LanguageGet";
            SqlDataReader   SQLReader;

            try
            {
                SqlConnection SQLConn = new SqlConnection(SystemSetting.SageFrameConnectionString);
                SqlCommand    SQLCmd  = new SqlCommand();
                SQLCmd.Connection  = SQLConn;
                SQLCmd.CommandText = StoredProcedureName;
                SQLCmd.CommandType = CommandType.StoredProcedure;
                SQLConn.Open();
                SQLReader = SQLCmd.ExecuteReader();
            }
            catch (Exception e)
            {
                throw e;
            }

            while (SQLReader.Read())
            {
                Language obj = new Language(int.Parse(SQLReader["LanguageID"].ToString()), SQLReader["CultureName"].ToString(), SQLReader["CultureCode"].ToString());
                obj.LanguageN = SQLReader["CultureName"].ToString();
                obj.Country   = SQLReader["CultureName"].ToString();
                lstAvailableLocales.Add(obj);
            }
            SQLReader.Close();
            return(lstAvailableLocales);
        }
        public static List <LanguageSwitchKeyValue> GetLanguageSwitchSettings(int portalId, int UserModuleID)
        {
            List <LanguageSwitchKeyValue>         lstSettings         = new List <LanguageSwitchKeyValue>();
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalId));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", UserModuleID));
            string        StoredProcedureName = "usp_loc_GetLanguageSwitchSettings";
            SqlDataReader SQLReader;

            try
            {
                SQLHandler sagesql = new SQLHandler();
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
            while (SQLReader.Read())
            {
                lstSettings.Add(new LanguageSwitchKeyValue(SQLReader["SettingKey"].ToString(), SQLReader["SettingValue"].ToString()));
            }
            SQLReader.Close();
            return(lstSettings);
        }
        public static List <Language> GetPortalLanguages(int portalId)
        {
            List <Language> lstPortalLanguages = new List <Language>();
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalId));
            string        StoredProcedureName = "usp_loc_PortalLanguagesGet";
            SqlDataReader SQLReader;

            try
            {
                SQLHandler sagesql = new SQLHandler();
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
            while (SQLReader.Read())
            {
                Language obj = new Language(int.Parse(SQLReader["LanguageID"].ToString()), SQLReader["CultureName"].ToString(), SQLReader["CultureCode"].ToString());
                obj.LanguageN = SQLReader["CultureName"].ToString();
                obj.Country   = SQLReader["CultureName"].ToString();
                lstPortalLanguages.Add(obj);
            }
            SQLReader.Close();
            return(lstPortalLanguages);
        }
        public static List <ModuleInfo> GetCoreModules()
        {
            List <ModuleInfo> lstCoreModules      = new List <ModuleInfo>();
            string            StoredProcedureName = "usp_loc_CoreModulesGet";
            SqlDataReader     SQLReader;

            try
            {
                SqlConnection SQLConn = new SqlConnection(SystemSetting.SageFrameConnectionString);
                SqlCommand    SQLCmd  = new SqlCommand();
                SQLCmd.Connection  = SQLConn;
                SQLCmd.CommandText = StoredProcedureName;
                SQLCmd.CommandType = CommandType.StoredProcedure;
                SQLConn.Open();
                SQLReader = SQLCmd.ExecuteReader();
            }
            catch (Exception e)
            {
                throw e;
            }

            while (SQLReader.Read())
            {
                ModuleInfo obj = new ModuleInfo();
                obj.ModuleID   = int.Parse(SQLReader["ModuleID"].ToString());
                obj.ModuleName = SQLReader["ModuleName"].ToString();
                lstCoreModules.Add(obj);
            }
            SQLReader.Close();
            return(lstCoreModules);
        }
Esempio n. 7
0
        public static List <Roles> GetAllRoles(int portalID, bool isAll, string userName)
        {
            List <Roles> lstRoles            = new List <Roles>();
            string       StoredProcedureName = "sp_PortalRoleList";
            SQLHandler   sagesql             = new SQLHandler();
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalID));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@IsAll", isAll));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", userName));

            SqlDataReader SQLReader;

            try
            {
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
                while (SQLReader.Read())
                {
                    Roles obj = new Roles();
                    obj.RoleID   = new Guid(SQLReader["RoleID"].ToString());
                    obj.RoleName = SQLReader["RoleName"].ToString();
                    lstRoles.Add(obj);
                }
            }
            catch (Exception)
            {
            }
            return(lstRoles);
        }
        public static List <Folder> GetFolders()
        {
            List <Folder> lstFolders          = new List <Folder>();
            string        StoredProcedureName = "usp_FileManagerGetFolders";
            SqlDataReader SQLReader;
            SQLHandler    sagesql = new SQLHandler();

            try
            {
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName);
                while (SQLReader.Read())
                {
                    Folder obj = new Folder();
                    obj.FolderId        = int.Parse(SQLReader["FolderId"].ToString());
                    obj.FolderPath      = SQLReader["FolderPath"].ToString();
                    obj.StorageLocation = int.Parse(SQLReader["StorageLocation"].ToString());
                    lstFolders.Add(obj);
                }
                SQLReader.Dispose();
            }
            catch (Exception e)
            {
                throw e;
            }


            return(lstFolders);
        }
        public static List <string> GetModulePermission(int UserModuleID, string UserName)
        {
            List <string> lstPermissions      = new List <string>();
            string        StoredProcedureName = "usp_FileManagerGetModulePermission";
            SQLHandler    sagesql             = new SQLHandler();
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", UserModuleID));
            ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", UserName));
            SqlDataReader SQLReader;

            try
            {
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
                while (SQLReader.Read())
                {
                    lstPermissions.Add(SQLReader["permissionkey"].ToString());
                }
                SQLReader.Dispose();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(lstPermissions);
        }
        public static List <FolderPermission> GetUserListForFolder(int FolderID)
        {
            List <FolderPermission> lstFolderPer = new List <FolderPermission>();
            string     StoredProcedureName       = "usp_FileManagerGetUsersWithPermissions";
            SQLHandler sagesql = new SQLHandler();
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@FolderID", FolderID));
            SqlDataReader SQLReader;

            try
            {
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
                while (SQLReader.Read())
                {
                    FolderPermission obj = new FolderPermission();
                    obj.UserID   = int.Parse(SQLReader["UserID"].ToString());
                    obj.UserName = SQLReader["UserName"].ToString() ?? SQLReader["UserName"].ToString();

                    lstFolderPer.Add(obj);
                }
                SQLReader.Dispose();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(lstFolderPer);
        }
        public static List <ATTFile> SearchFiles(string SearchQuery)
        {
            List <ATTFile> lstFiles            = new List <ATTFile>();
            string         StoredProcedureName = "usp_FileManagerSearchFiles";
            SQLHandler     sagesql             = new SQLHandler();
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            ParaMeterCollection.Add(new KeyValuePair <string, object>("@SearchQuery", SearchQuery));
            SqlDataReader SQLReader;

            try
            {
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
                while (SQLReader.Read())
                {
                    ATTFile obj = new ATTFile();
                    obj.FileId          = int.Parse(SQLReader["FileId"].ToString());
                    obj.FileName        = SQLReader["FileName"].ToString();
                    obj.Folder          = SQLReader["Folder"].ToString();
                    obj.Extension       = SQLReader["Extension"].ToString();
                    obj.Size            = int.Parse(SQLReader["Size"].ToString());
                    obj.AddedOn         = SQLReader["AddedOn"].ToString();
                    obj.Content         = SQLReader["Content"] == DBNull.Value ? null : (byte[])SQLReader["Content"];
                    obj.StorageLocation = int.Parse(SQLReader["StorageLocation"].ToString());

                    lstFiles.Add(obj);
                }
                SQLReader.Dispose();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(lstFiles);
        }
        public static List <MenuInfo> GetAdminMenu()
        {
            List <MenuInfo> lstPages            = new List <MenuInfo>();
            string          StoredProcedureName = "[dbo].[usp_sagemenugetadminmenu]";
            SqlDataReader   SQLReader;

            try
            {
                SQLHandler sagesql = new SQLHandler();
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (SQLReader.Read())
            {
                lstPages.Add(new MenuInfo(int.Parse(SQLReader["PageID"].ToString()), int.Parse(SQLReader["PageOrder"].ToString()), SQLReader["PageName"].ToString(), int.Parse(SQLReader["ParentID"].ToString()), int.Parse(SQLReader["Level"].ToString()), SQLReader["LevelPageName"].ToString(), SQLReader["SEOName"].ToString(), SQLReader["TabPath"].ToString(), bool.Parse(SQLReader["IsVisible"].ToString()), bool.Parse(SQLReader["ShowInMenu"].ToString())));
            }
            return(lstPages);
        }