Beispiel #1
0
 public static bool IsEqual(EmployeeDayStatePlanning entity, EmployeeDay day)
 {
     return((entity.EmployeeID == day.EmployeeId) &&
            (entity.Date == day.Date) &&
            (entity.SumOfAddHours == day.CountDailyAdditionalCharges) &&
            (entity.AllreadyPlannedHours == day.CountDailyPlannedWorkingHours) &&
            (entity.WorkingHours == day.CountDailyWorkingHours) &&
            (entity.StoreWorldId == day.StoreWorldId));
 }
Beispiel #2
0
 public void RemoveEntity(EmployeeDayStatePlanning entity)
 {
     if (entity != null && entity.EmployeeID == EmployeeId)
     {
         if (_index.ContainsKey(entity.Date))
         {
             _index.Remove(entity.Date);
             _list.Remove(entity);
         }
     }
 }
Beispiel #3
0
 public void AddEntity(EmployeeDayStatePlanning entity)
 {
     if (entity != null && entity.EmployeeID == EmployeeId)
     {
         if (!_index.ContainsKey(entity.Date))
         {
             _index[entity.Date] = entity;
             _list.Add(entity);
         }
     }
 }
Beispiel #4
0
 public static EmployeeDay AssignDay(EmployeeDayStatePlanning entity, EmployeeDay day)
 {
     //day.ID = entity.ID;
     day.EmployeeId = entity.EmployeeID;
     day.Date       = entity.Date;
     day.CountDailyAdditionalCharges   = entity.SumOfAddHours;
     day.CountDailyPlannedWorkingHours = entity.AllreadyPlannedHours;
     day.CountDailyWorkingHours        = entity.WorkingHours;
     day.StoreWorldId = entity.StoreWorldId;
     return(day);
 }
Beispiel #5
0
 public static EmployeeDayStatePlanning AssignToPlanning(EmployeeDayStatePlanning entity, EmployeeDay day)
 {
     //entity.ID = day.ID;
     entity.EmployeeID           = day.EmployeeId;
     entity.Date                 = day.Date;
     entity.SumOfAddHours        = day.CountDailyAdditionalCharges;
     entity.AllreadyPlannedHours = day.CountDailyPlannedWorkingHours;
     entity.WorkingHours         = day.CountDailyWorkingHours;
     entity.StoreWorldId         = day.StoreWorldId;
     return(entity);
 }
Beispiel #6
0
        private void _DoUpdate(EmployeeDayStatePlanning entity)
        {
            if (entity.IsNew)
            {
                Service.Save(entity);
            }
            else
            {
                Service.Update(entity);
            }

            //ServerEnvironment.EmployeeDayStatePlanningService.SaveOrUpdate(entity);
        }
Beispiel #7
0
        public void CompareAndSave(EmployeeDay day)
        {
            if (day == null)
            {
                throw new ArgumentNullException();
            }

            EmployeePlanningDayList list = GetList(day.EmployeeId);

            if (list == null)
            {
                list = CreateDictionItem(day.EmployeeId);
            }

            EmployeeDayStatePlanning entity = list[day.Date];

            if (entity == null)
            {
                if (day.IsValidDay)
                {
                    entity = EmployeeDayProcessor.CreatePlanningEntity(day);
                    UpdateEntity(entity);
                    list.AddEntity(entity);
                }
            }
            else
            {
                if (day.IsValidDay)
                {
                    if (!EmployeeDayProcessor.IsEqual(entity, day))
                    {
                        EmployeeDayProcessor.AssignToPlanning(entity, day);
                        UpdateEntity(entity);
                    }
                }
                else
                {
                    if (entity != null)
                    {
                        DeleteEntity(entity);
                    }
                }
            }
        }
Beispiel #8
0
 public void UpdateEntity(EmployeeDayStatePlanning entity)
 {
     _DoUpdate(entity);
 }
Beispiel #9
0
 private void DeleteEntity(EmployeeDayStatePlanning entity)
 {
     _DoDelete(entity);
 }
Beispiel #10
0
 protected virtual void _DoDelete(EmployeeDayStatePlanning entity)
 {
     Service.Delete(entity);
 }
Beispiel #11
0
        public static EmployeeDay CreateDay(EmployeeDayStatePlanning entity)
        {
            EmployeeDay day = new EmployeeDay();

            return(AssignDay(entity, day));
        }
Beispiel #12
0
        public static EmployeeDayStatePlanning CreatePlanningEntity(EmployeeDay day)
        {
            EmployeeDayStatePlanning entity = new EmployeeDayStatePlanning();

            return(AssignToPlanning(entity, day));
        }
Beispiel #13
0
 public EmployeeDay(EmployeeDayStatePlanning entity) : this()
 {
     EmployeeDayProcessor.AssignDay(entity, this);
 }