コード例 #1
0
 /// <summary>
 /// This method Updates Event with specified id and specified information
 /// </summary>
 /// <param name="eventType">The eventType</param>
 /// <returns>The completion status of update operation</returns>        
 public virtual bool UpdateEvent(EventType eventType)
 {
     return this.Business.UpdateEvent(eventType);
 }
コード例 #2
0
        private void createSubscription(int subscriberId, int eventId, NotificationTypes nType)
        {

            EventType selectedEvent = new EventType() { ID = eventId };
            NotificationEndpoint notificationEP;
            Subscription subscription = new Subscription() { SubscriberID = subscriberId, EventType = selectedEvent };
            string emailEP;
            string smsEP;
            string webhookEP;

            if (nType == NotificationTypes.Email)
            {
                emailEP = txtBoxEmail.Text.Trim();
                bool emailCheck = IsValidEmail(emailEP);
                if (!emailCheck)
                {
                    MessageBox.Show("Invalid EmailID");
                }
                else
                {
                    if (string.Compare(emailEP, "") != 0)
                    {
                        notificationEP = new EmailNotificationSetting() { NotificationType = nType, EmailAddress = emailEP };
                        subscription.NotificationEndpoint = notificationEP;
                        SubscriptionBusiness.Subscribe(subscription);
                    }
                }
            }
            if (nType == NotificationTypes.SMS)
            {
                smsEP = txtBoxSMS.Text.Trim();
                bool phoneCheck = isValidPhoneNumber(smsEP);
                if (!phoneCheck)
                {
                    MessageBox.Show("Invalid Phone Number");
                }
                else
                {
                    if (string.Compare(smsEP, "") != 0)
                    {
                        notificationEP = new SmsNotificationSetting() { NotificationType = nType, PhoneNumber = smsEP };
                        subscription.NotificationEndpoint = notificationEP;
                        SubscriptionBusiness.Subscribe(subscription);
                    }
                }

            }
            if (nType == NotificationTypes.Webhook)
            {
                webhookEP = txtBoxWebhook.Text.Trim();
                bool webhookCheck = Uri.IsWellFormedUriString(webhookEP, UriKind.RelativeOrAbsolute);
                bool webhookhttp = IsValidUrl(webhookEP);
                if (!webhookCheck || webhookhttp == false)
                {
                    MessageBox.Show("Invalid URL");
                }
                else
                {
                    if (string.Compare(webhookEP, "") != 0)
                    {
                        notificationEP = new WebhookNotificationSetting() { NotificationType = nType, Url = webhookEP };
                        subscription.NotificationEndpoint = notificationEP;
                        SubscriptionBusiness.Subscribe(subscription);
                    }
                }

            }
        }
コード例 #3
0
        /// <summary>
        /// The GetEvent method gets the event for the corresponding ID
        /// </summary>
        /// <param name="eventTypeId">The eventTypeId parameter</param>
        /// <returns>returns the event</returns>        
        public EventType GetEvent(int eventTypeId)
        {
            EventType eventType = new EventType();
            
            List<DbParameter> parameters = new List<DbParameter>();
            parameters.Add(new IntParameter(Constants.Parameters.EventTypeId, eventTypeId));
           
            using (IDataReader reader = ExecuteStoredProcReader(Constants.StoredProcedures.GetEventType, parameters))
            {
                while (reader.Read())
                {
                    eventType.ID = eventTypeId;
                    eventType.Name = reader[1].ToString();
                    eventType.Description = reader[2].ToString();
                    break;
                }
            }

            return eventType;
        }
コード例 #4
0
 /// <summary>
 /// This method raises event of specified event type
 /// </summary>
 /// <param name="eventType">The eventType</param>
 /// <returns>The raised event type</returns>        
 public virtual EventType Raise(EventType eventType)
 {
     return this.Business.Raise(eventType);
 }
コード例 #5
0
        /// <summary>
        /// The UpdateEvent method updates an event
        /// </summary>
        /// <param name="eventtype">The event type parameter</param>
        /// <returns>The boolean type object</returns>        
        public bool UpdateEvent(EventType eventtype)
        {
            int eventTypeId = eventtype.ID;
            string name = eventtype.Name;
            string description = eventtype.Description;

            List<DbParameter> parameters = new List<DbParameter>();
            parameters.Add(new IntParameter(Constants.Parameters.EventTypeId, eventTypeId));
            parameters.Add(new StringParameter(Constants.Parameters.Name, name));
            parameters.Add(new StringParameter(Constants.Parameters.Description, description));

            int rows = ExecuteStoredProcNonQuery(Constants.StoredProcedures.UpdateEventType, parameters);
            if (rows == 1)
            {
                return true;
            }

            return false;
        }
コード例 #6
0
 /// <summary>
 /// This method updates event with given id
 /// </summary>
 /// <param name="eventType">The event</param>
 /// <returns>The status of update</returns>        
 public override bool UpdateEvent(EventType eventType)
 {
     return Business.UpdateEventV2(eventType);
 }
コード例 #7
0
        /// <summary>
        /// The GetEvent method gets the event
        /// </summary>
        /// <param name="eventTypeId">The eventTypeId parameter</param>
        /// <returns>returns the event type</returns>        
        public EventType GetEvent(int eventTypeId)
        {
            EventType newEvent = new EventType();

            List<DbParameter> parameters = new List<DbParameter>();
            parameters.Add(new IntParameter(Constants.Parameters.EventTypeId, eventTypeId));

            using (IDataReader reader = ExecuteStoredProcReader("GetEventFromID", parameters))
            {
                while (reader.Read())
                {
                    newEvent.ID = eventTypeId;
                    newEvent.Name = reader[1].ToString();
                    newEvent.Description = reader[2].ToString();
                }
            }

            return newEvent;
        }
コード例 #8
0
 /// <summary>
 /// The Raise method
 /// </summary>
 /// <param name="eventType">The eventType parameter</param>
 /// <returns>returns eventtype object</returns>        
 public EventType Raise(EventType eventType)
 {
     return eventType;
 }
コード例 #9
0
 /// <summary>
 /// The UpdateEventV2 method
 /// </summary>
 /// <param name="eventType">The eventType parameter</param>
 /// <returns>returns true or false respectively</returns>        
 public bool UpdateEventV2(EventType eventType)
 {
     return this.EventTypeDAL.UpdateEvent(eventType);
 }