Пример #1
0
        public bool ValidateNew(EmployeeDay employeeday)
        {
            CountMinutes = 0;

            if (employeeday.CountDailyWorkingHours == 0)
            {
                return(false);
            }

            if (employeeday.TimeList != null)
            {
                foreach (EmployeeTimeRange wtp in employeeday.TimeList)
                {
                    if (wtp.AbsenceID <= 0)
                    {
                        for (short start = wtp.Begin; start < wtp.End; start += 15)
                        {
                            if (BeginTime <= start && start < EndTime) //continue;
                            {
                                CountMinutes += 15;
                            }
                        }
                    }
                }

                if (CountMinutes > 0)
                {
                    //if (Wrapper.Hours > CountMinutes || Wrapper.Hours == -1)
                    Owner.Hours = CountMinutes;

                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public void SaveEmployeeDay(EmployeeDay employeeday)
        {
            if (employeeday == null)
            {
                throw new ArgumentNullException();
            }

            EmployeeDayStateRecording entity = GetEmployeesState(employeeday.EmployeeId, employeeday.Date);

            bool bNeedSave = EmployeeDayProcessor.IsNeedSave(employeeday);

            if (bNeedSave)
            {
                if (entity == null)
                {
                    entity = EmployeeDayProcessor.CreateRecordingEntity(employeeday);
                }
                else
                {
                    EmployeeDayProcessor.AssignToRecording(entity, employeeday);
                }

                SaveOrUpdate(entity);
                //employeeday.ID = entity.ID;
            }
            else
            {
                if (entity != null)
                {
                    DeleteByID(entity.ID);
                }
            }
        }
Пример #3
0
        public static void PrintDayCellValues(XRControl container, EmployeeDay employeeDay, IRecordingContext recordingContext)
        {
            if (employeeDay != null)
            {
                if (employeeDay.HasLongAbsence)
                {
                    string s = recordingContext.LongAbsences.GetAbbreviation(employeeDay.LongAbsenceId);
                    if (!String.IsNullOrEmpty(s))
                    {
                        XRLabel label = AddLabelLine(container, s, Color.Black, 0, false);
                        label.TextAlignment = TextAlignment.MiddleCenter;
                    }
                    return;
                }

                if (employeeDay.TimeList != null)
                {
                    int y = 0;

                    foreach (EmployeeTimeRange range in employeeDay.TimeList)
                    {
                        XRLabel label = AddLabelLine(container, TextParser.EmployeeTimeToString(range), range.Absence == null ? Color.Black : Color.FromArgb(range.Absence.Color), y, false);
                        y = y + label.Height + 1;
                    }
                }
            }
        }
Пример #4
0
        public void FillEmployeeWeeks(List <EmployeeWeek> weeks, DateTime beginDate, DateTime endDate)
        {
            if (weeks != null && weeks.Count > 0)
            {
                Dictionary <long, EmployeeWeek> _diction = EmployeeWeekProcessor.GetDictionary(weeks);
                long[] ids = EmployeeWeekProcessor.GetEmployeeIds(weeks);

                List <EmployeeDayStateRecording> daystates = servicedao.GetEmployeesStates(ids, beginDate, endDate);

                if (daystates != null)
                {
                    EmployeeWeek lastWeek = null;
                    EmployeeDay  day      = null;
                    foreach (EmployeeDayStateRecording edsp in daystates)
                    {
                        if ((lastWeek == null) || (edsp.EmployeeID != lastWeek.EmployeeId))
                        {
                            lastWeek = null;
                            _diction.TryGetValue(edsp.EmployeeID, out lastWeek);
                        }

                        if (lastWeek != null)
                        {
                            day = lastWeek.GetDay(edsp.Date);
                            if (day != null)
                            {
                                EmployeeDayProcessor.AssignDay(edsp, day);
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
        public RecordingDayRow(EmployeeWeek week, RecordingDayView dayview,
                               EmployeeWeek actualweek, RecordingDayView actualdayview, long orderHwgr)
        {
            _plannedWeek    = week;
            _plannedDayView = dayview;

            _actualWeek    = actualweek;
            _actualDayView = actualdayview;

            if (_plannedDayView != null)
            {
                _plannedDay = _plannedDayView.RecordingDay;
            }

            if (_actualDayView != null)
            {
                _actualDay = _actualDayView.RecordingDay;
            }

            if (_plannedWeek.FullName != null)
            {
                _fullname = _plannedWeek.FullName;
            }

            _OrderHWGR = orderHwgr;
        }
Пример #6
0
        public void FillEmployeeWeeks(List <EmployeeWeek> weeks, DateTime beginDate, DateTime endDate,
                                      long[] emplIds, Dictionary <long, EmployeeWeek> dictWeek)
        {
            if (weeks != null && weeks.Count > 0)
            {
                List <EmployeeDayStatePlanning> daystates = GetEmployeesState(emplIds, beginDate, endDate);

                if (daystates != null)
                {
                    EmployeeWeek lastWeek = null;
                    EmployeeDay  day      = null;
                    foreach (EmployeeDayStatePlanning edsp in daystates)
                    {
                        if ((lastWeek == null) || (edsp.EmployeeID != lastWeek.EmployeeId))
                        {
                            lastWeek = null;
                            dictWeek.TryGetValue(edsp.EmployeeID, out lastWeek);
                        }

                        if (lastWeek != null)
                        {
                            day = lastWeek.GetDay(edsp.Date);
                            if (day != null)
                            {
                                EmployeeDayProcessor.AssignDay(edsp, day);
                            }
                        }
                    }
                }
            }
        }
        public bool ValidateNew(IBaumaxEmployeeWeek employeeweek)
        {
            int         count          = 0;
            DateTime    currentDate    = employeeweek.BeginDate;
            EmployeeDay currentDay     = null;
            EmployeeDay lastWorkingDay = null;

            Value = employeeweek.ContractHoursPerWeek;

            for (int i = 0; i < 7; i++)
            {
                currentDay = employeeweek.GetDay(currentDate);

                //if (currentDay.CountDailyPlannedWorkingHours > 0)
                {
                    count         += currentDay.CountDailyPlannedWorkingHours;
                    lastWorkingDay = currentDay;
                }

                currentDate = currentDate.AddDays(1);
            }

            if (count > Value)
            {
                int t = count - Value;
                //if (Wrapper.Hours == -1 || Wrapper.Hours > t)
                Owner.Hours = t;
                return(true);
            }

            return(false);
        }
Пример #8
0
        public override bool ValidateNew()
        {
            EmployeeDay day = Owner.EmployeeWeek.GetDay(Owner.CurrentDate);

            //StoreDay storeday = Owner.StoreDays[Owner.CurrentDate];

            return(ValidateNew(null, day));
        }
Пример #9
0
        public bool ValidateNew(StoreDay storeday1, EmployeeDay employeeday)
        {
            if (employeeday.Date.DayOfWeek == DayOfWeek.Monday)
            {
                return(false);
            }

            if (employeeday.TimeList == null ||
                employeeday.TimeList.Count == 0)
            {
                return(false);
            }

            DateTime prevDate = employeeday.Date.AddDays(-1);

            EmployeeDay prevDay = Owner.EmployeeWeek.GetDay(prevDate);

            if (prevDay.TimeList == null ||
                prevDay.TimeList.Count == 0)
            {
                return(false);
            }

            short maxvalue = 0;
            short minvalue = Utills.MinutesInDay;

            foreach (EmployeeTimeRange wtp in prevDay.TimeList)
            {
                if ((wtp.AbsenceID <= 0) && (wtp.End > maxvalue))
                {
                    maxvalue = wtp.End;
                }
            }
            foreach (EmployeeTimeRange wtp in employeeday.TimeList)
            {
                if ((wtp.AbsenceID <= 0) && (wtp.Begin < minvalue))
                {
                    minvalue = wtp.Begin;
                }
            }

            int diff = (Utills.MinutesInDay - maxvalue) + minvalue;

            int countHour = (int)(Value * 60);

            if (countHour > diff)
            {
                return(true);
            }


            return(false);
        }
Пример #10
0
 public IActionResult Create([FromBody] EmployeeDay employeeDay)
 {
     Debug.WriteLine("Getting Here");
     if (employeeDay == null)
     {
         return(BadRequest());
     }
     Debug.WriteLine(employeeDay);
     employeeDaysRepository.InsertEmployeeDay(employeeDay);
     employeeDaysRepository.Save();
     return(Created("GetEmployeeDaysById", employeeDay));
 }
Пример #11
0
        public bool ValidateNew(EmployeeDay employeeday)
        {
            if (employeeday.HasRelation && employeeday.HasContract)
            {
                if (employeeday.StoreDay.Feast && employeeday.CountDailyWorkingHours > 0)
                {
                    Owner.Hours = employeeday.CountDailyWorkingHours;
                    return(true);
                }
            }

            return(false);
        }
Пример #12
0
 public void FillEmployeeDay(EmployeeDay emplday)
 {
     if (emplday != null && emplday.TimeList != null)
     {
         for (int i = 0; i < emplday.TimeList.Count; i++)
         {
             if (emplday.TimeList[i].AbsenceID > 0)
             {
                 emplday.TimeList[i].Absence = GetById(emplday.TimeList[i].AbsenceID);
             }
         }
     }
 }
Пример #13
0
 public override void Process(EmployeeDay day)
 {
     if (day.TimeList != null && day.TimeList.Count > 0)
     {
         for (int i = 0; i < day.TimeList.Count; i++)
         {
             if (day.TimeList[i].AbsenceID <= 0)
             {
                 Process(day.TimeList[i]);
             }
         }
     }
 }
Пример #14
0
        private int GetWorkingMinutes(EmployeeDay day)
        {
            int result = 0;

            if (day.TimeList != null && day.TimeList.Count > 0)
            {
                foreach (EmployeeTimeRange r in day.TimeList)
                {
                    if (r.AbsenceID == 0)
                    {
                        result += r.Time;
                    }
                }
            }
            return(result);
        }
Пример #15
0
        public IActionResult Update(string id, [FromBody] EmployeeDay employeeDay)
        {
            if (employeeDay == null || employeeDay.EmployeeDay_Id != Int32.Parse(id))
            {
                return(BadRequest());
            }

            var day = employeeDaysRepository.GetEmployeeDayById(Int32.Parse(id));

            if (day == null)
            {
                return(NotFound());
            }
            employeeDaysRepository.UpdateEmployeeDay(day);
            return(new NoContentResult());
        }
Пример #16
0
        protected void _ApplyLunchBrakeModels(EmployeeDay day, bool beforeCalc)
        {
            if (_innerList == null || _innerList.Count == 0)
            {
                return;
            }

            if ((beforeCalc && DurationATime) || (!beforeCalc && !DurationATime))
            {
                foreach (LunchBrakeModel m in _innerList)
                {
                    if (m.IsValidModelByData(day.Date))
                    {
                        m.Process(day);
                    }
                }
            }
        }
Пример #17
0
        public bool ValidateNew(EmployeeDay employeeday)
        {
            CountMinutes = 0;
            if (WeekDayMasks == WeeksDayMask.Empty)
            {
                return(false);
            }
            if (employeeday.CountDailyWorkingHours == 0)
            {
                return(false);
            }
            DayOfWeek    dayofweek      = employeeday.Date.DayOfWeek;
            WeeksDayMask currentDayMask = WeeksDayMask.Empty;

            switch (dayofweek)
            {
            case DayOfWeek.Monday: currentDayMask = WeeksDayMask.Monday; break;

            case DayOfWeek.Tuesday: currentDayMask = WeeksDayMask.Tuesday; break;

            case DayOfWeek.Wednesday: currentDayMask = WeeksDayMask.Wednesday; break;

            case DayOfWeek.Thursday: currentDayMask = WeeksDayMask.Thursday; break;

            case DayOfWeek.Friday: currentDayMask = WeeksDayMask.Friday; break;

            case DayOfWeek.Saturday: currentDayMask = WeeksDayMask.Saturday; break;

            case DayOfWeek.Sunday: currentDayMask = WeeksDayMask.Sunday; break;
            }

            if ((WeekDayMasks & currentDayMask) != WeeksDayMask.Empty)
            {
                CountMinutes = employeeday.CountDailyWorkingHours;

                //if (Wrapper.Hours > CountMinutes || Wrapper.Hours == -1)
                Owner.Hours = CountMinutes;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #18
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);
                    }
                }
            }
        }
Пример #19
0
        public override bool ValidateNew()
        {
            DateTime    date    = Owner.EmployeeWeek.BeginDate.Date;
            int         month   = date.Month;
            EmployeeDay day     = null;
            int         minutes = 0;

            while (date <= Owner.EmployeeWeek.EndDate.Date)
            {
                day = Owner.EmployeeWeek.GetDay(date);
                if (day.Date.Month == month)
                {
                    minutes += day.CountDailyPlannedWorkingHours;
                }
                date = date.AddDays(1);
            }

            return(ValidateMonthTime(Owner.EmployeeWeek.WorkingTimeByMonth + minutes));
        }
Пример #20
0
        public bool ValidateNew(EmployeeDay employeeday)
        {
            CountMinutes = 0;
            if (employeeday.TimeList == null || employeeday.TimeList.Count == 0)
            {
                return(false);
            }

            short minutes = (short)(Value * 60);

            foreach (EmployeeTimeRange wtp in employeeday.TimeList)
            {
                if (wtp.AbsenceID <= 0)// not absence range
                {
                    if (LessThan)
                    {
                        if (wtp.Time < minutes)
                        {
                            CountMinutes = wtp.Time;
                            if (Owner.Hours > CountMinutes || Owner.Hours == -1)
                            {
                                Owner.Hours = CountMinutes;
                            }
                            return(true);
                        }
                    }
                    else
                    {
                        if (wtp.Time > minutes)
                        {
                            CountMinutes = wtp.Time - minutes;
                            if (Owner.Hours > CountMinutes || Owner.Hours == -1)
                            {
                                Owner.Hours = CountMinutes;
                            }
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
        public bool ValidateNew(EmployeeDay employeeday)
        {
            if (employeeday.HasRelation && employeeday.HasContract)
            {
                CountMinutes = 0;

                if (employeeday.CountDailyWorkingHours == 0)
                {
                    return(false);
                }

                short openTime  = employeeday.StoreDay.OpenTime;
                short closeTime = employeeday.StoreDay.CloseTime;



                foreach (EmployeeTimeRange wtp in employeeday.TimeList)
                {
                    if (wtp.AbsenceID <= 0)
                    {
                        for (short start = wtp.Begin; start <= wtp.End; start += 15)
                        {
                            if (openTime <= start && start <= closeTime)
                            {
                                continue;
                            }

                            CountMinutes += 15;
                        }
                    }
                }

                if (CountMinutes > 0)
                {
                    Owner.Hours = CountMinutes;

                    return(true);
                }
            }

            return(false);
        }
        public void SaveEmployeeDay(EmployeeDay planningday)
        {
            if (planningday == null)
            {
                throw new ArgumentNullException();
            }

            EmployeeDayStatePlanning entity = GetEmployeesState(planningday.EmployeeId, planningday.Date);

            bool bNeedSave = EmployeeDayProcessor.IsNeedSave(planningday);

            if (bNeedSave)
            {
                bool bModified = false;

                if (entity == null)
                {
                    entity = EmployeeDayProcessor.CreatePlanningEntity(planningday);
                }
                else
                {
                    if (!EmployeeDayProcessor.IsEqual(entity, planningday))
                    {
                        EmployeeDayProcessor.AssignToPlanning(entity, planningday);
                        bModified = true;
                    }
                }
                if (entity.IsNew || bModified)
                {
                    SaveOrUpdate(entity);
                }

                //planningday.ID = entity.ID;
            }
            else
            {
                if (entity != null)
                {
                    DeleteByID(entity.ID);
                }
            }
        }
Пример #23
0
        public override void Process(EmployeeDay day)
        {
            int time = 0;

            if (day.TimeList != null && day.TimeList.Count > 0)
            {
                for (int i = 0; i < day.TimeList.Count; i++)
                {
                    if (day.TimeList[i].AbsenceID <= 0)
                    {
                        time += day.TimeList[i].End - day.TimeList[i].Begin;
                    }
                }

                if (time >= ConditionTime)
                {
                    day.CountDailyWorkingHours = time + ApplyValue;
                }
            }
        }
Пример #24
0
        public static void DrawCell(long storeid, IRecordingContext context, EmployeeDay epd, GraphicsCache cache, Rectangle rect, bool bFocused)
        {
            if (context == null)
            {
                return;
            }
            if (epd == null)
            {
                return;
            }
            if (cache == null)
            {
                return;
            }

            StoreDay sd = context.StoreDays[epd.Date];

            DrawBackgroundWeekDayCell(storeid, sd, epd, cache, rect, context.StoreWorldId, bFocused, context.LongAbsences.GetColor(epd.LongAbsenceId));
            DrawWeekDayContent(sd, epd, cache, rect, context);
        }
Пример #25
0
        private void CalculateWeeklyMessageOrSaldoWorkingModels(EmployeeWeek planningweek)
        {
            if (planningweek.IsValidWeek)
            {
                EmployeeDay          epday  = planningweek.GetDay(planningweek.EndDate);
                EmployeeWorkingModel entity = null;
                foreach (WorkingModelWrapperNew wrap in _weeklyMessagesModels)
                {
                    if (!planningweek.PlannedWeek)
                    {
                        if (!wrap.Model.UseInRecording)
                        {
                            continue;
                        }
                    }
                    if (!DateTimeHelper.IsIntersectInc(wrap.Model.BeginTime, wrap.Model.EndTime,
                                                       planningweek.BeginDate, planningweek.EndDate))
                    {
                        continue;
                    }

                    if (wrap.Validate(planningweek, planningweek.BeginDate))
                    {
                        if (wrap.IsMessageModel)
                        {
                            entity                = new EmployeeWorkingModel();
                            entity.EmployeeID     = epday.EmployeeId;
                            entity.Date           = epday.Date;
                            entity.WorkingModelID = wrap.Model.ID;


                            if (epday.WorkingModels == null)
                            {
                                epday.WorkingModels = new List <EmployeeWorkingModel>();
                            }
                            epday.WorkingModels.Add(entity);
                        }
                    }
                }
            }
        }
Пример #26
0
        private void PrintPlannedDayCell(XRTableCell cell)
        {
            XRPanel panel = ReportPainter.GetPanelControl(cell);

            panel.Width = cell.Width;
            panel.Dock  = XRDockStyle.Fill;
            panel.Controls.Clear();

            EmployeeDay      employeeDay  = null;
            EmployeeWeekView employeeWeek = GetCurrentWeekView();
            StoreDay         storeDay     = _recordingContext.StoreDays[(DateTime)cell.Tag];

            if (employeeWeek != null && storeDay != null && employeeWeek.PlanningWeek != null)
            {
                employeeDay = employeeWeek.PlanningWeek.GetDay(storeDay.Date);
            }

            ReportPainter.ApplyEmployeeDayStyle(cell, storeDay, employeeDay, StoreToWorldID, _recordingContext);

            ReportPainter.PrintDayCellValues(panel, employeeDay, _recordingContext);
        }
Пример #27
0
        public void FillEmployeeWeeks(List <EmployeeWeek> weeks, DateTime beginDate, DateTime endDate)
        {
            if (weeks != null && weeks.Count > 0)
            {
                List <long> lstIds = new List <long>(weeks.Count);
                Dictionary <long, EmployeeWeek> _diction = new Dictionary <long, EmployeeWeek>();
                foreach (EmployeeWeek epw in weeks)
                {
                    lstIds.Add(epw.EmployeeId);
                    _diction[epw.EmployeeId] = epw;
                }

                long[] ids = lstIds.ToArray();

                List <EmployeeDayStatePlanning> daystates = GetEmployeesState(ids, beginDate, endDate);

                if (daystates != null)
                {
                    EmployeeWeek lastWeek = null;
                    EmployeeDay  day      = null;
                    foreach (EmployeeDayStatePlanning edsp in daystates)
                    {
                        if ((lastWeek == null) || (edsp.EmployeeID != lastWeek.EmployeeId))
                        {
                            lastWeek = null;
                            _diction.TryGetValue(edsp.EmployeeID, out lastWeek);
                        }

                        if (lastWeek != null)
                        {
                            day = lastWeek.GetDay(edsp.Date);
                            if (day != null)
                            {
                                EmployeeDayProcessor.AssignDay(edsp, day);
                            }
                        }
                    }
                }
            }
        }
        public bool ValidateNew(EmployeeDay employeeday)
        {
            throw new Exception();
            //int count = 0;
            //IBaumaxEmployeeWeek week = Owner.EmployeeWeek;

            //DateTime currentDate = week.BeginDate;
            //count = week.CountWorkDaysBefore;
            ////if (employeeday.Date.AddDays(-Value) < week.BeginDate) return false;

            //while (currentDate <= employeeday.Date)
            //{
            //    if (week.GetDay(currentDate).CountDailyWorkingHours > 0) count++;
            //    else count = 0;

            //    if (count > Value) return true;

            //    currentDate = currentDate.AddDays(1);
            //}

            //return false;
        }
Пример #29
0
 public void SaveEmployeeDay(EmployeeDay plday)
 {
     servicedao.SaveEmployeeDay(plday);
 }
Пример #30
0
        private void CalculateWeeklyWorkingModels(EmployeeWeek planningweek)
        {
            Debug.Assert(planningweek != null);

            if (planningweek.IsValidWeek)
            {
                EmployeeDay          epday  = planningweek.GetDay(planningweek.EndDate);
                EmployeeWorkingModel entity = null;

                foreach (WorkingModelWrapperNew wrap in _weeklyModels)
                {
                    if (!planningweek.PlannedWeek)
                    {
                        if (!wrap.Model.UseInRecording)
                        {
                            continue;
                        }
                    }

                    if (!DateTimeHelper.IsIntersectInc(wrap.Model.BeginTime, wrap.Model.EndTime,
                                                       planningweek.BeginDate, planningweek.EndDate))
                    {
                        continue;
                    }

                    if (wrap.Validate(planningweek, planningweek.BeginDate))
                    {
                        entity                = new EmployeeWorkingModel();
                        entity.EmployeeID     = epday.EmployeeId;
                        entity.Date           = epday.Date;
                        entity.WorkingModelID = wrap.Model.ID;
                        if (!wrap.IsMessageModel)
                        {
                            entity.Hours            = wrap.GetModelValue;
                            entity.AdditionalCharge = wrap.Model.AddCharges;

                            if (wrap.Model.AddCharges)
                            {
                                epday.CountDailyAdditionalCharges += entity.Hours;
                            }
                            else
                            {
                                epday.CountDailyPlannedWorkingHours += entity.Hours;
                            }
                        }
                        //if (!wrap.IsMessageModel)
                        //{
                        //    int result = 0;
                        //    if (wrap.Model.AddValue != 0)
                        //    {
                        //        result += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue));
                        //    }
                        //    if (wrap.Model.MultiplyValue != 0)
                        //    {
                        //        result += DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours));
                        //    }

                        //    if (wrap.Model.AddCharges)
                        //    {
                        //        entity.AdditionalCharge = true;
                        //        entity.Hours = result;
                        //        epday.CountDailyAdditionalCharges += result;

                        //    }
                        //    else
                        //    {
                        //        entity.AdditionalCharge = false;
                        //        entity.Hours = result;
                        //        epday.CountDailyPlannedWorkingHours += result;
                        //    }
                        //}
                        if (epday.WorkingModels == null)
                        {
                            epday.WorkingModels = new List <EmployeeWorkingModel>();
                        }
                        epday.WorkingModels.Add(entity);
                    }
                }
            }
        }
Пример #31
0
            public void AssignTo(EmployeeDay employeeday)
            {
                employeeday.TimeList = null;

                if (Times != null)
                {
                    employeeday.TimeList = new List<EmployeeTimeRange> ();
                    EmployeeTimeRange en = null;
                    foreach (EmployeeTimeRange range in Times)
                    {
                        en = new EmployeeTimeRange(range);
                        en.EmployeeID = employeeday.EmployeeId;
                        //en.ID = 0;
                        en.Date = employeeday.Date;
                        employeeday.TimeList.Add (en);
                    }

                }

                employeeday.Modified = true;
            }
Пример #32
0
 public void Assign(EmployeeDay employeeday)
 {
     Clear();
     if (employeeday.TimeList != null)
     {
         EmployeeTimeRange newrange = null;
         foreach (EmployeeTimeRange range in employeeday.TimeList)
         {
             newrange = new EmployeeTimeRange(range);
             //newrange.ID = -1;//newitem
             Times.Add(newrange);
         }
     }
 }
Пример #33
0
		public OperationResult<bool> SaveEmployeeDays(List<RubezhAPI.SKD.EmployeeDay> employeeDays)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				foreach (var employeeDay in employeeDays)
				{
					var tableEmployeeDay = new EmployeeDay
					{
						UID = employeeDay.UID,
						AllowedEarlyLeaveTimeSpan = TimeSpan.FromSeconds(employeeDay.AllowedEarlyLeave),
						AllowedLateTimeSpan = TimeSpan.FromSeconds(employeeDay.AllowedLate),
						Date = employeeDay.Date,
						DayIntervalsString = employeeDay.DayIntervalsString,
						EmployeeUID = employeeDay.EmployeeUID,
						IsIgnoreHoliday = employeeDay.IsIgnoreHoliday,
						IsOnlyFirstEnter = employeeDay.IsOnlyFirstEnter
					};
					Context.EmployeeDays.Add(tableEmployeeDay);
				}
				Context.SaveChanges();
				return true;
			});
		}