Exemplo n.º 1
0
        public static decimal RandomCprNumber(NumDigits numDigits = NumDigits.NoneSpecified)
        {
            string day = "";

            switch (numDigits)
            {
            case NumDigits.NoneSpecified:
                day = Random.Next(1, 29).ToString("00");
                break;

            case NumDigits.Ten:
                day = Random.Next(10, 29).ToString("00");
                break;

            case NumDigits.Nine:
                day = Random.Next(1, 10).ToString("00");
                break;
            }

            var month = Random.Next(1, 13).ToString("00");
            var year  = Random.Next(1, 100).ToString("00");
            var part1 = Random.Next(1000, 9999).ToString();

            return(decimal.Parse(day + month + year + part1));
        }
Exemplo n.º 2
0
        protected override void Execute(NativeActivityContext context)
        {
            var twilio      = context.GetExtension <ITwilioContext>();
            var timeout     = Timeout.Get(context);
            var finishOnKey = FinishOnKey.Get(context);
            var numDigits   = NumDigits.Get(context);

            var finishUrl = twilio.ResolveBookmarkUrl(context.CreateTwilioBookmark(OnFinish));

            // append gather element
            var element = new XElement("Gather",
                                       new XAttribute("action", finishUrl),
                                       timeout != null ? new XAttribute("timeout", ((TimeSpan)timeout).TotalSeconds) : null,
                                       finishOnKey != null ? new XAttribute("finishOnKey", finishOnKey) : null,
                                       numDigits != null ? new XAttribute("numDigits", numDigits) : null);

            // write gather element
            GetElement(context).Add(
                element,
                new XElement("Redirect", finishUrl));

            if (Body != null)
            {
                SetElement(context, element);
                context.ScheduleActivity(Body);
            }
        }
Exemplo n.º 3
0
        public static decimal[] RandomCprNumbers(int count, NumDigits numDigits = NumDigits.NoneSpecified)
        {
            var cprNumbers = new List <decimal>();

            for (int i = 0; i < count; i++)
            {
                cprNumbers.Add(RandomCprNumber(numDigits));
            }
            return(cprNumbers.ToArray());
        }