Esempio n. 1
0
 // Token: 0x06002EB6 RID: 11958 RVA: 0x0010BFA4 File Offset: 0x0010A1A4
 private void RenderOpenOtherUserFolderReponse(string folderClassName, OwaStoreObjectId folderId)
 {
     this.Writer.Write("<div id=fldrurl>");
     this.Writer.Write("?ae=Folder&t=");
     Utilities.HtmlEncode(Utilities.UrlEncode(folderClassName), this.Writer);
     this.Writer.Write("&id=");
     Utilities.HtmlEncode(Utilities.UrlEncode(folderId.ToBase64String()), this.Writer);
     this.Writer.Write("</div>");
 }
		// Token: 0x06002EC4 RID: 11972 RVA: 0x0010CA34 File Offset: 0x0010AC34
		private void RenderUpdateCountJavascript(OwaStoreObjectId folderId, ItemCountPair countPair)
		{
			this.Writer.Write("updCnt(\"");
			Utilities.JavascriptEncode(folderId.ToBase64String(), this.Writer);
			this.Writer.Write("\",");
			this.Writer.Write(countPair.ItemCount);
			this.Writer.Write(",");
			this.Writer.Write(countPair.UnreadItemCount);
			this.Writer.Write(");");
		}
Esempio n. 3
0
        // Token: 0x06002FE6 RID: 12262 RVA: 0x001178DC File Offset: 0x00115ADC
        public static void GetReceiverGSCalendarIdStringAndDisplayName(UserContext userContext, MeetingMessage item, out string id, out string displayName)
        {
            id          = string.Empty;
            displayName = null;
            ExchangePrincipal exchangePrincipal;

            if (userContext.DelegateSessionManager.TryGetExchangePrincipal(item.ReceivedRepresenting.EmailAddress, out exchangePrincipal))
            {
                OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromGSCalendarLegacyDN(exchangePrincipal.LegacyDn);
                id          = owaStoreObjectId.ToBase64String();
                displayName = exchangePrincipal.MailboxInfo.DisplayName;
            }
        }
Esempio n. 4
0
        private void ProcessOwaConditionAdvisors()
        {
            Dictionary <OwaStoreObjectId, OwaConditionAdvisor> conditionAdvisorTable = base.UserContext.NotificationManager.ConditionAdvisorTable;

            if (conditionAdvisorTable != null)
            {
                OwaStoreObjectId      remindersSearchFolderOwaId = base.UserContext.RemindersSearchFolderOwaId;
                bool                  flag = false;
                IDictionaryEnumerator dictionaryEnumerator = conditionAdvisorTable.GetEnumerator();
                while (dictionaryEnumerator.MoveNext())
                {
                    OwaConditionAdvisor owaConditionAdvisor = (OwaConditionAdvisor)dictionaryEnumerator.Value;
                    OwaStoreObjectId    folderId            = owaConditionAdvisor.FolderId;
                    try
                    {
                        MailboxSession mailboxSession = folderId.GetSession(base.UserContext) as MailboxSession;
                        if (mailboxSession != null)
                        {
                            bool flag2 = owaConditionAdvisor.IsConditionTrue(mailboxSession);
                            if (base.UserContext.UserOptions.EnableReminders && !flag && folderId.Equals(remindersSearchFolderOwaId))
                            {
                                flag = flag2;
                            }
                            if (flag2 || owaConditionAdvisor.IsRecycled)
                            {
                                if (!folderId.Equals(remindersSearchFolderOwaId))
                                {
                                    this.Writer.Write("stDrty(\"");
                                    Utilities.JavascriptEncode(folderId.ToBase64String(), this.Writer);
                                    this.Writer.Write("\");");
                                }
                                owaConditionAdvisor.ResetCondition(mailboxSession);
                                owaConditionAdvisor.IsRecycled = false;
                            }
                        }
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
                if (base.UserContext.UserOptions.EnableReminders)
                {
                    this.ProcessReminders(flag);
                }
            }
        }
        // Token: 0x06001EC6 RID: 7878 RVA: 0x000B13EC File Offset: 0x000AF5EC
        public string GetPrincipalCalendarFolderId(bool isCalendarItem)
        {
            string            result = null;
            ExchangePrincipal exchangePrincipal;

            if (this.CalendarItemBase != null && this.CalendarItemBase.ParentId != null)
            {
                OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(this.CalendarItemBase.ParentId, Utilities.GetMailboxSessionLegacyDN(this.CalendarItemBase));
                result = owaStoreObjectId.ToBase64String();
            }
            else if (!isCalendarItem && this.UserContext.DelegateSessionManager.TryGetExchangePrincipal((this.meetingPageItem as MeetingMessage).ReceivedRepresenting.EmailAddress, out exchangePrincipal))
            {
                using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, this.UserContext))
                {
                    OwaStoreObjectId owaStoreObjectId2 = Utilities.TryGetDefaultFolderId(this.UserContext, owaStoreObjectIdSessionHandle.Session as MailboxSession, DefaultFolderType.Calendar);
                    if (owaStoreObjectId2 == null)
                    {
                        throw new OwaAccessDeniedException(LocalizedStrings.GetNonEncoded(995407892));
                    }
                    result = owaStoreObjectId2.ToBase64String();
                }
            }
            return(result);
        }
Esempio n. 6
0
        // Token: 0x06002FD5 RID: 12245 RVA: 0x00116CC8 File Offset: 0x00114EC8
        private static SanitizedHtmlString BuildAdjacencyOrConflictSection(List <AdjacencyOrConflictInfo> appointments, string sectionTitle, UserContext userContext, OwaStoreObjectId folderId)
        {
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(128);

            sanitizingStringBuilder.Append("<div id=\"divCnfHdr\">");
            sanitizingStringBuilder.Append(sectionTitle);
            sanitizingStringBuilder.Append("</div>");
            foreach (AdjacencyOrConflictInfo adjacencyOrConflictInfo in appointments)
            {
                BusyType freeBusyStatus = adjacencyOrConflictInfo.FreeBusyStatus;
                bool     flag           = adjacencyOrConflictInfo.Sensitivity == Sensitivity.Private && folderId != null && folderId.IsOtherMailbox;
                sanitizingStringBuilder.Append("<div class=\"cnf\" id=\"divCnfItem\">");
                sanitizingStringBuilder.Append("<div id=\"divCnfIcnSbj\">");
                switch (freeBusyStatus)
                {
                case BusyType.Tentative:
                    userContext.RenderThemeImage(sanitizingStringBuilder.UnsafeInnerStringBuilder, ThemeFileId.Tentative, "tntv", new object[0]);
                    break;

                case BusyType.Busy:
                    userContext.RenderThemeImage(sanitizingStringBuilder.UnsafeInnerStringBuilder, ThemeFileId.Busy, "busy", new object[0]);
                    break;

                case BusyType.OOF:
                    userContext.RenderThemeImage(sanitizingStringBuilder.UnsafeInnerStringBuilder, ThemeFileId.OutOfOffice, "oof", new object[0]);
                    break;
                }
                sanitizingStringBuilder.Append("<span id=\"");
                sanitizingStringBuilder.Append(adjacencyOrConflictInfo.OccurrenceInfo.VersionedId.ObjectId.ToBase64String());
                if (adjacencyOrConflictInfo.GlobalObjectId != null)
                {
                    sanitizingStringBuilder.Append("\" gid=\"");
                    sanitizingStringBuilder.Append(Convert.ToBase64String(adjacencyOrConflictInfo.GlobalObjectId));
                }
                if (folderId != null)
                {
                    sanitizingStringBuilder.Append("\" fid=\"");
                    sanitizingStringBuilder.Append(folderId.ToBase64String());
                }
                sanitizingStringBuilder.Append("\"");
                if (!flag)
                {
                    sanitizingStringBuilder.Append(" class=\"IbL\" ");
                    sanitizingStringBuilder.Append <SanitizedEventHandlerString>(Utilities.GetScriptHandler("onclick", "Owa.Components.MeetingHelpers.onClickAppointment(_this);"));
                }
                sanitizingStringBuilder.Append(">");
                if (flag)
                {
                    sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(840767634));
                }
                else
                {
                    string text = string.Empty;
                    if (!string.IsNullOrEmpty(adjacencyOrConflictInfo.Subject))
                    {
                        text = adjacencyOrConflictInfo.Subject.Trim();
                    }
                    if (text.Length == 0)
                    {
                        sanitizingStringBuilder.Append(userContext.DirectionMark);
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(6409762));
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-776227687));
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-1023695022));
                        sanitizingStringBuilder.Append(userContext.DirectionMark);
                    }
                    else
                    {
                        sanitizingStringBuilder.Append(text);
                    }
                }
                sanitizingStringBuilder.Append("</span></div><div class=\"cnf\" id=\"divCnfLctTime\">");
                string     empty     = string.Empty;
                ExDateTime startTime = adjacencyOrConflictInfo.OccurrenceInfo.StartTime;
                ExDateTime endTime   = adjacencyOrConflictInfo.OccurrenceInfo.EndTime;
                TimeSpan   timeSpan  = endTime - startTime;
                if (startTime.Day != endTime.Day || timeSpan.TotalDays >= 1.0)
                {
                    sanitizingStringBuilder.Append <SanitizedHtmlString>(SanitizedHtmlString.Format(LocalizedStrings.GetNonEncoded(492249539), new object[]
                    {
                        startTime.ToString(userContext.UserOptions.DateFormat),
                        startTime.ToString(userContext.UserOptions.TimeFormat),
                        endTime.ToString(userContext.UserOptions.DateFormat),
                        endTime.ToString(userContext.UserOptions.TimeFormat)
                    }));
                }
                else
                {
                    sanitizingStringBuilder.Append <SanitizedHtmlString>(SanitizedHtmlString.Format(LocalizedStrings.GetNonEncoded(-792821726), new object[]
                    {
                        startTime.ToString(userContext.UserOptions.TimeFormat),
                        endTime.ToString(userContext.UserOptions.TimeFormat)
                    }));
                }
                sanitizingStringBuilder.Append("&nbsp;&nbsp;&nbsp;");
                if (!flag && adjacencyOrConflictInfo.Location != null && adjacencyOrConflictInfo.Location.Trim().Length > 0)
                {
                    sanitizingStringBuilder.Append(userContext.DirectionMark);
                    sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(6409762));
                    sanitizingStringBuilder.Append(adjacencyOrConflictInfo.Location);
                    sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-1023695022));
                    sanitizingStringBuilder.Append(userContext.DirectionMark);
                }
                sanitizingStringBuilder.Append("</div></div>");
            }
            return(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>());
        }
        public void Save()
        {
            ExTraceGlobals.TasksCallTracer.TraceDebug((long)this.GetHashCode(), "EditTaskEventHandler.Save");
            bool       flag       = base.IsParameterSet("Id");
            bool       flag2      = false;
            bool       flag3      = false;
            ExDateTime?exDateTime = null;
            Task       task       = this.GetTask(new PropertyDefinition[0]);

            try
            {
                if (!base.IsParameterSet("Id"))
                {
                    OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("fId");
                    if (owaStoreObjectId != null && owaStoreObjectId.IsOtherMailbox)
                    {
                        ADSessionSettings adSettings        = Utilities.CreateScopedADSessionSettings(base.UserContext.LogonIdentity.DomainName);
                        ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromLegacyDN(adSettings, owaStoreObjectId.MailboxOwnerLegacyDN);
                        task[TaskSchema.TaskOwner] = exchangePrincipal.MailboxInfo.DisplayName;
                    }
                    else
                    {
                        task[TaskSchema.TaskOwner] = base.UserContext.ExchangePrincipal.MailboxInfo.DisplayName;
                    }
                }
                if (base.IsParameterSet("subj"))
                {
                    task.Subject = (string)base.GetParameter("subj");
                }
                if (base.IsParameterSet("sd"))
                {
                    task.StartDate = this.GetDateValue("sd");
                }
                if (base.IsParameterSet("dd"))
                {
                    task.DueDate = this.GetDateValue("dd");
                }
                if (base.IsParameterSet("dc"))
                {
                    exDateTime = this.GetDateValue("dc");
                    if (exDateTime != null)
                    {
                        flag2 = true;
                    }
                }
                if (base.IsParameterSet("st"))
                {
                    TaskStatus taskStatus = (TaskStatus)base.GetParameter("st");
                    if (taskStatus == TaskStatus.Completed)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        TaskUtilities.SetIncomplete(task, taskStatus);
                    }
                }
                if (base.IsParameterSet("pri"))
                {
                    task[ItemSchema.Importance] = (Importance)base.GetParameter("pri");
                }
                if (base.IsParameterSet("pc"))
                {
                    double num = (double)((int)base.GetParameter("pc")) / 100.0;
                    if (!flag2 || num != 1.0)
                    {
                        if (num >= 0.0 && num < 1.0)
                        {
                            task.PercentComplete = num;
                        }
                        else if (num == 1.0)
                        {
                            flag2 = true;
                        }
                    }
                }
                if (base.IsParameterSet("rs"))
                {
                    bool flag4 = (bool)base.GetParameter("rs");
                    task[ItemSchema.ReminderIsSet] = flag4;
                    if (flag4 && base.IsParameterSet("rd"))
                    {
                        ExDateTime?dateValue = this.GetDateValue("rd");
                        if (dateValue != null)
                        {
                            task[ItemSchema.ReminderDueBy] = dateValue.Value;
                        }
                    }
                }
                if (base.IsParameterSet("ps"))
                {
                    task[ItemSchema.Sensitivity] = (((bool)base.GetParameter("ps")) ? Sensitivity.Private : Sensitivity.Normal);
                }
                if (base.IsParameterSet("tw"))
                {
                    int num2 = (int)base.GetParameter("tw");
                    if (num2 < 0 || num2 > 1525252319)
                    {
                        throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(-1310086288));
                    }
                    task[TaskSchema.TotalWork] = num2;
                }
                if (base.IsParameterSet("aw"))
                {
                    int num3 = (int)base.GetParameter("aw");
                    if (num3 < 0 || num3 > 1525252319)
                    {
                        throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(210380742));
                    }
                    task[TaskSchema.ActualWork] = num3;
                }
                if (base.IsParameterSet("mi"))
                {
                    task[TaskSchema.Mileage] = (string)base.GetParameter("mi");
                }
                if (base.IsParameterSet("bl"))
                {
                    task[TaskSchema.BillingInformation] = (string)base.GetParameter("bl");
                }
                if (base.IsParameterSet("co"))
                {
                    string   text = (string)base.GetParameter("co");
                    string[] value;
                    if (string.IsNullOrEmpty(text))
                    {
                        value = new string[0];
                    }
                    else
                    {
                        value = new string[]
                        {
                            text
                        };
                    }
                    task[TaskSchema.Companies] = value;
                }
                if (base.IsParameterSet("nt"))
                {
                    string text2 = (string)base.GetParameter("nt");
                    if (text2 != null)
                    {
                        BodyConversionUtilities.SetBody(task, text2, Markup.PlainText, base.UserContext);
                    }
                }
                if (base.IsParameterSet("RcrT"))
                {
                    Recurrence recurrence = base.CreateRecurrenceFromRequest();
                    if ((recurrence != null || task.Recurrence != null) && (recurrence == null || task.Recurrence == null || !recurrence.Equals(task.Recurrence)))
                    {
                        task.Recurrence = recurrence;
                        flag3           = true;
                    }
                }
                if (flag2 && exDateTime == null)
                {
                    if (task.CompleteDate == null)
                    {
                        exDateTime = new ExDateTime?(DateTimeUtilities.GetLocalTime());
                    }
                    else
                    {
                        exDateTime = new ExDateTime?(task.CompleteDate.Value);
                    }
                }
                if (!flag3 && flag2)
                {
                    task.SetStatusCompleted(exDateTime.Value);
                }
                Utilities.SaveItem(task, flag);
                task.Load();
                if (flag3 && flag2)
                {
                    OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromStoreObject(task);
                    string           changeKey         = task.Id.ChangeKeyAsBase64String();
                    task.Dispose();
                    task = Utilities.GetItem <Task>(base.UserContext, owaStoreObjectId2, changeKey, TaskUtilities.TaskPrefetchProperties);
                    task.SetStatusCompleted(exDateTime.Value);
                    Utilities.SaveItem(task);
                    task.Load();
                }
                if (!flag)
                {
                    OwaStoreObjectId owaStoreObjectId3 = OwaStoreObjectId.CreateFromStoreObject(task);
                    if (ExTraceGlobals.TasksDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        ExTraceGlobals.TasksDataTracer.TraceDebug <string>((long)this.GetHashCode(), "New task item ID is '{0}'", owaStoreObjectId3.ToBase64String());
                    }
                    this.Writer.Write("<div id=itemId>");
                    this.Writer.Write(owaStoreObjectId3.ToBase64String());
                    this.Writer.Write("</div>");
                }
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(task.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
                base.MoveItemToDestinationFolderIfInScratchPad(task);
            }
            finally
            {
                task.Dispose();
            }
        }
Esempio n. 8
0
        public void Delete()
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug((long)this.GetHashCode(), "CalendarViewEventHandler.Delete");
            OwaStoreObjectId owaStoreObjectId  = (OwaStoreObjectId)base.GetParameter("Id");
            OwaStoreObjectId owaStoreObjectId2 = (OwaStoreObjectId)base.GetParameter("fId");
            Item             item             = null;
            CalendarItemBase calendarItemBase = null;
            bool             flag             = true;

            try
            {
                item = Utilities.GetItem <Item>(base.UserContext, owaStoreObjectId, new PropertyDefinition[]
                {
                    StoreObjectSchema.EffectiveRights,
                    CalendarItemBaseSchema.MeetingRequestWasSent,
                    CalendarItemBaseSchema.IsOrganizer
                });
                calendarItemBase = (item as CalendarItemBase);
                if (calendarItemBase != null)
                {
                    if (!CalendarUtilities.UserCanDeleteCalendarItem(calendarItemBase) || Utilities.IsItemInExternalSharedInFolder(base.UserContext, calendarItemBase))
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=np></div>");
                        flag = false;
                    }
                    else if (!base.IsParameterSet("FD") && calendarItemBase.IsMeeting && calendarItemBase.MeetingRequestWasSent && calendarItemBase.IsOrganizer())
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=sc></div>");
                        flag = false;
                    }
                    else if (!base.IsParameterSet("FD") && !calendarItemBase.IsOrganizer() && !calendarItemBase.IsCancelled && !MeetingUtilities.IsCalendarItemEndTimeInPast(calendarItemBase))
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=sr></div>");
                        flag = false;
                    }
                    else if (!base.IsParameterSet("FD") && (owaStoreObjectId2.IsOtherMailbox || owaStoreObjectId2.IsGSCalendar))
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=sn></div>");
                        flag = false;
                    }
                }
                else if (!ItemUtility.UserCanDeleteItem(item))
                {
                    base.ResponseContentType = OwaEventContentType.Html;
                    this.Writer.Write("<div id=divOp _sOp=np></div>");
                    flag = false;
                }
                if (flag)
                {
                    bool flag2 = false;
                    if (base.IsParameterSet("Ntfy"))
                    {
                        flag2 = (bool)base.GetParameter("Ntfy");
                    }
                    if (flag2)
                    {
                        PrincipalNotificationMessage principalNotificationMessage = new PrincipalNotificationMessage(owaStoreObjectId.ToBase64String(), owaStoreObjectId2, base.UserContext, this.HttpContext, PrincipalNotificationMessage.ActionType.Delete, false, calendarItemBase.IsMeeting);
                        principalNotificationMessage.SendNotificationMessage();
                    }
                    bool flag3 = false;
                    if (base.IsParameterSet("Prm"))
                    {
                        flag3 = (bool)base.GetParameter("Prm");
                    }
                    DeleteItemFlags deleteItemFlags = DeleteItemFlags.None;
                    if (!owaStoreObjectId2.IsPublic)
                    {
                        if (calendarItemBase.IsOrganizer())
                        {
                            if (calendarItemBase.IsMeeting)
                            {
                                goto IL_269;
                            }
                            deleteItemFlags = DeleteItemFlags.CancelCalendarItem;
                            MeetingCancellation meetingCancellation = null;
                            try
                            {
                                try
                                {
                                    calendarItemBase.OpenAsReadWrite();
                                    meetingCancellation = calendarItemBase.CancelMeeting(null, null);
                                }
                                catch (ObjectNotFoundException)
                                {
                                }
                                catch (AccessDeniedException)
                                {
                                }
                                goto IL_269;
                            }
                            finally
                            {
                                if (meetingCancellation != null)
                                {
                                    meetingCancellation.Dispose();
                                }
                                meetingCancellation = null;
                            }
                        }
                        deleteItemFlags = DeleteItemFlags.DeclineCalendarItemWithoutResponse;
                    }
IL_269:
                    calendarItemBase.DeleteMeeting((flag3 ? DeleteItemFlags.SoftDelete : DeleteItemFlags.MoveToDeletedItems) | deleteItemFlags);
                    this.RenderPayload(new OwaStoreObjectId[]
                    {
                        owaStoreObjectId2
                    });
                }
            }
            catch (ObjectNotFoundException)
            {
                ExTraceGlobals.CalendarDataTracer.TraceDebug((long)this.GetHashCode(), "Calendar item could not be found.");
                throw;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
            }
        }
Esempio n. 9
0
        public void MoveAppointment()
        {
            OwaStoreObjectId owaStoreObjectId  = (OwaStoreObjectId)base.GetParameter("Id");
            string           changeKey         = (string)base.GetParameter("CK");
            OwaStoreObjectId owaStoreObjectId2 = (OwaStoreObjectId)base.GetParameter("fId");
            CalendarItemBase calendarItemBase  = null;
            bool             flag = false;

            if (base.IsParameterSet("chkms"))
            {
                flag = (bool)base.GetParameter("chkms");
            }
            try
            {
                calendarItemBase = Utilities.GetItem <CalendarItemBase>(base.UserContext, owaStoreObjectId, changeKey, new PropertyDefinition[]
                {
                    CalendarItemBaseSchema.IsMeeting,
                    CalendarItemBaseSchema.MeetingRequestWasSent,
                    StoreObjectSchema.EffectiveRights
                });
                if (!ItemUtility.UserCanEditItem(calendarItemBase) || Utilities.IsItemInExternalSharedInFolder(base.UserContext, calendarItemBase))
                {
                    base.ResponseContentType = OwaEventContentType.Html;
                    this.Writer.Write("<div id=divOp _sOp=np></div>");
                }
                else if (flag && calendarItemBase.IsMeeting && calendarItemBase.MeetingRequestWasSent)
                {
                    base.ResponseContentType = OwaEventContentType.Html;
                    if (owaStoreObjectId2.IsOtherMailbox)
                    {
                        this.Writer.Write("<div id=divOp _sOp=sfsu></div>");
                    }
                    else
                    {
                        this.Writer.Write("<div id=divOp _sOp=su></div>");
                    }
                }
                else if (flag && (owaStoreObjectId2.IsOtherMailbox || owaStoreObjectId2.IsGSCalendar))
                {
                    this.Writer.Write("<div id=divOp _sOp=sfma></div>");
                }
                else
                {
                    ExDateTime exDateTime  = (ExDateTime)base.GetParameter("ST");
                    ExDateTime exDateTime2 = (ExDateTime)base.GetParameter("ET");
                    if (exDateTime > exDateTime2)
                    {
                        exDateTime2 = exDateTime;
                    }
                    calendarItemBase.LocationIdentifierHelperInstance.SetLocationIdentifier(43167U, LastChangeAction.MoveAppointmentTime);
                    calendarItemBase.StartTime = exDateTime;
                    calendarItemBase.EndTime   = exDateTime2;
                    calendarItemBase.SetClientIntentBasedOnModifiedProperties(new ClientIntentFlags?(ClientIntentFlags.ModifiedTime));
                    if (!Utilities.IsPublic(calendarItemBase) && calendarItemBase.IsMeeting && calendarItemBase.MeetingRequestWasSent)
                    {
                        ExTraceGlobals.CalendarTracer.TraceDebug(0L, "Sending meeting update");
                        if (!calendarItemBase.IsOrganizer())
                        {
                            throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(1360823576));
                        }
                        calendarItemBase.SendMeetingMessages(true, null, false, true, null, null);
                    }
                    else
                    {
                        ConflictResolutionResult conflictResolutionResult = calendarItemBase.Save(SaveMode.ResolveConflicts);
                        if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                        {
                            throw new OwaEventHandlerException("Could not save calendar item due to conflict resolution failure", LocalizedStrings.GetNonEncoded(-482397486), OwaEventHandlerErrorCode.ConflictResolution);
                        }
                    }
                    bool flag2 = false;
                    if (base.IsParameterSet("Ntfy"))
                    {
                        flag2 = (bool)base.GetParameter("Ntfy");
                    }
                    if (flag2)
                    {
                        calendarItemBase.Load();
                        PrincipalNotificationMessage principalNotificationMessage = new PrincipalNotificationMessage(owaStoreObjectId.ToBase64String(), owaStoreObjectId2, base.UserContext, this.HttpContext, PrincipalNotificationMessage.ActionType.Move, false, calendarItemBase.IsMeeting);
                        principalNotificationMessage.SendNotificationMessage();
                    }
                    this.RenderPayload(new OwaStoreObjectId[]
                    {
                        owaStoreObjectId2
                    });
                }
            }
            catch (ObjectNotFoundException)
            {
                ExTraceGlobals.CalendarDataTracer.TraceDebug((long)this.GetHashCode(), "Calendar item could not be found");
                throw;
            }
            finally
            {
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
            }
        }
Esempio n. 10
0
 public void SetDateAndReminder()
 {
     using (Item item = this.GetItem())
     {
         MessageItem messageItem = item as MessageItem;
         if (messageItem != null && messageItem.IsDraft)
         {
             this.Writer.Write("var iError = 1;");
             this.Writer.Write("alrt(\"");
             this.Writer.Write(LocalizedStrings.GetJavascriptEncoded(-1537113578));
             this.Writer.Write("\", null, Owa.BUTTON_DIALOG_ICON.WARNING, L_Wrng);");
         }
         else
         {
             this.Writer.Write("var iError = 0;");
             ExDateTime?exDateTime  = null;
             ExDateTime?exDateTime2 = null;
             ExDateTime?dueBy       = null;
             if (base.IsParameterSet("sdt"))
             {
                 exDateTime = new ExDateTime?((ExDateTime)base.GetParameter("sdt"));
             }
             if (base.IsParameterSet("ddt"))
             {
                 exDateTime2 = new ExDateTime?((ExDateTime)base.GetParameter("ddt"));
             }
             if (base.IsParameterSet("rem"))
             {
                 dueBy = new ExDateTime?((ExDateTime)base.GetParameter("rem"));
             }
             if (exDateTime != null && exDateTime2 == null)
             {
                 throw new OwaInvalidRequestException("A due date must be provided if a start date is specified");
             }
             if (exDateTime != null && exDateTime2 != null && exDateTime2 < exDateTime)
             {
                 throw new OwaInvalidRequestException("The due date must be on or after the start date");
             }
             Task task = item as Task;
             if (task != null)
             {
                 task.StartDate = exDateTime;
                 task.DueDate   = exDateTime2;
                 task.SetStatusInProgress();
             }
             else
             {
                 item.SetFlag(LocalizedStrings.GetNonEncoded(-1950847676), exDateTime, exDateTime2);
             }
             if (item.Reminder != null)
             {
                 if (dueBy != null)
                 {
                     item.Reminder.IsSet = true;
                     item.Reminder.DueBy = dueBy;
                 }
                 else
                 {
                     item.Reminder.IsSet = false;
                 }
             }
             Utilities.SaveItem(item);
             item.Load(new PropertyDefinition[]
             {
                 ItemSchema.FlagStatus,
                 ItemSchema.FlagCompleteTime
             });
             this.Writer.Write("var iFA = ");
             this.Writer.Write((int)FlagContextMenu.GetFlagActionForItem(base.UserContext, item));
             this.Writer.Write(";");
             InfobarMessage flag = InfobarMessageBuilder.GetFlag(item, base.UserContext);
             this.Writer.Write("var sIBMsg = \"");
             if (flag != null)
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 StringWriter  stringWriter  = new StringWriter(stringBuilder);
                 Infobar.RenderMessage(stringWriter, flag, base.UserContext);
                 stringWriter.Close();
                 Utilities.JavascriptEncode(stringBuilder.ToString(), this.Writer);
             }
             this.Writer.Write("\";");
             OwaStoreObjectId owaStoreObjectId = base.GetParameter("id") as OwaStoreObjectId;
             this.Writer.Write("sId = \"");
             Utilities.JavascriptEncode((owaStoreObjectId == null) ? Utilities.GetIdAsString(item) : owaStoreObjectId.ToBase64String(), this.Writer);
             this.Writer.Write("\";");
             this.Writer.Write("sCK = \"");
             if (owaStoreObjectId == null || !owaStoreObjectId.IsConversationId)
             {
                 Utilities.JavascriptEncode(item.Id.ChangeKeyAsBase64String(), this.Writer);
             }
             this.Writer.Write("\";");
             this.Writer.Write("var dtDD = ");
             if (exDateTime2 != null)
             {
                 this.Writer.Write("new Date(\"");
                 this.Writer.Write(DateTimeUtilities.GetJavascriptDate(exDateTime2.Value));
                 this.Writer.Write("\");");
             }
             else
             {
                 this.Writer.Write("0;");
             }
         }
     }
 }