Exemplo n.º 1
0
 /// <summary>
 /// Remove a non-working period from the schedule
 /// </summary>
 /// <param name="period">Non-working period</param>
 public void DeleteNonWorkingPeriod(NonWorkingPeriod period)
 {
     if (this.NonWorkingPeriods.Contains(period))
     {
         this.NonWorkingPeriods.Remove(period);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create a non-working period of time
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="description">Description</param>
        /// <param name="startDateTime">Starting date and time of day</param>
        /// <param name="duration">Durtation of period</param>
        /// <returns>NonWorkingPeriod</returns>
        public NonWorkingPeriod CreateNonWorkingPeriod(string name, string description, LocalDateTime startDateTime,
                                                       Duration duration)
        {
            NonWorkingPeriod period = new NonWorkingPeriod(name, description, startDateTime, duration);

            if (NonWorkingPeriods.Contains(period))
            {
                string msg = String.Format(WorkSchedule.GetMessage("nonworking.period.already.exists"), name);
                throw new Exception(msg);
            }
            period.WorkSchedule = this;
            NonWorkingPeriods.Add(period);

            NonWorkingPeriods.Sort();

            return(period);
        }