/// <summary>
        /// Connects to database and obtains user list for folder for given FolderID.
        /// </summary>
        /// <param name="FolderID">FolderID</param>
        /// <returns>List of FolderPermission class containing UserID and UserName.</returns>
        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 = null;

            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);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (SQLReader != null)
                {
                    SQLReader.Close();
                }
            }
            return(lstFolderPer);
        }
        public static List <FolderPermission> GetFolderPermissions(int FolderID)
        {
            List <FolderPermission> lstFolderPer = new List <FolderPermission>();
            string     StoredProcedureName       = "usp_FileManagerGetFolderPermission";
            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.FolderID      = int.Parse(SQLReader["FolderID"].ToString());
                    obj.UserID        = int.Parse(SQLReader["UserID"].ToString());
                    obj.PermissionID  = int.Parse(SQLReader["PermissionID"].ToString());
                    obj.PermissionKey = SQLReader["PermissionKey"].ToString();
                    obj.RoleID        = new Guid(SQLReader["RoleID"].ToString());
                    obj.UserName      = SQLReader["UserName"].ToString() ?? SQLReader["UserName"].ToString();

                    lstFolderPer.Add(obj);
                }
                SQLReader.Dispose();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(lstFolderPer);
        }
        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;
        }
        /// <summary>
        /// Connects to database and obtains folder permission for given FolderID.
        /// </summary>
        /// <param name="FolderID">FolderID</param>
        /// <returns>List of FolderPermission class containing FolderID,UserID,PermissionID,PermissionKey,RoleID and UserName.</returns>
        public static List<FolderPermission> GetFolderPermissions(int FolderID)
        {
            List<FolderPermission> lstFolderPer = new List<FolderPermission>();
            string StoredProcedureName = "usp_FileManagerGetFolderPermission";
            SQLHandler sagesql = new SQLHandler();
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@FolderID", FolderID));
            SqlDataReader SQLReader = null;
            try
            {
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection);
                while (SQLReader.Read())
                {
                    FolderPermission obj = new FolderPermission();
                    obj.FolderID = int.Parse(SQLReader["FolderID"].ToString());
                    obj.UserID = int.Parse(SQLReader["UserID"].ToString());
                    obj.PermissionID = int.Parse(SQLReader["PermissionID"].ToString());
                    obj.PermissionKey = SQLReader["PermissionKey"].ToString();
                    obj.RoleID = new Guid(SQLReader["RoleID"].ToString());
                    obj.UserName = SQLReader["UserName"].ToString() ?? SQLReader["UserName"].ToString();

                    lstFolderPer.Add(obj);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (SQLReader != null)
                {
                    SQLReader.Close();
                }
            }
            return lstFolderPer;
        }