// Token: 0x060001C0 RID: 448 RVA: 0x00010840 File Offset: 0x0000EA40
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            MessageItem           messageItem = null;
            PreFormActionResponse result;

            try
            {
                if (owaContext == null)
                {
                    throw new ArgumentNullException("owaContext");
                }
                applicationElement = ApplicationElement.NotSet;
                type   = string.Empty;
                action = string.Empty;
                state  = string.Empty;
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                HttpContext           httpContext           = owaContext.HttpContext;
                HttpRequest           request     = httpContext.Request;
                UserContext           userContext = owaContext.UserContext;
                if (!Utilities.IsPostRequest(request))
                {
                    result = userContext.LastClientViewState.ToPreFormActionResponse();
                }
                else
                {
                    string formParameter  = Utilities.GetFormParameter(request, "hidid", false);
                    string formParameter2 = Utilities.GetFormParameter(request, "hidchk", false);
                    if (Utilities.IsPostRequest(request) && !string.IsNullOrEmpty(formParameter) && !string.IsNullOrEmpty(formParameter2))
                    {
                        messageItem = Utilities.GetItem <MessageItem>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    string formParameter3 = Utilities.GetFormParameter(request, "hidcmdpst", false);
                    if (!string.IsNullOrEmpty(formParameter3))
                    {
                        if (messageItem == null)
                        {
                            messageItem = EditMessageHelper.CreateDraft(userContext);
                        }
                        string text = null;
                        string key;
                        switch (key = formParameter3)
                        {
                        case "snd":
                        {
                            bool flag = EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            if (!flag && Utilities.GetFormParameter(request, "hidunrslrcp", false) == "1")
                            {
                                flag = true;
                            }
                            if (flag)
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, LocalizedStrings.GetNonEncoded(-2019438132), messageItem);
                                goto IL_2EA;
                            }
                            text = EditMessageHelper.SendMessage(userContext, messageItem);
                            if (text != null)
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            userContext.ForceNewSearch = true;
                            preFormActionResponse      = userContext.LastClientViewState.ToPreFormActionResponse();
                            goto IL_2EA;
                        }

                        case "cls":
                            preFormActionResponse = userContext.LastClientViewState.ToPreFormActionResponse();
                            goto IL_2EA;

                        case "attch":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            EditMessagePreFormAction.RedirectToAttachmentManager(owaContext, preFormActionResponse, messageItem);
                            goto IL_2EA;

                        case "addrBook":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            preFormActionResponse = EditMessageHelper.RedirectToPeoplePicker(owaContext, messageItem, AddressBook.Mode.EditMessage);
                            goto IL_2EA;

                        case "viewRcptWhenEdt":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            preFormActionResponse = EditMessageHelper.RedirectToRecipient(owaContext, messageItem, AddressBook.Mode.EditMessage);
                            goto IL_2EA;

                        case "autoSave":
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                preFormActionResponse.AddParameter("aserr", "1");
                                EditMessagePreFormAction.RedirectToCompose(owaContext, preFormActionResponse, text, messageItem);
                                goto IL_2EA;
                            }
                            preFormActionResponse = this.RedirectToAutoSaveInfo(owaContext, messageItem);
                            goto IL_2EA;
                        }
                        throw new OwaInvalidRequestException("Invalid command form parameter");
                    }
IL_2EA:
                    result = preFormActionResponse;
                }
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                }
            }
            return(result);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext is null.");
            }
            if (owaContext.HttpContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.HttpContext is null.");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = null;
            state  = null;
            action = null;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Type   = "IPM.Appointment";
            preFormActionResponse.Action = string.Empty;
            preFormActionResponse.State  = string.Empty;
            this.request     = owaContext.HttpContext.Request;
            this.userContext = owaContext.UserContext;
            InfobarMessage infobarMessage = null;
            StoreObjectId  storeObjectId  = null;
            string         changeKey      = null;
            string         action2        = owaContext.FormsRegistryContext.Action;
            string         text;

            if (string.Equals(action2, "New", StringComparison.Ordinal))
            {
                text = "new";
            }
            else
            {
                if (!Utilities.IsPostRequest(this.request))
                {
                    return(this.userContext.LastClientViewState.ToPreFormActionResponse());
                }
                text = Utilities.GetFormParameter(this.request, "hidcmdpst");
                string formParameter = Utilities.GetFormParameter(this.request, "hidid", false);
                changeKey = Utilities.GetFormParameter(this.request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, formParameter);
                }
            }
            StoreObjectId calendarFolderId = EditCalendarItemHelper.GetCalendarFolderId(this.request, this.userContext);
            bool          syncCalendarItem = true;

            if (text.Equals("attch", StringComparison.Ordinal))
            {
                syncCalendarItem = false;
            }
            bool flag = true;

            try
            {
                EditCalendarItemHelper.CalendarItemUpdateFlags storeUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
                if (!text.Equals("cls", StringComparison.Ordinal))
                {
                    storeUpdateFlags = EditCalendarItemHelper.GetCalendarItem(this.userContext, storeObjectId, calendarFolderId, changeKey, syncCalendarItem, out this.calendarItemBase);
                }
                switch (this.DoAction(text, storeUpdateFlags, ref preFormActionResponse, out infobarMessage))
                {
                case EditCalendarItemPreFormAction.RedirectTo.None:
                    throw new OwaInvalidRequestException("Unhandled redirection.");

                case EditCalendarItemPreFormAction.RedirectTo.AddressBook:
                    preFormActionResponse = EditMessageHelper.RedirectToPeoplePicker(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.ADPage:
                    preFormActionResponse = EditMessageHelper.RedirectToRecipient(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.AttachmentManager:
                    if (this.calendarItemBase.Id == null)
                    {
                        CalendarUtilities.SaveCalendarItem(this.calendarItemBase, this.userContext, out infobarMessage);
                    }
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(this.userContext, null))
                    {
                        CalendarItemBaseData userContextData = EditCalendarItemHelper.GetUserContextData(this.userContext);
                        userContextData.CopyTo(calendarItemBase);
                        string text2;
                        EditCalendarItemHelper.UpdateCalendarItemValues(calendarItemBase, this.userContext, this.request, out text2);
                        EditCalendarItemHelper.CreateUserContextData(this.userContext, calendarItemBase);
                        if (this.calendarItemBase.Id != null)
                        {
                            CalendarItemBaseData userContextData2 = EditCalendarItemHelper.GetUserContextData(this.userContext);
                            userContextData2.Id        = this.calendarItemBase.Id.ObjectId;
                            userContextData2.ChangeKey = this.calendarItemBase.Id.ChangeKeyAsBase64String();
                        }
                    }
                    if (infobarMessage == null)
                    {
                        this.RedirectToAttachmentManager(owaContext, preFormActionResponse);
                    }
                    else
                    {
                        owaContext.PreFormActionData = this.calendarItemBase;
                        flag = false;
                        this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.CalendarDailyView:
                    EditCalendarItemHelper.ClearUserContextData(this.userContext);
                    preFormActionResponse = this.userContext.LastClientViewState.ToPreFormActionResponse();
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditCalendarItem:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    flag = false;
                    this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditRecurrence:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = CalendarItemBaseData.Create(this.calendarItemBase);
                    preFormActionResponse.Action = "EditRecurrence";
                    if (this.calendarItemBase.IsDirty)
                    {
                        preFormActionResponse.AddParameter("cd", "1");
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.SchedulingTab:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    this.RedirectToSchedulingTab(owaContext, infobarMessage, preFormActionResponse);
                    flag = false;
                    break;

                default:
                    throw new OwaInvalidRequestException("Unhandled redirection enum value in EditCalendarItemPreFormAction.");
                }
            }
            catch
            {
                flag = true;
                EditCalendarItemHelper.ClearUserContextData(this.userContext);
                throw;
            }
            finally
            {
                if (flag && this.calendarItemBase != null)
                {
                    this.calendarItemBase.Dispose();
                    this.calendarItemBase = null;
                }
            }
            return(preFormActionResponse);
        }
Ejemplo n.º 3
0
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            HttpContext httpContext = owaContext.HttpContext;
            HttpRequest request     = httpContext.Request;
            UserContext userContext = owaContext.UserContext;

            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            string      formParameter  = Utilities.GetFormParameter(request, "hidid", true);
            string      formParameter2 = Utilities.GetFormParameter(request, "hidchk", true);
            string      formParameter3 = Utilities.GetFormParameter(request, "hidcmdpst", true);
            MessageItem messageItem    = null;

            try
            {
                if (string.CompareOrdinal(formParameter3, "cls") != 0 && Utilities.IsPostRequest(request))
                {
                    if (ObjectClass.IsMeetingRequest(owaContext.FormsRegistryContext.Type))
                    {
                        messageItem = Utilities.GetItem <MeetingRequest>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    else if (ObjectClass.IsMeetingCancellation(owaContext.FormsRegistryContext.Type))
                    {
                        messageItem = Utilities.GetItem <MeetingCancellation>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    else
                    {
                        if (!ObjectClass.IsMeetingResponse(owaContext.FormsRegistryContext.Type))
                        {
                            throw new OwaInvalidRequestException("Invalid Type");
                        }
                        messageItem = Utilities.GetItem <MeetingResponse>(userContext, formParameter, formParameter2, new PropertyDefinition[0]);
                    }
                    this.base64ItemId = messageItem.Id.ObjectId.ToBase64String();
                }
                string text = null;
                string a;
                if ((a = formParameter3) != null)
                {
                    if (!(a == "snd"))
                    {
                        if (a == "cls")
                        {
                            return(userContext.LastClientViewState.ToPreFormActionResponse());
                        }
                        if (!(a == "attch"))
                        {
                            if (!(a == "addrBook"))
                            {
                                if (a == "viewRcptWhenEdt")
                                {
                                    EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                                    if (!string.IsNullOrEmpty(text))
                                    {
                                        return(this.RedirectToCompose(owaContext, text));
                                    }
                                    return(EditMessageHelper.RedirectToRecipient(owaContext, messageItem, AddressBook.Mode.EditMeetingResponse));
                                }
                            }
                            else
                            {
                                EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                                if (!string.IsNullOrEmpty(text))
                                {
                                    return(this.RedirectToCompose(owaContext, text));
                                }
                                return(EditMessageHelper.RedirectToPeoplePicker(owaContext, messageItem, AddressBook.Mode.EditMeetingResponse));
                            }
                        }
                        else
                        {
                            EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                            if (!string.IsNullOrEmpty(text))
                            {
                                return(this.RedirectToCompose(owaContext, text));
                            }
                            return(this.RedirectToAttachmentManager(owaContext));
                        }
                    }
                    else
                    {
                        StoreObjectId   storeObjectId   = null;
                        MeetingResponse meetingResponse = messageItem as MeetingResponse;
                        if (meetingResponse != null)
                        {
                            storeObjectId = meetingResponse.AssociatedMeetingRequestId;
                        }
                        bool flag = EditMessageHelper.UpdateMessage(messageItem, userContext, request, out text);
                        if (!string.IsNullOrEmpty(text))
                        {
                            return(this.RedirectToCompose(owaContext, text));
                        }
                        if (!flag && Utilities.GetFormParameter(request, "hidunrslrcp", false) == "1")
                        {
                            flag = true;
                        }
                        if (flag)
                        {
                            return(this.RedirectToCompose(owaContext, LocalizedStrings.GetNonEncoded(-2019438132)));
                        }
                        text = EditMessageHelper.SendMessage(userContext, messageItem);
                        if (text != null)
                        {
                            return(this.RedirectToCompose(owaContext, text));
                        }
                        if (storeObjectId != null)
                        {
                            StoreObjectId storeObjectId2 = null;
                            using (MeetingRequest item = Utilities.GetItem <MeetingRequest>(userContext, storeObjectId, new PropertyDefinition[0]))
                            {
                                storeObjectId2 = item.ParentId;
                            }
                            if (storeObjectId2 != null)
                            {
                                if (Utilities.IsDefaultFolderId(userContext.MailboxSession, storeObjectId2, DefaultFolderType.DeletedItems))
                                {
                                    Utilities.DeleteItems(userContext, DeleteItemFlags.SoftDelete, new StoreId[]
                                    {
                                        storeObjectId
                                    });
                                }
                                else
                                {
                                    Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                    {
                                        storeObjectId
                                    });
                                }
                            }
                        }
                        userContext.ForceNewSearch = true;
                        return(userContext.LastClientViewState.ToPreFormActionResponse());
                    }
                }
                throw new OwaInvalidRequestException("Invalid command form parameter");
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                }
            }
            PreFormActionResponse result;

            return(result);
        }