Ejemplo n.º 1
0
 public void SendAlert()
 {
     if (IsValid())
     {
         var props = Writer.EnsureProperties(properties);
         props.Add(XFConstants.EventWriter.EventType, EventTypeOption.Alert);
         props.Add(XFConstants.Alert.Title, Title);
         props.Add(XFConstants.Alert.Message, Message);
         props.Add(XFConstants.Alert.Categories, Categories.ToString());
         props.Add(XFConstants.Alert.Urgency, Urgency.ToString());
         props.Add(XFConstants.Alert.Importance, Importance.ToString());
         props.Add(XFConstants.Alert.Targets, Audiences.ToString());
         props.Add(XFConstants.Alert.Source, Source);
         props.Add(XFConstants.Alert.CreatedAt, DateTime.Now.ToString(XFConstants.DateTimeFormat));
         if (!String.IsNullOrEmpty(Error))
         {
             props.Add(XFConstants.Alert.Error, Error);
         }
         if (!String.IsNullOrWhiteSpace(Stacktrace))
         {
             props.Add(XFConstants.Alert.StackTrace, Stacktrace);
         }
         if (!String.IsNullOrWhiteSpace(NamedRecipient))
         {
             props.Add(XFConstants.Alert.NamedTarget, NamedRecipient);
         }
         if (!String.IsNullOrWhiteSpace(Topic))
         {
             props.Add(XFConstants.Alert.Topic, Topic);
         }
         List <TypedItem> list = Writer.Convert(props);
         EventWriter.Write(EventTypeOption.Alert, list);
     }
 }
Ejemplo n.º 2
0
        public PublishResponse SendText(string phone, string message, double MaxPrice = 0.0065, Urgency urgency = Urgency.Promotional, SenderID senderID = null)
        {
            AmazonSimpleNotificationServiceClient snsClient = new AmazonSimpleNotificationServiceClient(accessKey, secretKey, Amazon.RegionEndpoint.USEast1);
            PublishRequest pubRequest = new PublishRequest();

            pubRequest.Message     = message;
            pubRequest.PhoneNumber = phone;

            if (senderID != null && senderID.HasValue())
            {
                pubRequest.MessageAttributes["AWS.SNS.SMS.SenderID"] =
                    new MessageAttributeValue {
                    StringValue = senderID.Value, DataType = "String"
                };
            }
            pubRequest.MessageAttributes["AWS.SNS.SMS.MaxPrice"] =
                new MessageAttributeValue {
                StringValue = MaxPrice.ToString(), DataType = "Number"
            };
            pubRequest.MessageAttributes["AWS.SNS.SMS.SMSType"] =
                new MessageAttributeValue {
                StringValue = urgency.ToString(), DataType = "String"
            };
            // add optional MessageAttributes, for example:
            //   pubRequest.MessageAttributes.Add("AWS.SNS.SMS.SenderID", new MessageAttributeValue
            //      { StringValue = "SenderId", DataType = "String" });
            PublishResponse pubResponse = snsClient.PublishAsync(pubRequest).Result;

            return(pubResponse);
        }
        public bool IncidentExist(IncidentType incidentType, Urgency urgency, string shortDescription, string MoreInformation)
        {
            SeleniumDriver.Instance.SwitchTo().ParentFrame();
            SeleniumDriver.Instance.SwitchTo().Frame("gsft_main");
            AbtPages.TablePageObject.FirstRowItem.Click();


            if (!SelfServiceContact.Selected)
            {
                Console.WriteLine("Self Service is not Selected on Contact Type");
                Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                return(false);
            }

            if (!ShortDescription.GetAttribute("value").Equals(shortDescription))
            {
                Console.WriteLine("Short Description shown on this incident is not the same as the incident just created before");
                Console.WriteLine(ShortDescription.Text);
                Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                return(false);
            }

            if (!Description.Text.Equals(MoreInformation))
            {
                Console.WriteLine("Description shown on this incident is not the same as the incident just created before");
                Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                return(false);
            }

            switch (incidentType)
            {
            case IncidentType.Ask_A_Question:
                if (!UrgencySelected.Text.Split('-')[1].Trim().Equals(urgency.ToString()))
                {
                    Console.WriteLine("Urgency shown on this incident is not the same as the incident just created before");
                    Console.WriteLine(UrgencySelected.GetAttribute("value"));
                    Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                    return(false);
                }
                break;

            case IncidentType.IT_Incident:

                if (!ImpactSelected.Text.Split('-')[1].Trim().Equals(urgency.ToString()))
                {
                    Console.WriteLine("Impact shown on this incident is not the same as the incident just created before");
                    Console.WriteLine(UrgencySelected.GetAttribute("value"));
                    Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                    return(false);
                }
                break;

            default:
                break;
            }


            if (!Request.GetAttribute("checked").Equals("true"))
            {
                Console.WriteLine("Request is not checked");
                Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                return(false);
            }

            if (!AssignmentGroup.GetAttribute("value").Equals("SD_General_IT"))
            {
                Console.WriteLine("Assignment Group Should be SD_General_IT ");
                Console.WriteLine("Incident info doesn't match with values found on Incident: " + IncidentNumber.GetAttribute("value"));
                return(false);
            }

            return(true);
        }