Esempio n. 1
0
        public void GetFlagMenu()
        {
            ExDateTime       defaultDate      = DateTimeUtilities.GetLocalTime().Date;
            OwaStoreObjectId owaStoreObjectId = base.GetParameter("id") as OwaStoreObjectId;
            FlagAction       flagAction       = FlagAction.None;

            if (owaStoreObjectId != null)
            {
                using (Item item = Utilities.GetItem <Item>(base.UserContext, owaStoreObjectId, FlagEventHandler.prefetchProperties))
                {
                    ExDateTime property = ItemUtility.GetProperty <ExDateTime>(item, TaskSchema.DueDate, ExDateTime.MinValue);
                    if (1601 < property.Year)
                    {
                        defaultDate = property;
                    }
                    flagAction = FlagContextMenu.GetFlagActionForItem(base.UserContext, item);
                }
            }
            FlagContextMenu flagContextMenu = new FlagContextMenu(base.UserContext, defaultDate, flagAction);

            flagContextMenu.Render(this.Writer);
        }
Esempio n. 2
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;");
             }
         }
     }
 }