public List<InboundFaxDocument> GetHoldFolders(string folderType)
        {
            List<HoldFolders> holdFoldersList = new List<HoldFolders>();
            InboundFaxDocument holdForTreeView = new InboundFaxDocument();
            List<InboundFaxDocument> holdForTreeViewList = new List<InboundFaxDocument>();

            try
            {
                using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                {
                    const string query = "SELECT [ID],[ActiveDirectoyUser],[FolderName]"
                        + " FROM [HoldFolders]"
                        + " where ActiveDirectoyUser = @ActiveDirectoyUser"
                        + " and DocumentType = @DocumentType";

                    holdFoldersList = db.Query<HoldFolders>(query, new {
                        @ActiveDirectoyUser = Utility.GetUserName(),
                        @DocumentType = folderType
                    }).ToList();

                    for(int i = 0; i< holdFoldersList.Count;i++)
                    {
                        holdForTreeView = new InboundFaxDocument();
                        holdForTreeView.id = holdFoldersList[i].ID.ToString();
                        holdForTreeView.HasChildren = true;
                        holdForTreeView.DocumentName = holdFoldersList[i].FolderName;
                        holdForTreeViewList.Add(holdForTreeView);
                    }

                    return holdForTreeViewList;
                }
            }
            catch (Exception er)
            {
                Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());                
                return holdForTreeViewList;
            }
        }
        public List<InboundFaxDocument> GetFilesInFolder(string holderFolderId)
        {
            List<HoldFolders> holdFoldersList = new List<HoldFolders>();
            InboundFaxDocument holdForTreeView = new InboundFaxDocument();
            List<InboundFaxDocument> holdForTreeViewList = new List<InboundFaxDocument>();

            try
            {
                using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                {

                    const string query = "SELECT [ID],[HoldFolderID],[ActiveDirectoyUser],[FolderName],[FileName],[FilePath]"
                        + " FROM [HoldFiles]"
                        + " where HoldFolderID = @HoldFolderID";

                    holdFoldersList = db.Query<HoldFolders>(query, new { @HoldFolderID = holderFolderId }).ToList();

                    for (int i = 0; i < holdFoldersList.Count; i++)
                    {
                        holdForTreeView = new InboundFaxDocument();
                        holdForTreeView.FaxPath = holdFoldersList[i].FilePath;
                        holdForTreeView.id = holdFoldersList[i].ID;
                        holdForTreeView.expanded = true;
                        holdForTreeView.DocumentName = holdFoldersList[i].FileName;
                        holdForTreeViewList.Add(holdForTreeView);
                    }

                    return holdForTreeViewList;
                }
            }
            catch (Exception er)
            {
                Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());
                return holdForTreeViewList;
            }
        }
        public List<InboundFaxDocument> GetInboundFaxList()
        {
            List<InboundFaxDocument> inBoundFaxesList = new List<InboundFaxDocument>();
            List<InboundFaxDocument> inboundFaxDocumentList = new List<InboundFaxDocument>();
            string name = string.Empty;

            try
            {
                using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                {
                    const string query = "SELECT [ID],[ActiveDirectoyUser],[Path],[Name]"
                        + " FROM [PostOfficeFoldersByUser]"
                        + " where [ActiveDirectoyUser] = @ActiveDirectoyUser";

                    inBoundFaxesList = db.Query<InboundFaxDocument>(query, new { @ActiveDirectoyUser = Utility.GetUserName() }).ToList();


                    for (int i = 0; i < inBoundFaxesList.Count; i++)
                    {
                        InboundFaxDocument inboundFaxDocument = new InboundFaxDocument();
                        string[] filePaths = Directory.GetFiles(inBoundFaxesList[i].Path);

                        if (filePaths.Length > 0)
                        {
                            for (int j = 0; j < filePaths.Length; j++)
                            {
                                string[] fileName = filePaths[j].Split('\\');

                                inboundFaxDocument = new InboundFaxDocument();
                                inboundFaxDocument.id = filePaths[j];
                                inboundFaxDocument.DocumentName = fileName[fileName.Length - 1];
                                inboundFaxDocument.FaxPath = filePaths[j];
                                inboundFaxDocument.expanded = true;
                                inboundFaxDocumentList.Add(inboundFaxDocument);
                            }
                        }
                    }

                    return inboundFaxDocumentList;
                }
            }
            catch (Exception er)
            {
                Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());
                return inboundFaxDocumentList;
            }
        }