Exemplo n.º 1
0
        public object Clone()
        {
            DayPart dayPart = (DayPart)MemberwiseClone();

            if (Timeslices != null)
            {
                dayPart.Timeslices = new List <Timeslice>();
                Timeslices.ForEach(ts => dayPart.Timeslices.Add((Timeslice)ts.Clone()));
            }

            return(dayPart);
        }
Exemplo n.º 2
0
        public void Validation()
        {
            IValidation validation = new RequiredFieldValidation()
            {
                Field = new List <ValidationInfo>()
                {
                    new ValidationInfo()
                    {
                        FieldName = "Time Slices", FieldToValidate = Timeslices
                    }
                }
            };

            validation.Execute();
            if (Timeslices != null && Timeslices.Any())
            {
                Timeslices.ForEach(t => t.RequiredFieldValidation(t.FromTime, t.ToTime, t.DowPattern));
                Timeslices.ForEach(t => t.RegexValidation(t.FromTime, t.ToTime, t.DowPattern));
            }

            validation = new CompareValidation()
            {
                Field = new List <ValidationInfo>()
                {
                    new ValidationInfo()
                    {
                        ErrorMessage    = "Day Part Spot Max Ratings should be greater than or equal to 0",
                        FieldToValidate = SpotMaxRatings,
                        FieldToCompare  = 0,
                        Operator        = Operator.GreaterThanEqual
                    },
                    new ValidationInfo()
                    {
                        ErrorMessage    = "Day Part Campaign Price should be greater than or equal to 0",
                        FieldToValidate = CampaignPrice,
                        FieldToCompare  = 0,
                        Operator        = Operator.GreaterThanEqual
                    }
                }
            };
            validation.Execute();
        }