public static void CreatePeriod(IPeriodRepository periodRepository, string name, DateTime from, DateTime to) { var periodManagerService = new PeriodManagerService(periodRepository, null, null, null, null, null, null, null, null, null, null, null); Period = new Period(new PeriodId(periodRepository.GetNextId()), name, from, to, 91); Period.ChangeActiveStatus(periodManagerService, true); periodRepository.Add(Period); }
public Period AddPeriod(string name, DateTime startDate, DateTime endDate, decimal maxFinalPoint) { using (var scope = new TransactionScope()) { var id = periodRep.GetNextId(); var period = new Period(new PeriodId(id), name, startDate, endDate, maxFinalPoint); periodRep.Add(period); scope.Complete(); return(period); } }
public async Task Create(Period period) { var newPeriod = new Period { Code = period.Code, Semester = period.Semester, Trimester = period.Trimester, Year = period.Year }; await _periodRepository.Add(newPeriod); }
public void AddPeriod(int id, IEnumerable <Period> periods) { var mutablePeriods = periods.ToList(); mutablePeriods.ForEach(period => { if (string.IsNullOrEmpty(period.Name)) { throw new Exception("Period name is required"); } if (period.PickStartDateTime == default(DateTime)) { throw new Exception("Pick start date is required"); } if (period.PickEndDateTime == default(DateTime)) { throw new Exception("Pick end date is required"); } if (period.ReportStartDateTime == default(DateTime)) { throw new Exception("Report start date is required"); } if (period.ReportEndDateTime == default(DateTime)) { throw new Exception("Report end date is required"); } if (DateTime.Compare(period.PickStartDateTime, period.PickEndDateTime) >= 0) { throw new Exception("Pick start date must be after its end date."); } if (DateTime.Compare(period.ReportStartDateTime, period.ReportEndDateTime) >= 0) { throw new Exception("Report start date must be after its end date."); } period.GameId = id; }); _prdRepo.Add(mutablePeriods.ToArray()); }
public Period Add(Period entity) { return(_periodRepository.Add(entity)); }