コード例 #1
0
        private void RunCommitServices(List <ValidationResult> repairList)
        {
            SettingsCollection _options = new SettingsCollection();

            foreach (ValidationResult itemToFix in repairList)
            {
                DateTimeRange _dateTimeRange    = new DateTimeRange();
                string        TargetPeriodStart = String.Empty;
                string        TargetPeriodEnd   = String.Empty;

                _dateTimeRange.Start = DateTimeSpecification.Parse(itemToFix.TargetPeriodStart.ToString());
                _dateTimeRange.End   = DateTimeSpecification.Parse(itemToFix.TargetPeriodEnd.ToString());

                string serviceName = Const.AdMetricsConst.WorkflowServices.CommitServiceName;
                ServiceClient <IScheduleManager> scheduleManager = new ServiceClient <IScheduleManager>();

                _options.Add("ConflictBehavior", "Ignore");
                _options.Add("DeliveryID", itemToFix.DeliveryID.ToString());

                //Run Service
                _options.Add(PipelineService.ConfigurationOptionNames.TimePeriod, _dateTimeRange.ToAbsolute().ToString());

                //bool result = _listner.FormAddToSchedule(serviceName, -1, DateTime.Now, _options, ServicePriority.Normal);
                //if (!result)
                //{
                //    MessageBox.Show(string.Format("Service {0} for account {1} did not run", serviceName, -1));
                //}
            }
        }
コード例 #2
0
        public void IsSatisfiedBy(string input, bool expected)
        {
            var  specification = new DateTimeSpecification();
            bool actual        = specification.IsSatisfiedBy(input);

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        private bool TryGetDeliveryTargetPeriod(string deliveryId, out DateTimeRange TargetPeriodDefinition)
        {
            TargetPeriodDefinition = new DateTimeRange();
            string TargetPeriodStart = String.Empty;
            string TargetPeriodEnd   = String.Empty;

            GetDeliveryTargetPeriodFromDB(deliveryId, out TargetPeriodStart, out TargetPeriodEnd);

            if (!string.IsNullOrEmpty(TargetPeriodStart) && !string.IsNullOrEmpty(TargetPeriodEnd))
            {
                TargetPeriodDefinition.Start = DateTimeSpecification.Parse(TargetPeriodStart);
                TargetPeriodDefinition.End   = DateTimeSpecification.Parse(TargetPeriodEnd);
                return(true);
            }
            return(false);
        }
コード例 #4
0
        public DateTime CreatePeriod(DateTimeSpecificationAlignment align, string year, string month, string day)        //, string hour = null, string minute = null, string second = null )
        {
            DateTime baseDateTime;

            try { baseDateTime = new DateTime(Int32.Parse(year), Int32.Parse(month), Int32.Parse(day)); }
            catch (Exception ex)
            {
                throw new MappingException(String.Format("Could not parse the date parts (y = '{0}', m = '{1}', d = '{2}'.", year, month, day), ex);
            }

            DateTime period = new DateTimeSpecification
            {
                Alignment    = align,
                BaseDateTime = baseDateTime
            }
            .ToDateTime();

            return(period);
        }
コード例 #5
0
 /// <summary>
 /// This Attribute identifies what part of a DateTime object should be used in the database,
 /// by default, the complete date and time is used.
 /// </summary>
 /// <param name="dateClass">The kind of the date</param>
 public DateTimeTypeAttribute(DateTimeSpecification dateClass = DateTimeSpecification.DateAndTime)
 {
     DateKind = dateClass;
 }