Example #1
0
 protected override void OnLoad(EventArgs e)
 {
     this.EnableViewState = true;
     base.OnLoad(e);
     if (base.IsPostBack)
     {
         if (string.Compare(this.SenderButtonId, base.CommitButtonClientID) != 0 && string.Compare(this.SenderButtonId, base.BackButton.ClientID) != 0 && string.Compare(this.SenderButtonId, base.NextButton.ClientID) != 0)
         {
             this.ShowDisabledWizard(Strings.WebServiceErrorMessage);
             return;
         }
     }
     else
     {
         Exception lastError = base.Server.GetLastError();
         if (lastError != null)
         {
             InfoCore infoCore = lastError.ToErrorInformationBase().ToInfo();
             if (lastError.IsMaxRequestLengthExceededException())
             {
                 infoCore.Message = Strings.MigrationFileTooBig;
                 infoCore.Details = string.Empty;
                 base.Server.ClearError();
             }
             ErrorHandlingUtil.ShowServerError(infoCore, this.Page);
         }
     }
 }
Example #2
0
 protected void ShowDisabledWizard(string reason)
 {
     this.IsInError             = true;
     base.NextButton.Disabled   = true;
     base.BackButton.Disabled   = true;
     base.CommitButton.Disabled = true;
     ErrorHandlingUtil.ShowServerError(reason, string.Empty, this.Page);
 }
Example #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);
        }
Example #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);
     }
 }