public SigmaResultType GetFileType(string codeCategory)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         FileStoreMgr fileStoreMgr = new FileStoreMgr();
         result = fileStoreMgr.GetFileType(codeCategory);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }
        public SigmaResultType UpdateFileStore(TypeFileStore objFileStore)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                ////string targetPath = System.Web.Configuration.WebConfigurationManager.AppSettings["DocumentUpload"];
                //string targetPath = System.Web.Configuration.WebConfigurationManager.AppSettings["DocumentFolderRoot"];

                FileStoreMgr fileStoreMgr = new FileStoreMgr();
                result = fileStoreMgr.UpdateFileStore(objFileStore, ConfigMgr.GetTargetPath());
                result.IsSuccessful = true;
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
        public SigmaResultType MultiFileStore(List<TypeFileStore> listObj)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                //string targetPath = System.Web.Configuration.WebConfigurationManager.AppSettings["DocumentUpload"];
                FileStoreMgr fileStoreMgr = new FileStoreMgr();
                result = fileStoreMgr.MultiFileStore(listObj, ConfigMgr.GetTargetPath());
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
        public SigmaResultType RemoveFileStore(TypeFileStore objFileStore)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                FileStoreMgr fileStoreMgr = new FileStoreMgr();
                result = fileStoreMgr.RemoveFileStore(objFileStore);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
        public SigmaResultType ListFileStore()
        {
            SigmaResultType result = new SigmaResultType();
            try
            {
                //var queryStr = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;
                //string max = queryStr["max"];
                //string offset = queryStr["offset"];
                ////2014.2.14 modified querystring rule
                //List<string> s_option = new List<string>();
                //List<string> s_key = new List<string>();
                //s_option.Add("@CostCode");
                //s_option.Add("@Description");
                //s_key.Add(queryStr["CostCode"]);
                //s_key.Add(queryStr["Description"]);

                //string o_option = queryStr["o_option"];
                //string o_desc = queryStr["o_desc"];

                var queryStr = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;
                string max = queryStr["max"];
                string offset = queryStr["offset"];
                string s_option = queryStr["s_option"];
                string s_key = queryStr["s_key"];
                string o_option = queryStr["o_option"];
                string o_desc = queryStr["o_desc"];

                List<string[]> s_optionkeyList = new List<string[]>();

                if (!string.IsNullOrEmpty(queryStr["FileCategory"]))
                {
                    string[] s_optionkeys = new string[2];
                    s_optionkeys[0] = "FileCategory";
                    s_optionkeys[1] = queryStr["FileCategory"];
                    s_optionkeyList.Add(s_optionkeys);
                }
                else
                {
                    string[] s_optionkeys = new string[2];
                    s_optionkeys[0] = "FileCategory";
                    s_optionkeys[1] = null;
                    s_optionkeyList.Add(s_optionkeys);
                }
                if (!string.IsNullOrEmpty(queryStr["FileTypeCode"]))
                {
                    string[] s_optionkeys = new string[2];
                    s_optionkeys[0] = "FileTypeCode";
                    s_optionkeys[1] = queryStr["FileTypeCode"];
                    s_optionkeyList.Add(s_optionkeys);
                }
                else
                {
                    string[] s_optionkeys = new string[2];
                    s_optionkeys[0] = "FileTypeCode";
                    s_optionkeys[1] = null;
                    s_optionkeyList.Add(s_optionkeys);
                }
                //if (!string.IsNullOrEmpty(queryStr["UploadedBy"]))
                //{
                //    string[] s_optionkeys = new string[2];
                //    s_optionkeys[0] = "UploadedBy";
                //    s_optionkeys[1] = queryStr["UploadedBy"];
                //    s_optionkeyList.Add(s_optionkeys);
                //}
                //else
                //{
                //    string[] s_optionkeys = new string[2];
                //    s_optionkeys[0] = "UploadedBy";
                //    s_optionkeys[1] = null;
                //    s_optionkeyList.Add(s_optionkeys);
                //}
                //if (!string.IsNullOrEmpty(queryStr["Title"]))
                //{
                //    string[] s_optionkeys = new string[2];
                //    s_optionkeys[0] = "Title";
                //    s_optionkeys[1] = queryStr["Title"];
                //    s_optionkeyList.Add(s_optionkeys);
                //}
                //else
                //{
                //    string[] s_optionkeys = new string[2];
                //    s_optionkeys[0] = "Title";
                //    s_optionkeys[1] = null;
                //    s_optionkeyList.Add(s_optionkeys);
                //}
                //if (!string.IsNullOrEmpty(queryStr["Description"]))
                //{
                //    string[] s_optionkeys = new string[2];
                //    s_optionkeys[0] = "Description";
                //    s_optionkeys[1] = queryStr["Description"];
                //    s_optionkeyList.Add(s_optionkeys);
                //}
                //else
                //{
                //    string[] s_optionkeys = new string[2];
                //    s_optionkeys[0] = "Description";
                //    s_optionkeys[1] = null;
                //    s_optionkeyList.Add(s_optionkeys);
                //}
                //
                if (!string.IsNullOrEmpty(s_option))
                {
                    if (s_option == "Title")
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "Title";
                        s_optionkeys[1] = s_key;
                        s_optionkeyList.Add(s_optionkeys);

                        string[] s_optionkeys2 = new string[2];
                        s_optionkeys2[0] = "Description";
                        s_optionkeys2[1] = null;
                        s_optionkeyList.Add(s_optionkeys2);

                        string[] s_optionkeys3 = new string[2];
                        s_optionkeys3[0] = "UploadedBy";
                        s_optionkeys3[1] = null;
                        s_optionkeyList.Add(s_optionkeys3);
                    }
                    if (s_option == "Description")
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "Description";
                        s_optionkeys[1] = s_key;
                        s_optionkeyList.Add(s_optionkeys);

                        string[] s_optionkeys2 = new string[2];
                        s_optionkeys2[0] = "Title";
                        s_optionkeys2[1] = null;
                        s_optionkeyList.Add(s_optionkeys);

                        string[] s_optionkeys3 = new string[2];
                        s_optionkeys3[0] = "UploadedBy";
                        s_optionkeys3[1] = null;
                        s_optionkeyList.Add(s_optionkeys3);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(queryStr["Title"]))
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "Title";
                        s_optionkeys[1] = queryStr["Title"];
                        s_optionkeyList.Add(s_optionkeys);
                    }
                    else
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "Title";
                        s_optionkeys[1] = null;
                        s_optionkeyList.Add(s_optionkeys);
                    }
                    if (!string.IsNullOrEmpty(queryStr["Description"]))
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "Description";
                        s_optionkeys[1] = queryStr["Description"];
                        s_optionkeyList.Add(s_optionkeys);
                    }
                    else
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "Description";
                        s_optionkeys[1] = null;
                        s_optionkeyList.Add(s_optionkeys);
                    }
                    if (!string.IsNullOrEmpty(queryStr["UploadedBy"]))
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "UploadedBy";
                        s_optionkeys[1] = queryStr["UploadedBy"];
                        s_optionkeyList.Add(s_optionkeys);
                    }
                    else
                    {
                        string[] s_optionkeys = new string[2];
                        s_optionkeys[0] = "UploadedBy";
                        s_optionkeys[1] = null;
                        s_optionkeyList.Add(s_optionkeys);
                    }
                }

                FileStoreMgr fileStoreMgr = new FileStoreMgr();
                result = fileStoreMgr.ListFileStore(offset, max, s_optionkeyList, o_option, o_desc);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }