Beispiel #1
0
		/// <summary>
		/// Creates an instance of WorkTimeRangeVm for the given <see cref="Soheil.Model.WorkShift"/>
		/// </summary>
		/// <param name="shift"></param>
		public PPItemWorkTime(WorkShift shift, DateTime dayStart)
		{
			DayStart = dayStart;
			Start = dayStart.AddSeconds(shift.StartSeconds);
			End = dayStart.AddSeconds(shift.EndSeconds);
			Id = shift.Id;
			Model = shift;
		}
Beispiel #2
0
		/// <summary>
		/// Creates an instance of WorkTimeRangeVm for the given <see cref="Soheil.Model.WorkShift"/>
		/// </summary>
		/// <param name="shift"></param>
		protected WorkTimeRangeVm(WorkShift shift, DateTime offset)
		{
			Start = offset.AddSeconds(shift.StartSeconds);
			End = offset.AddSeconds(shift.EndSeconds);
			Color = shift.WorkShiftPrototype.Color;
			Id = shift.Id;
			Children = new List<WorkTimeRangeVm>();
			IsShift = true;
		}
Beispiel #3
0
     private void FixupWorkShift(WorkShift previousValue)
     {
         if (previousValue != null && previousValue.WorkBreaks.Contains(this))
         {
             previousValue.WorkBreaks.Remove(this);
         }
 
         if (WorkShift != null)
         {
             if (!WorkShift.WorkBreaks.Contains(this))
             {
                 WorkShift.WorkBreaks.Add(this);
             }
         }
     }
		public static WorkShift CreateDefault(WorkDay parent, WorkShiftPrototype proto)
		{
			var model = new WorkShift();
			if (parent.WorkShifts.Any())
			{
				var last = parent.WorkShifts.Last();
				model.StartSeconds = last.EndSeconds;
				model.EndSeconds = last.EndSeconds + 3600;
				if (model.EndSeconds > SoheilConstants.EDITOR_END_SECONDS) throw new Exception("قادر به افزودن شیفت نمی باشد. زمان کافی در روز وجود ندارد");
			}
			else
			{
				model.StartSeconds = SoheilConstants.EDITOR_START_SECONDS;
				model.EndSeconds = SoheilConstants.EDITOR_START_SECONDS + 3600;
			}
			model.WorkDay = parent;
			model._workShiftPrototype = proto;
			return model;
		}