コード例 #1
0
        public void MarkComplete()
        {
            ExTraceGlobals.TasksCallTracer.TraceDebug((long)this.GetHashCode(), "TaskVirtualListViewEventHandler.MarkComplete");
            bool flag = base.IsParameterSet("mkIncmp") && (bool)base.GetParameter("mkIncmp");

            OwaStoreObjectId[] array = (OwaStoreObjectId[])base.GetParameter("Itms");
            for (int i = 0; i < array.Length; i++)
            {
                using (Item item = Utilities.GetItem <Item>(base.UserContext, array[i], this.prefetchProperties))
                {
                    TaskVirtualListViewEventHandler.ThrowIfAssignedTask(item);
                    item.OpenAsReadWrite();
                    if (!flag)
                    {
                        FlagEventHandler.FlagComplete(item);
                    }
                    else
                    {
                        FlagEventHandler.SetFlag(item, FlagAction.Default, null);
                    }
                    Utilities.SaveItem(item);
                }
            }
        }
コード例 #2
0
        public void FlagItem()
        {
            FlagAction flagAction = (FlagAction)base.GetParameter("flga");
            ExDateTime?dueDate    = null;

            if (flagAction == FlagAction.SpecificDate)
            {
                if (!base.IsParameterSet("ddt"))
                {
                    throw new OwaInvalidRequestException("Due date must be provided if specifying a specific due date");
                }
                dueDate = new ExDateTime?((ExDateTime)base.GetParameter("ddt"));
            }
            using (Item item = this.GetItem())
            {
                MessageItem messageItem = item as MessageItem;
                if (messageItem != null && messageItem.IsDraft)
                {
                    throw new OwaOperationNotSupportedException(LocalizedStrings.GetNonEncoded(804173896));
                }
                switch (flagAction)
                {
                case FlagAction.MarkComplete:
                    FlagEventHandler.FlagComplete(item);
                    break;

                case FlagAction.ClearFlag:
                    FlagEventHandler.ClearFlag(item);
                    break;

                default:
                    dueDate = FlagEventHandler.SetFlag(item, flagAction, dueDate);
                    break;
                }
                Utilities.SaveItem(item);
                PropertyDefinition[] properties = new PropertyDefinition[]
                {
                    ItemSchema.FlagStatus,
                    ItemSchema.FlagCompleteTime,
                    MessageItemSchema.ReplyTime
                };
                item.Load(properties);
                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("\";");
                this.Writer.Write("a_sId = \"");
                Utilities.JavascriptEncode(Utilities.GetIdAsString(item), this.Writer);
                this.Writer.Write("\";");
                this.Writer.Write("a_sCK = \"");
                Utilities.JavascriptEncode(item.Id.ChangeKeyAsBase64String(), this.Writer);
                this.Writer.Write("\";");
                this.Writer.Write("var dtDD = ");
                if (dueDate != null)
                {
                    this.Writer.Write("new Date(\"");
                    this.Writer.Write(DateTimeUtilities.GetJavascriptDate(dueDate.Value));
                    this.Writer.Write("\");");
                }
                else
                {
                    this.Writer.Write("0;");
                }
            }
        }
コード例 #3
0
        public void GetFlagDialog()
        {
            ExDateTime       date                      = DateTimeUtilities.GetLocalTime().Date;
            ExDateTime       exDateTime                = ExDateTime.MinValue;
            ExDateTime       exDateTime2               = ExDateTime.MinValue;
            ExDateTime       exDateTime3               = ExDateTime.MinValue;
            bool             flag                      = false;
            FlagStatus       flagStatus                = FlagStatus.NotFlagged;
            bool             flag2                     = true;
            OwaStoreObjectId owaStoreObjectId          = base.GetParameter("fldrId") as OwaStoreObjectId;
            OwaStoreObjectId latestFlaggedOrNormalItem = this.GetLatestFlaggedOrNormalItem();

            if (latestFlaggedOrNormalItem != null)
            {
                using (Item item = Utilities.GetItem <Item>(base.UserContext, latestFlaggedOrNormalItem, FlagEventHandler.prefetchProperties))
                {
                    flag2      = (!Utilities.IsPublic(item) && !(item is MeetingMessage));
                    flagStatus = FlagEventHandler.GetFlagStatus(item);
                    exDateTime = ItemUtility.GetProperty <ExDateTime>(item, TaskSchema.StartDate, ExDateTime.MinValue);
                    if (exDateTime.Year <= 1601)
                    {
                        exDateTime = ExDateTime.MinValue;
                    }
                    exDateTime2 = ItemUtility.GetProperty <ExDateTime>(item, TaskSchema.DueDate, ExDateTime.MinValue);
                    if (exDateTime2.Year <= 1601)
                    {
                        exDateTime2 = ExDateTime.MinValue;
                    }
                    flag = ItemUtility.GetProperty <bool>(item, ItemSchema.ReminderIsSet, false);
                    if (flag)
                    {
                        exDateTime3 = ItemUtility.GetProperty <ExDateTime>(item, ItemSchema.ReminderDueBy, ExDateTime.MinValue);
                        if (exDateTime3.Year <= 1601)
                        {
                            exDateTime3 = ExDateTime.MinValue;
                        }
                    }
                }
            }
            if (owaStoreObjectId != null)
            {
                flag2 = !owaStoreObjectId.IsPublic;
            }
            if (flagStatus == FlagStatus.NotFlagged)
            {
                if (exDateTime2 == ExDateTime.MinValue)
                {
                    exDateTime2 = DateTimeUtilities.GetLocalTime().Date;
                }
                if (exDateTime == ExDateTime.MinValue || exDateTime > exDateTime2)
                {
                    exDateTime = exDateTime2;
                }
            }
            if (exDateTime3 == ExDateTime.MinValue)
            {
                if (exDateTime == ExDateTime.MinValue || exDateTime == date)
                {
                    exDateTime3 = date;
                    int num = base.UserContext.WorkingHours.GetWorkDayEndTime(exDateTime3) - 60;
                    exDateTime3 = exDateTime3.AddMinutes((double)num);
                }
                else
                {
                    exDateTime3 = exDateTime;
                    exDateTime3 = exDateTime3.AddMinutes((double)base.UserContext.WorkingHours.GetWorkDayStartTime(exDateTime3));
                }
            }
            RenderingUtilities.RenderStringVariable(this.Writer, "sDT", LocalizedStrings.GetNonEncoded(-941242639));
            StringBuilder stringBuilder = new StringBuilder();
            StringWriter  stringWriter  = new StringWriter(stringBuilder);

            stringWriter.Write("<table class=flgDtRm><col><col class=pkr><tr><td nowrap>");
            stringWriter.Write(LocalizedStrings.GetHtmlEncoded(1089701318));
            stringWriter.Write("</td><td nowrap>");
            DatePickerDropDownCombo.RenderDatePicker(stringWriter, "tblFlgSD", exDateTime, date, DatePicker.Features.TodayButton | DatePicker.Features.NoneButton);
            stringWriter.Write("</td></tr>");
            stringWriter.Write("<tr><td>");
            stringWriter.Write(LocalizedStrings.GetHtmlEncoded(1012104992));
            stringWriter.Write("</td><td>");
            DatePickerDropDownCombo.RenderDatePicker(stringWriter, "tblFlgDD", exDateTime2, date, DatePicker.Features.TodayButton | DatePicker.Features.NoneButton);
            stringWriter.Write("</td></tr>");
            if (flag2)
            {
                stringWriter.Write("<tr><td colspan=2 nowrap><input type=checkbox id=chkRM");
                if (flag)
                {
                    stringWriter.Write(" checked");
                }
                stringWriter.Write("><label for=chkRM> ");
                stringWriter.Write(LocalizedStrings.GetHtmlEncoded(-1024614879));
                stringWriter.Write("</label></td></tr>");
                stringWriter.Write("<tr><td nowrap class=rmd>");
                stringWriter.Write(LocalizedStrings.GetHtmlEncoded(-1966747526));
                stringWriter.Write("</td><td>");
                DatePickerDropDownCombo.RenderDatePicker(stringWriter, "tblFlgRD", exDateTime3);
                stringWriter.Write("</td></tr>");
                stringWriter.Write("<tr><td nowrap class=rmd>");
                stringWriter.Write(LocalizedStrings.GetHtmlEncoded(-837446999));
                stringWriter.Write("</td><td>");
                TimeDropDownList.RenderTimePicker(stringWriter, exDateTime3, "divFlgRT");
                stringWriter.Write("</td></tr>");
            }
            stringWriter.Write("</table>");
            stringWriter.Close();
            RenderingUtilities.RenderStringVariable(this.Writer, "sD", stringBuilder.ToString());
        }