Example #1
0
        //WUIN-1055 - Bind Shared paths to Pdf Statement and File Upload Hyperlinks
        private void LoadSharedPaths()
        {
            string pdfStatementPath     = string.Empty;
            string fileUploadPath       = string.Empty;
            string stmtDirecLoginDomain = ConfigurationManager.AppSettings["WARSServiceDomain"];
            string stmtDirecLoginUser   = ConfigurationManager.AppSettings["WARSServiceUser"];
            string stmtDirecLoginPwd    = ConfigurationManager.AppSettings["WARSServicePwd"];

            CommonBL commonBl = new CommonBL();

            commonBl.GetSharedPaths(out pdfStatementPath, out fileUploadPath, out errorId);
            commonBl = null;

            using (new Impersonator(stmtDirecLoginUser, stmtDirecLoginDomain, stmtDirecLoginPwd))
            {
                if (pdfStatementPath != string.Empty && pdfStatementPath != "null")
                {
                    // Check if user has access to PDF Statement folders
                    try
                    {
                        // This will raise an exception if the path is read only or the user do not have access to view the permissions.
                        System.Security.AccessControl.DirectorySecurity ds = Directory.GetAccessControl(pdfStatementPath);
                        hdnPDFStatementAccess.Value = "Y";
                        hlPDFStatements.NavigateUrl = pdfStatementPath;

                        //hold the values in session so that this need not be fetched everytime when loading Menu screen
                        Session["MenuScrnPDFStatementPath"] = pdfStatementPath;
                    }
                    catch (UnauthorizedAccessException e)
                    {
                        hdnPDFStatementAccess.Value         = "N";
                        hlPDFStatements.NavigateUrl         = string.Empty;
                        Session["MenuScrnPDFStatementPath"] = string.Empty;
                    }
                }
                else
                {
                    hdnPDFStatementAccess.Value         = "N";
                    hlPDFStatements.NavigateUrl         = string.Empty;
                    Session["MenuScrnPDFStatementPath"] = string.Empty;
                }

                if (fileUploadPath != string.Empty && fileUploadPath != "null")
                {
                    // Check if user has access to SIF folders
                    try
                    {
                        // This will raise an exception if the path is read only or the user do not have access to view the permissions.
                        System.Security.AccessControl.DirectorySecurity ds = Directory.GetAccessControl(fileUploadPath);
                        hdnFileUploadAccess.Value = "Y";
                        hlFileUpload.NavigateUrl  = fileUploadPath;

                        //hold the values in session so that this need not be fetched everytime when loading Menu screen
                        Session["MenuScrnFileUploadPath"] = fileUploadPath;
                    }
                    catch (UnauthorizedAccessException e)
                    {
                        hdnFileUploadAccess.Value         = "N";
                        hlFileUpload.NavigateUrl          = string.Empty;
                        Session["MenuScrnFileUploadPath"] = string.Empty;
                    }
                }
                else
                {
                    hdnFileUploadAccess.Value         = "N";
                    hlFileUpload.NavigateUrl          = string.Empty;
                    Session["MenuScrnFileUploadPath"] = string.Empty;
                }
            }
        }