Ejemplo n.º 1
0
        private bool ValidateSwimTime(SwimTime validating)
        {
            if (validating.MinHoursPerVisit < 0)
            {
                Validator.AddError("Creating.MinHoursPerVisit", "Min Hours must be greater than 0");
            }
            if (validating.MaxHoursPerVisit < 0)
            {
                Validator.AddError("Creating.MaxHoursPerVisit", "Max Hours must be greater than 0");
            }
            if (validating.MinHoursPerVisit > validating.MaxHoursPerVisit)
            {
                Validator.AddError("Creating.MaxHoursPerVisit", "Max Hours must be larger than Min Hours");
            }
            if (validating.Start < new DateTime(2010, 01, 01))
            {
                Validator.AddError("Creating.Start", "Start Date must be after 01/01/2010");
            }
            if (validating.Start > validating.End)
            {
                Validator.AddError("Creating.End", "The End Date must be after the Start Date");
            }

            return(Validator.IsValid);
        }
Ejemplo n.º 2
0
 public bool EditSwimTime(SwimTime editing)
 {
     if (ValidateSwimTime(editing))
     {
         return(Repository.EditSwimTime(editing));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool EditSwimTimeRule(SwimTime swimTimeRulesToEdit)
 {
     if (ValidateTerm(swimTimeRulesToEdit))
     {
         return(Repository.EditSwimTimeRule(swimTimeRulesToEdit));//create term
     }
     else
     {
         return(false);//pass up invalid flag
     }
 }
Ejemplo n.º 4
0
 public bool CreateSwimTime(SwimTime create)
 {
     //VALIDATEION HERE USE VALIDATION SPACE BELOW!! model it off those methods and return false if it doesn't work
     if (ValidateSwimTime(create))
     {
         return(Repository.CreateSwimTime(create));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
        //for creation view
        public CreateEditSwimTimeRulesViewModel(List <Course> courseList, SwimTime input)
        {
            Creating = input;
            DaysList = Days.Select(x => new SelectListItem
            {
                Text  = x.Obj,
                Value = x.Val.ToString()
            });
            IEnumerable <Course> CTOnly = from co in courseList
                                          where co.CheckOut
                                          select co;

            Course = CTOnly.Select(x => new SelectListItem
            {
                Text  = x.Title + " " + x.CRN,
                Value = x.CRN.ToString()
            });
            RepetitionSchedule = Repetition.Select(x => new SelectListItem
            {
                Text  = x.Obj,
                Value = x.Val.ToString()
            });
        }
Ejemplo n.º 6
0
 //validation
 protected bool ValidateTerm(SwimTime swimTimeRuleToValidate)
 {
     return(true);
 }
Ejemplo n.º 7
0
 public bool EditSwimTime(SwimTime editing)
 {
     return(Service.EditSwimTimeRule(editing));
 }
Ejemplo n.º 8
0
 public bool CreateSwimTime(SwimTime create)
 {
     return(Service.CreateSwimTimeRule(create));
 }
Ejemplo n.º 9
0
        public ActionResult editSwimTime(int id)
        {
            SwimTime editing = Service.GetSwimTimeByID(id);

            return(View(new CreateEditSwimTimeRulesViewModel(editing, Service.ListAllCourses())));
        }
Ejemplo n.º 10
0
 public bool EditSwimTimeRule(SwimTime swimTimeRulesToEdit)
 {
     return(Service.EditSwimTimeRule(swimTimeRulesToEdit));
 }
Ejemplo n.º 11
0
 public bool CreateSwimTimeRule(SwimTime swimTimeRulesToCreate)
 {
     return(Service.CreateSwimTimeRule(swimTimeRulesToCreate));
 }