예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.FilteredView = false;
            base.OnLoad(e);
            EditCalendarItemHelper.ClearUserContextData(base.UserContext);
            this.CreateExpiringPasswordNotification();
            this.CreateOutOfOfficeNotification();
            int num = RequestParser.TryGetIntValueFromQueryString(base.Request, "slUsng", -1);

            if (num >= 0 && num <= 2)
            {
                this.selectedUsing = (SecondaryNavigationArea)num;
            }
            if (base.UserContext.IsWebPartRequest)
            {
                base.UserContext.LastClientViewState = new WebPartModuleViewState(base.FolderId, base.Folder.ClassName, base.PageNumber, NavigationModule.Mail, base.SortOrder, base.SortedColumn);
                return;
            }
            if (base.FilteredView)
            {
                base.UserContext.LastClientViewState = new MessageModuleSearchViewState(base.UserContext.LastClientViewState, base.FolderId, base.OwaContext.FormsRegistryContext.Type, this.selectedUsing, base.PageNumber, base.SearchString, base.SearchScope);
                return;
            }
            base.UserContext.LastClientViewState = new MessageModuleViewState(base.FolderId, base.OwaContext.FormsRegistryContext.Type, this.selectedUsing, base.PageNumber);
        }
예제 #2
0
        public static void SetCalendarItemFromQueryParams(CalendarItemBase calendarItemBase, HttpRequest request, UserContext userContext)
        {
            bool       isMeeting  = Utilities.GetQueryStringParameter(request, "mr", false) != null;
            ExDateTime exDateTime = ExDateTime.MinValue;
            ExDateTime endTime    = ExDateTime.MinValue;
            ExDateTime localTime  = DateTimeUtilities.GetLocalTime();
            int        num        = RequestParser.TryGetIntValueFromQueryString(request, "yr", -1);
            int        num2       = RequestParser.TryGetIntValueFromQueryString(request, "mn", -1);
            int        num3       = RequestParser.TryGetIntValueFromQueryString(request, "dy", -1);

            if (num != -1 && num2 != -1 && num3 != -1)
            {
                exDateTime = new ExDateTime(userContext.TimeZone, num, num2, num3, localTime.Hour, localTime.Minute, 0);
            }
            if (exDateTime == ExDateTime.MinValue)
            {
                exDateTime = new ExDateTime(userContext.TimeZone, localTime.Year, localTime.Month, localTime.Day, localTime.Hour, localTime.Minute, 0);
            }
            if (exDateTime.Minute != 0 && exDateTime.Minute != 30)
            {
                exDateTime = exDateTime.AddMinutes((double)(30 - exDateTime.Minute % 30));
            }
            endTime = exDateTime.AddMinutes(60.0);
            calendarItemBase.StartTime = exDateTime;
            calendarItemBase.EndTime   = endTime;
            calendarItemBase.IsMeeting = isMeeting;
        }
예제 #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "ctx");
            int    num;

            if (!int.TryParse(queryStringParameter, out num))
            {
                throw new OwaInvalidRequestException("Context parameter is having invalid format");
            }
            if (num < 0 || num > 4)
            {
                throw new OwaInvalidRequestException("Invalid context value in the querystring parameter");
            }
            this.viewMode = (AddressBook.Mode)num;
            if (this.viewMode == AddressBook.Mode.None)
            {
                this.viewMode = AddressBook.Mode.Lookup;
            }
            if (base.IsPostFromMyself())
            {
                this.action              = Utilities.GetFormParameter(base.Request, "hidcmdpst", false);
                this.searchString        = Utilities.GetFormParameter(base.Request, "hidss", false);
                this.pageNumber          = RequestParser.TryGetIntValueFromForm(base.Request, "hidpg", 1);
                this.sortColumn          = (ColumnId)RequestParser.TryGetIntValueFromForm(base.Request, "hidcid", 11);
                this.sortOrder           = (SortOrder)RequestParser.TryGetIntValueFromForm(base.Request, "hidso", 1);
                this.addressBookToSearch = Utilities.GetFormParameter(base.Request, "hidAB", false);
                if (string.IsNullOrEmpty(this.addressBookToSearch))
                {
                    throw new OwaInvalidRequestException("addressbookGuid can't be null");
                }
                this.recipientWell = (RecipientItemType)RequestParser.TryGetIntValueFromForm(base.Request, "hidrw", 1);
            }
            else
            {
                this.searchString = Utilities.GetQueryStringParameter(base.Request, "sch", false);
                if (!string.IsNullOrEmpty(this.searchString))
                {
                    Utilities.VerifySearchCanaryInGetRequest(base.Request);
                }
                this.pageNumber          = RequestParser.TryGetIntValueFromQueryString(base.Request, "pg", 1);
                this.sortColumn          = (ColumnId)RequestParser.TryGetIntValueFromQueryString(base.Request, "cid", 11);
                this.sortOrder           = (SortOrder)RequestParser.TryGetIntValueFromQueryString(base.Request, "so", 1);
                this.addressBookToSearch = Utilities.GetQueryStringParameter(base.Request, "ab", false);
                this.recipientWell       = (RecipientItemType)RequestParser.TryGetIntValueFromQueryString(base.Request, "rw", 1);
            }
            this.GetSearchLocation();
            if (AddressBook.IsEditingMode(this.viewMode))
            {
                if (!base.IsPostFromMyself())
                {
                    bool          required = this.viewMode != AddressBook.Mode.EditCalendar;
                    StoreObjectId itemId   = QueryStringUtilities.CreateItemStoreObjectId(base.UserContext.MailboxSession, base.Request, required);
                    base.Item = AddressBookHelper.GetItem(base.UserContext, this.viewMode, itemId, null);
                }
                else
                {
                    StoreObjectId itemId2       = null;
                    string        formParameter = Utilities.GetFormParameter(base.Request, "hidid", true);
                    if (!string.IsNullOrEmpty(formParameter))
                    {
                        itemId2 = Utilities.CreateStoreObjectId(base.UserContext.MailboxSession, formParameter);
                    }
                    string formParameter2 = Utilities.GetFormParameter(base.Request, "hidchk", true);
                    base.Item = AddressBookHelper.GetItem(base.UserContext, this.viewMode, itemId2, formParameter2);
                    string a;
                    if ((a = this.action) != null)
                    {
                        if (!(a == "addrcp"))
                        {
                            if (a == "rmrcp")
                            {
                                int intValueFromForm = RequestParser.GetIntValueFromForm(base.Request, "hidri");
                                if (this.viewMode == AddressBook.Mode.EditMessage || this.viewMode == AddressBook.Mode.EditMeetingResponse)
                                {
                                    if (intValueFromForm >= 0 && intValueFromForm < this.Message.Recipients.Count)
                                    {
                                        this.Message.Recipients.RemoveAt(intValueFromForm);
                                        AddressBookHelper.SaveItem(base.Item);
                                    }
                                }
                                else if (this.viewMode == AddressBook.Mode.EditCalendar)
                                {
                                    CalendarUtilities.RemoveAttendeeAt(this.CalendarItemBase, intValueFromForm);
                                    EditCalendarItemHelper.CreateUserContextData(base.UserContext, this.CalendarItemBase);
                                }
                            }
                        }
                        else
                        {
                            int num2 = RequestParser.TryGetIntValueFromQueryString(base.Request, "rt", 1);
                            if (num2 == 1)
                            {
                                this.type = RecipientItemType.To;
                            }
                            else if (num2 == 2)
                            {
                                this.type = RecipientItemType.Cc;
                            }
                            else if (num2 == 3)
                            {
                                this.type = RecipientItemType.Bcc;
                            }
                            string text = base.Request.Form["chkRcpt"];
                            if (!string.IsNullOrEmpty(text))
                            {
                                this.ids = text.Split(new char[]
                                {
                                    ','
                                });
                                if (this.searchLocation == AddressBook.SearchLocation.AddressBook)
                                {
                                    AddressBookHelper.AddRecipientsToDraft(this.ids, base.Item, this.type, base.UserContext);
                                }
                                else
                                {
                                    AddressBookHelper.AddContactsToDraft(base.Item, this.type, base.UserContext, this.ids);
                                }
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(this.searchString))
            {
                this.searchString = this.searchString.Trim();
                if (this.searchString.Length > Globals.MaxSearchStringLength)
                {
                    throw new OwaInvalidRequestException("Search string length is more than 256 characters");
                }
            }
            if (this.pageNumber == 0)
            {
                this.pageNumber = 1;
            }
            this.firstItemOnPage = (this.pageNumber - 1) * base.UserContext.UserOptions.BasicViewRowCount + 1;
            this.lastItemOnPage  = this.firstItemOnPage + base.UserContext.UserOptions.BasicViewRowCount - 1;
            this.CreateListView();
            if (AddressBook.IsEditingMode(this.viewMode) || !string.IsNullOrEmpty(this.searchString))
            {
                base.UserContext.LastClientViewState = new AddressBookSearchViewState(base.UserContext.LastClientViewState, this.viewMode, this.addressBookToSearch, this.searchString, this.pageNumber, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ObjectId, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ChangeKeyAsBase64String(), this.recipientWell, this.sortColumn, this.sortOrder);
                return;
            }
            base.UserContext.LastClientViewState = new AddressBookViewState(base.UserContext.LastClientViewState, this.viewMode, this.pageNumber, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ObjectId, (base.Item == null || base.Item.Id == null) ? null : base.Item.Id.ChangeKeyAsBase64String(), this.recipientWell, this.sortColumn, this.sortOrder);
        }