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 <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 <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 <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);
        }