public void GetComplianceInfobar() { string g = (string)base.GetParameter("cguid"); Guid empty = Guid.Empty; if (GuidHelper.TryParseGuid(g, out empty)) { InfobarMessage compliance = InfobarMessageBuilder.GetCompliance(base.UserContext, empty); if (compliance != null) { Infobar.RenderMessage(this.Writer, compliance, base.UserContext); } } }
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;"); } } } }
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;"); } } }