예제 #1
0
        public static PreFormActionResponse RedirectToEdit(UserContext userContext, Item item, AddressBook.Mode viewMode)
        {
            AddressBookViewState addressBookViewState = userContext.LastClientViewState as AddressBookViewState;

            if (addressBookViewState != null)
            {
                userContext.LastClientViewState = addressBookViewState.PreviousViewState;
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            if (item.Id != null)
            {
                preFormActionResponse.AddParameter("id", item.Id.ObjectId.ToBase64String());
            }
            preFormActionResponse.Action = "Open";
            if (viewMode == AddressBook.Mode.EditMessage || viewMode == AddressBook.Mode.EditMeetingResponse)
            {
                preFormActionResponse.State = "Draft";
            }
            preFormActionResponse.Type = item.ClassName;
            return(preFormActionResponse);
        }