protected void btnAddNotification_OnCommand(object sender, CommandEventArgs e) { Business.Event notification = new Kindred.Knect.ITAT.Business.Event(Kindred.Knect.ITAT.Business.EventType.Custom, _template.IsManagedItem); notification.Name = "New Notification"; notification.BaseDateTermID = Guid.Empty; notification.BaseDateOffset = ""; Business.Message message = new Kindred.Knect.ITAT.Business.Message(); message.NotificationStatuses.Clear(); message.NotificationStatuses.Add(Business.XMLNames._M_AllStatuses); message.Subject = string.Empty; message.Text = Helper.DefaultEditorHtml(this.edt); notification.Messages.Add(message); _template.Events.Add(notification); LoadDateTermsAndNotifications(); int nIndex = 0; foreach (ListItem item in lstNotifications.Items) { if (item.Text == "New Notification") { lstNotifications.SelectedIndex = nIndex; btnDeleteNotification.Enabled = true; string[] segments = lstNotifications.SelectedValue.Split('|'); //segments[0] indicates NotificationType //on workflow notifications, segments[1] = state name, segments[2] = action TargetState Business.EventType notificationType = Business.EventTypeHelper.GetNotificationType(segments[0]); SetPropertyValues(notificationType, lstNotifications.SelectedItem.Text, segments); break; } nIndex++; } IsChanged = true; }
public Message Copy() { Message message = new Message(); message.Subject = Subject; message.FilterFacilityTermID = FilterFacilityTermID; message.Text = Text; message.Recipients.Clear(); foreach (string recipient in Recipients) { message.Recipients.Add(recipient); } message.NotificationStatuses.Clear(); foreach (string notificationStatus in NotificationStatuses) { message.NotificationStatuses.Add(notificationStatus); } return message; }
public Event(XmlNode scheduledEventNode, bool IsManagedItem) { _isManagedItem = IsManagedItem; string idString = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_ID); if (string.IsNullOrEmpty(idString)) _id = Guid.NewGuid(); else _id = new Guid(idString); _isRef = Utility.XMLHelper.GetAttributeBool(scheduledEventNode, XMLNames._A_IsRef); _name = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_Name); _description = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_Description); _eventType = (EventType)Enum.Parse(typeof(EventType), Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_EventType)); _baseDateTermName = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_BaseDateTermName); _offsetTermName = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_OffsetTermName); _baseDateTermID = Term.CreateID(scheduledEventNode, XMLNames._A_BaseDateTermID); _baseDateTermPart = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_BaseDateTermPart); _offsetTermID = Term.CreateID(scheduledEventNode, XMLNames._A_OffsetTermID); _offsetDefaultValue = 0; string sOffsetDefaultValue = Utility.XMLHelper.GetAttributeString(scheduledEventNode, XMLNames._A_OffsetDefaultValue); if (!string.IsNullOrEmpty(sOffsetDefaultValue)) { try { _offsetDefaultValue += int.Parse(sOffsetDefaultValue); } catch { } } XmlNodeList listScheduledEvents = scheduledEventNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_ScheduledEvents, XMLNames._E_ScheduledEvent)); if (listScheduledEvents != null && listScheduledEvents.Count > 0) { _scheduledEvents = new List<ScheduledEvent>(listScheduledEvents.Count); foreach (XmlNode nodeScheduledEvent in listScheduledEvents) { ScheduledEvent scheduledEvent = new ScheduledEvent(nodeScheduledEvent, _id, IsManagedItem); _scheduledEvents.Add(scheduledEvent); } } else { _scheduledEvents = new List<ScheduledEvent>(); } XmlNodeList listMessages = scheduledEventNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_Messages,XMLNames._E_Message)); if (listMessages != null && listMessages.Count > 0) { _messages = new List<Message>(listMessages.Count); foreach (XmlNode nodeMessage in listMessages) { Message message = new Message(nodeMessage); _messages.Add(message); } } else { _messages = new List<Message>(); } }
public Action(XmlNode termNode, Workflow workflow) { _workflow = workflow; _buttonText = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_ButtonText); _requiresConfirmation = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_RequiresConfirmation) ?? false; _confirmationText = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_ConfirmationText); try { string targetStateID = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_TargetStateID); _targetStateID = new Guid(targetStateID); _targetStateIDDefined = true; } catch { _targetStateIDDefined = false; try { _targetState = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_TargetState); } catch { } } XmlNodeList listMessages = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_Messages,XMLNames._E_Message)); if (listMessages != null && listMessages.Count > 0) { _messages = new List<Message>(listMessages.Count); foreach (XmlNode nodeMessage in listMessages) { Message message = new Message(nodeMessage); _messages.Add(message); } } else { _messages = new List<Message>(1); _messages.Add(new Message()); } XmlNodeList listPerformers = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_Performers,XMLNames._E_Performer)); if (listPerformers != null && listPerformers.Count > 0) { _performers = new List<string>(listPerformers.Count); foreach (XmlNode nodePerformer in listPerformers) { string sRole = Utility.XMLHelper.GetAttributeString(nodePerformer, XMLNames._A_Role); _performers.Add(sRole); } } else { _performers = new List<string>(); } }
private bool SetEventMessage(EventType messageEventType, Message message) { Event messageEvent = GetEvent(messageEventType); if (message == null) { //Note - message == null is interpreted as a command to delete the event. return DeleteEvent(messageEventType); } else { //Add the message - assume it is to be the ONLY message. if (messageEvent.Messages == null) messageEvent.Messages = new List<Message>(1); int nCount = messageEvent.Messages.Count; for (int i = 0; i < nCount; i++) messageEvent.Messages.RemoveAt(0); messageEvent.Messages.Add(message); } return true; }