Exemple #1
0
 public static void ShowServerErrors(ErrorInformationBase[] errorInfos, System.Web.UI.Page page)
 {
     if (errorInfos != null && errorInfos.Length > 0)
     {
         ErrorHandlingUtil.ShowServerErrors(errorInfos.ToInfos(), page);
     }
 }
Exemple #2
0
 public static void ShowServerError(InfoCore errorInfo, System.Web.UI.Page page)
 {
     if (errorInfo != null)
     {
         ErrorHandlingUtil.ShowServerErrors(new InfoCore[]
         {
             errorInfo
         }, page);
     }
 }
Exemple #3
0
        private void ImportContactsRequest()
        {
            if (base.Request.Files.Count == 0 || string.IsNullOrEmpty(base.Request.Files[0].FileName))
            {
                this.currentPage = ImportContactListForm.ImportContactListPageState.UploadCsvFilePage;
                ErrorHandlingUtil.ShowServerError(OwaOptionStrings.ImportContactListNoFileUploaded, string.Empty, this.Page);
                return;
            }
            HttpPostedFile httpPostedFile = base.Request.Files[0];

            this.filename = string.Empty;
            try
            {
                this.filename = Path.GetFileName(httpPostedFile.FileName);
            }
            catch (ArgumentException)
            {
                this.filename = null;
            }
            if (string.IsNullOrEmpty(this.filename))
            {
                this.currentPage = ImportContactListForm.ImportContactListPageState.UploadCsvFilePage;
                ErrorHandlingUtil.ShowServerError(OwaOptionClientStrings.FileUploadFailed, string.Empty, this.Page);
                return;
            }
            ImportContactListParameters importContactListParameters = new ImportContactListParameters();

            importContactListParameters.CSVStream = httpPostedFile.InputStream;
            ImportContactList importContactList = new ImportContactList();
            PowerShellResults <ImportContactsResult> powerShellResults = importContactList.ImportObject(Identity.FromExecutingUserId(), importContactListParameters);

            if (!powerShellResults.Failed)
            {
                this.importResult = powerShellResults.Output[0];
                this.currentPage  = ImportContactListForm.ImportContactListPageState.ImportContactListResultPage;
                return;
            }
            this.currentPage = ImportContactListForm.ImportContactListPageState.UploadCsvFilePage;
            if (powerShellResults.ErrorRecords[0].Exception is ImportContactsException)
            {
                ErrorHandlingUtil.ShowServerError(powerShellResults.ErrorRecords[0].Message, string.Empty, this.Page);
                return;
            }
            ErrorHandlingUtil.ShowServerErrors(powerShellResults.ErrorRecords, this.Page);
        }
Exemple #4
0
 private void ExecuteUpload()
 {
     try
     {
         if (base.Request.Files.Count == 0 || string.IsNullOrEmpty(base.Request.Files[0].FileName))
         {
             ErrorHandlingUtil.ShowServerError(Strings.ISVNoFileUploaded, string.Empty, this.Page);
         }
         else
         {
             DLPISVService  dlpisvservice  = new DLPISVService();
             HttpPostedFile httpPostedFile = base.Request.Files[0];
             byte[]         array          = new byte[httpPostedFile.ContentLength];
             httpPostedFile.InputStream.Read(array, 0, array.Length);
             PowerShellResults powerShellResults = dlpisvservice.ProcessUpload(new DLPNewPolicyUploadParameters
             {
                 Mode         = this.policyMode.SelectedValue,
                 State        = RuleState.Enabled.ToString(),
                 Name         = this.name.Text,
                 Description  = this.description.Text,
                 TemplateData = array
             });
             if (powerShellResults.Failed)
             {
                 ErrorHandlingUtil.ShowServerErrors(powerShellResults.ErrorRecords, this.Page);
             }
             else
             {
                 this.Page.RegisterStartupScript("windowclose", string.Format("<script>{0}</script>", "window.opener.RefreshPolicyListView();window.close();"));
             }
         }
     }
     catch (Exception ex)
     {
         ErrorHandlingUtil.ShowServerError(ex.Message, string.Empty, this.Page);
     }
 }