// Token: 0x060002EB RID: 747 RVA: 0x00019444 File Offset: 0x00017644
		private void CommitAndLoad()
		{
			this.Load();
			if (Utilities.IsPostRequest(this.request) && !string.IsNullOrEmpty(base.Command))
			{
				if (base.Command.Equals("ClrMRR", StringComparison.Ordinal))
				{
					AutoCompleteCache autoCompleteCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
					if (autoCompleteCache != null)
					{
						autoCompleteCache.ClearCache();
						autoCompleteCache.Commit(false);
					}
					this.isClearMrrRequest = true;
				}
				string formParameter = Utilities.GetFormParameter(this.request, "selRwCnt");
				if (string.IsNullOrEmpty(formParameter) || !int.TryParse(formParameter, out this.displayItemsPerPage))
				{
					throw new OwaInvalidRequestException("Row count must be a valid number");
				}
				string formParameter2 = Utilities.GetFormParameter(this.request, "selNxt");
				int num;
				if (string.IsNullOrEmpty(formParameter2) || !int.TryParse(formParameter2, out num) || num < 0 || num > 2)
				{
					throw new OwaInvalidRequestException("Next selection must be a valid number");
				}
				this.nextSelection = (NextSelectionDirection)num;
				if (this.userContext.IsFeatureEnabled(Feature.Signature))
				{
					this.autoAddSignature = (Utilities.GetFormParameter(this.request, "chkAddSg", false) != null);
					this.signatureText = Utilities.GetFormParameter(this.request, "txtSg", false);
				}
				this.emptyDeletedItemsOnLogoff = (Utilities.GetFormParameter(this.request, "chkEmDel", false) != null);
				string formParameter3 = Utilities.GetFormParameter(this.request, "rdRcpt", false);
				if (!string.IsNullOrEmpty(formParameter3))
				{
					this.readReceiptResponse = (ReadReceiptResponse)int.Parse(formParameter3);
				}
				this.addRecentRecipientsToMrr = (Utilities.GetFormParameter(this.request, "chkAddMRR", false) != null);
				if (this.userContext.IsFeatureEnabled(Feature.Contacts))
				{
					string formParameter4 = Utilities.GetFormParameter(this.request, "anrFst");
					this.checkNameInContactsFirst = (!string.IsNullOrEmpty(formParameter4) && formParameter4 == "1");
				}
				if (!this.isClearMrrRequest)
				{
					bool flag = false;
					if (this.displayItemsPerPage != this.userContext.UserOptions.BasicViewRowCount)
					{
						this.userContext.UserOptions.BasicViewRowCount = this.displayItemsPerPage;
						flag = true;
					}
					if (this.nextSelection != this.userContext.UserOptions.NextSelection)
					{
						this.userContext.UserOptions.NextSelection = this.nextSelection;
						flag = true;
					}
					if (this.userContext.IsFeatureEnabled(Feature.Signature))
					{
						if (this.autoAddSignature != this.userContext.UserOptions.AutoAddSignature)
						{
							this.userContext.UserOptions.AutoAddSignature = this.autoAddSignature;
							flag = true;
						}
						if (!Utilities.WhiteSpaceOnlyOrNullEmpty(this.signatureText) && (Utilities.WhiteSpaceOnlyOrNullEmpty(this.userContext.UserOptions.SignatureText) || !string.IsNullOrEmpty(Utilities.GetFormParameter(this.request, "chkRplSg", false))))
						{
							this.userContext.UserOptions.SignatureText = this.signatureText;
							this.signatureHtml = BodyConversionUtilities.ConvertTextToHtml(this.signatureText);
							this.userContext.UserOptions.SignatureHtml = this.signatureHtml;
							flag = true;
						}
					}
					if (this.userContext.UserOptions.EmptyDeletedItemsOnLogoff != this.emptyDeletedItemsOnLogoff)
					{
						this.userContext.UserOptions.EmptyDeletedItemsOnLogoff = this.emptyDeletedItemsOnLogoff;
						flag = true;
					}
					if (this.userContext.UserOptions.ReadReceipt != this.readReceiptResponse)
					{
						this.userContext.UserOptions.ReadReceipt = this.readReceiptResponse;
						flag = true;
					}
					if (this.userContext.UserOptions.AddRecipientsToAutoCompleteCache != this.addRecentRecipientsToMrr)
					{
						this.userContext.UserOptions.AddRecipientsToAutoCompleteCache = this.addRecentRecipientsToMrr;
						flag = true;
					}
					if (this.userContext.IsFeatureEnabled(Feature.Contacts) && this.userContext.UserOptions.CheckNameInContactsFirst != this.checkNameInContactsFirst)
					{
						this.userContext.UserOptions.CheckNameInContactsFirst = this.checkNameInContactsFirst;
						flag = true;
					}
					if (flag)
					{
						try
						{
							this.userContext.UserOptions.CommitChanges();
							base.SetSavedSuccessfully(true);
						}
						catch (StoragePermanentException)
						{
							base.SetSavedSuccessfully(false);
						}
						catch (StorageTransientException)
						{
							base.SetSavedSuccessfully(false);
						}
					}
				}
			}
		}
Пример #2
0
        private void CommitAndLoad()
        {
            this.oofSettings = UserOofSettings.GetUserOofSettings(this.userContext.MailboxSession);
            this.Load();
            bool flag = false;

            if (Utilities.IsPostRequest(this.request) && !string.IsNullOrEmpty(base.Command))
            {
                string formParameter = Utilities.GetFormParameter(this.request, "rdoOof", false);
                if (!string.IsNullOrEmpty(formParameter))
                {
                    bool flag2 = formParameter == 1.ToString();
                    bool flag3 = Utilities.GetFormParameter(this.request, "chkTmd", false) != null;
                    if (!flag2)
                    {
                        if (this.oofSettings.OofState != OofState.Disabled)
                        {
                            this.oofSettings.OofState = OofState.Disabled;
                            flag = true;
                        }
                    }
                    else if (flag3)
                    {
                        if (this.oofSettings.OofState != OofState.Scheduled)
                        {
                            this.oofSettings.OofState = OofState.Scheduled;
                            flag = true;
                        }
                        string formParameter2 = Utilities.GetFormParameter(this.request, "selSM", false);
                        string formParameter3 = Utilities.GetFormParameter(this.request, "selSD", false);
                        string formParameter4 = Utilities.GetFormParameter(this.request, "selSY", false);
                        string formParameter5 = Utilities.GetFormParameter(this.request, "selST", false);
                        string formParameter6 = Utilities.GetFormParameter(this.request, "selEM", false);
                        string formParameter7 = Utilities.GetFormParameter(this.request, "selED", false);
                        string formParameter8 = Utilities.GetFormParameter(this.request, "selEY", false);
                        string formParameter9 = Utilities.GetFormParameter(this.request, "selET", false);
                        if (string.IsNullOrEmpty(formParameter2) || string.IsNullOrEmpty(formParameter3) || string.IsNullOrEmpty(formParameter4) || string.IsNullOrEmpty(formParameter5) || string.IsNullOrEmpty(formParameter6) || string.IsNullOrEmpty(formParameter7) || string.IsNullOrEmpty(formParameter8) || string.IsNullOrEmpty(formParameter9))
                        {
                            base.SetInfobarMessage(string.Format(LocalizedStrings.GetNonEncoded(1140546334), this.userContext.UserOptions.DateFormat), InfobarMessageType.Error);
                            return;
                        }
                        int num = int.Parse(formParameter3);
                        if (num > ExDateTime.DaysInMonth(int.Parse(formParameter4), int.Parse(formParameter2)))
                        {
                            num = ExDateTime.DaysInMonth(int.Parse(formParameter4), int.Parse(formParameter2));
                        }
                        ExDateTime t = new ExDateTime(this.userContext.TimeZone, int.Parse(formParameter4), int.Parse(formParameter2), num);
                        num = int.Parse(formParameter7);
                        if (num > ExDateTime.DaysInMonth(int.Parse(formParameter8), int.Parse(formParameter6)))
                        {
                            num = ExDateTime.DaysInMonth(int.Parse(formParameter8), int.Parse(formParameter6));
                        }
                        ExDateTime t2 = new ExDateTime(this.userContext.TimeZone, int.Parse(formParameter8), int.Parse(formParameter6), num);
                        t  = t.AddHours((double)int.Parse(formParameter5));
                        t2 = t2.AddHours((double)int.Parse(formParameter9));
                        if (t > t2)
                        {
                            base.SetInfobarMessage(LocalizedStrings.GetNonEncoded(107113300), InfobarMessageType.Error);
                            this.isInvalidDuration = true;
                        }
                        if (this.oofSettings.Duration == null)
                        {
                            this.oofSettings.Duration = new Duration();
                        }
                        if (this.oofSettings.Duration.StartTime != (DateTime)t.ToUtc())
                        {
                            this.oofSettings.Duration.StartTime = (DateTime)t.ToUtc();
                            flag = true;
                        }
                        if (this.oofSettings.Duration.EndTime != (DateTime)t2.ToUtc())
                        {
                            this.oofSettings.Duration.EndTime = (DateTime)t2.ToUtc();
                            flag = true;
                        }
                    }
                    else if (this.oofSettings.OofState != OofState.Enabled)
                    {
                        this.oofSettings.OofState = OofState.Enabled;
                        flag = true;
                    }
                    string formParameter10 = Utilities.GetFormParameter(this.request, "txtInt", false);
                    string formParameter11 = Utilities.GetFormParameter(this.request, "chkInt", false);
                    if (((formParameter11 == null && string.IsNullOrEmpty(this.oofToInternal)) || !string.IsNullOrEmpty(formParameter11)) && !Utilities.WhiteSpaceOnlyOrNullEmpty(formParameter10))
                    {
                        this.oofSettings.InternalReply.Message = BodyConversionUtilities.ConvertTextToHtml(formParameter10);
                        flag = true;
                    }
                    string formParameter12 = Utilities.GetFormParameter(this.request, "txtExt", false);
                    string formParameter13 = Utilities.GetFormParameter(this.request, "chkExt", false);
                    if (((formParameter13 == null && string.IsNullOrEmpty(this.oofToExternal)) || !string.IsNullOrEmpty(formParameter13)) && !Utilities.WhiteSpaceOnlyOrNullEmpty(formParameter12))
                    {
                        this.oofSettings.ExternalReply.Message = BodyConversionUtilities.ConvertTextToHtml(formParameter12);
                        flag = true;
                    }
                    if (Utilities.GetFormParameter(this.request, "chkExtSnd", false) != null)
                    {
                        string formParameter14 = Utilities.GetFormParameter(this.request, "rdoAll", false);
                        if (!string.IsNullOrEmpty(formParameter14))
                        {
                            if (formParameter14 == 3.ToString())
                            {
                                if (this.oofSettings.ExternalAudience != ExternalAudience.All)
                                {
                                    this.oofSettings.ExternalAudience = ExternalAudience.All;
                                    flag = true;
                                }
                            }
                            else if (this.oofSettings.ExternalAudience != ExternalAudience.Known)
                            {
                                this.oofSettings.ExternalAudience = ExternalAudience.Known;
                                flag = true;
                            }
                        }
                    }
                    else if (this.oofSettings.ExternalAudience != ExternalAudience.None)
                    {
                        this.oofSettings.ExternalAudience = ExternalAudience.None;
                        flag = true;
                    }
                    if (flag)
                    {
                        try
                        {
                            this.oofSettings.Save(this.userContext.MailboxSession);
                            base.SetSavedSuccessfully(true);
                        }
                        catch (InvalidScheduledOofDuration)
                        {
                            base.SetInfobarMessage(LocalizedStrings.GetNonEncoded(-561991348), InfobarMessageType.Error);
                            this.isInvalidDuration = true;
                        }
                        this.Load();
                    }
                }
            }
        }