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);
                }
            }
        }
Ejemplo n.º 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;");
                }
            }
        }