Example #1
0
        public async Task <IActionResult> PostWorkingDay([FromBody] WorkingDay workingDay)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Guid id = Guid.NewGuid();

            workingDay.Id = id;
            _context.WorkingDay.Add(workingDay);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (WorkingDayExists(workingDay.Id))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetWorkingDay", new { id = workingDay.Id }, workingDay));
        }
Example #2
0
 public WorkingTime CreateObject(WorkingTime workingTime, IWorkingDayService _workingDayService)
 {
     //  workingTime.Errors = new Dictionary<String, String>();
     if (_validator.ValidCreateObject(workingTime, this))
     {
         workingTime.WorkInterval  = (decimal)workingTime.CheckOut.Subtract(workingTime.CheckIn).TotalMinutes;
         workingTime.BreakInterval = (decimal)workingTime.BreakIn.Subtract(workingTime.BreakOut).TotalMinutes;
         _repository.CreateObject(workingTime);
         // Also create WorkingDays
         for (int i = 0; i < 7; i++)
         {
             WorkingDay workingDay = new WorkingDay
             {
                 WorkingTimeId     = workingTime.Id,
                 Code              = workingTime.Code + i.ToString(), // ((DayOfWeek)i).ToString()
                 Name              = ((DayOfWeek)i).ToString(),
                 MinCheckIn        = workingTime.MinCheckIn,
                 CheckIn           = workingTime.CheckIn,
                 MaxCheckIn        = workingTime.MaxCheckIn,
                 MinCheckOut       = workingTime.MinCheckOut,
                 CheckOut          = workingTime.CheckOut,
                 MaxCheckOut       = workingTime.MaxCheckOut,
                 BreakOut          = workingTime.BreakOut,
                 BreakIn           = workingTime.BreakIn,
                 WorkInterval      = workingTime.WorkInterval,
                 BreakInterval     = workingTime.BreakInterval,
                 CheckInTolerance  = workingTime.CheckInTolerance,
                 CheckOutTolerance = workingTime.CheckOutTolerance,
             };
             workingDay.IsEnabled = (i != 0 && i != 6);
             _workingDayService.CreateObject(workingDay, this);
         }
     }
     return(workingTime);
 }
Example #3
0
        public static void ChangeData(List <WorkingDay> Days)
        {
            Console.WriteLine("Enter date of day that`s you want to change");
            var        s   = Console.ReadLine();
            WorkingDay day = Days.Find(x => x.Date == s);

            if (day != null)
            {
                Console.WriteLine("Enter value of day that`s you want to change \n1)Name\n2)Position\n3)Date like 01.02.2000\n4)Hours count\n5)Project Name");
                char a = Console.ReadKey().KeyChar;
                Console.WriteLine("Enter new value");
                switch (a)
                {
                case '1':
                    day.Name = Console.ReadLine();
                    break;

                case '2':
                    day.Position = Console.ReadLine();
                    break;

                case '3':
                    day.Date = Console.ReadLine();
                    break;

                case '4':
                    day.HoursCount = Console.ReadLine();
                    break;

                case '5':
                    day.ProjectName = Console.ReadLine();
                    break;
                }
            }
        }
Example #4
0
        public IActionResult Edit(WorkingDay model)
        {
            FillViewBags();

            // Проверка за съществуващ запис за работен ден за същата дата
            if (commonService.WorkingDay_IsExist(model.Day, model.Id, model.CourtId))
            {
                SetBreadcrums(model.Id);
                SetErrorMessage(MessageConstant.Values.WorkDayExist);
                return(View(model));
            }

            // Валидация на модела
            if (!ModelState.IsValid)
            {
                SetBreadcrums(model.Id);
                return(View(model));
            }

            //Запис на данните
            if (commonService.WorkingDay_SaveData(model) > 0)
            {
                this.SaveLogOperation(false, model.Id);
                SetSuccessMessage(MessageConstant.Values.SaveOK);
            }
            else
            {
                SetErrorMessage(MessageConstant.Values.SaveFailed);
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
Example #5
0
        public async Task <IHttpActionResult> WorkWeekCommit([FromBody] WorkDaysUpdateDto wwUpDto)
        {
            if (wwUpDto == null)
            {
                return(BadRequest());
            }

            WorkingWeek week = _weekmenuService.FindById(wwUpDto.MenuId).WorkingWeek;

            for (int i = 0; i < wwUpDto.WorkDays.Length; i++)
            {
                WorkingDay workday = week.WorkingDays.ElementAt(i);
                workday.IsWorking        = wwUpDto.WorkDays[i];
                _db.Entry(workday).State = EntityState.Modified;
            }

            MenuForWeek menu = _weekmenuService.FindById(wwUpDto.MenuId);

            menu.WorkingDaysAreSelected = true;
            _db.Entry(menu).State       = EntityState.Modified;

            week.CanBeChanged = false;
            await _db.SaveChangesAsync();

            return(Ok(true));
        }
Example #6
0
        public static WorkingDay CreateNewDay()

        {
            Console.Clear();

            WorkingDay Day = new WorkingDay();

            Console.WriteLine("Enter name of doctor");

            Day.Name = Console.ReadLine();

            Console.WriteLine("Enter speciality");

            Day.Speciality = Console.ReadLine();

            Console.WriteLine("Enter date of day like 01.02.2000");

            Day.Date = Console.ReadLine();

            Console.WriteLine("Enter patients count");

            Day.PatientsCount = Console.ReadLine();

            Console.WriteLine("Enter time of starting work");

            Day.StartHour = Console.ReadLine();

            return(Day);
        }
Example #7
0
        public dynamic Insert(WorkingDay model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Create", Core.Constants.Constant.MenuName.WorkingDay, Core.Constants.Constant.MenuGroupName.Setting))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Add record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                model = _workingDayService.CreateObject(model, _workingTimeService);
            }
            catch (Exception ex)
            {
                LOG.Error("Insert Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }
        private static void UpdateCheckInCheckOutTime(WorkingDay workingDay)
        {
            List <UserEvent> orderedEvents = workingDay.Events?.OrderBy(record => record.Time).ToList();
            UserEvent        firstCheckIn  = orderedEvents?
                                             .Where(record => record.Event == Event.CheckedIn)
                                             .FirstOrDefault();
            UserEvent lastCheckOut = orderedEvents?
                                     .Where(record => record.Event == Event.CheckedOut)
                                     .LastOrDefault();

            if (firstCheckIn != null)
            {
                workingDay.CheckIn = firstCheckIn.Time;
            }
            else
            {
                workingDay.CheckIn = null;
            }

            if (lastCheckOut != null)
            {
                workingDay.CheckOut = lastCheckOut.Time;
            }
            else
            {
                workingDay.CheckOut = null;
            }
        }
Example #9
0
        public WorkingDay FixWorkingDayRange(WorkingDay workingDay)
        {
            // Need to fix the day for correct hours range checking, all dates must not be null
            while (workingDay.CheckIn < workingDay.MinCheckIn)
            {
                workingDay.CheckIn = workingDay.CheckIn.AddDays(1); // workingDay.MinCheckIn.Date + workingDay.CheckIn.TimeOfDay
            }
            while (workingDay.CheckOut < workingDay.MinCheckOut)
            {
                workingDay.CheckOut = workingDay.CheckOut.AddDays(1);
            }

            while (workingDay.CheckOut < workingDay.CheckIn)
            {
                workingDay.CheckOut = workingDay.CheckOut.AddDays(1);
            }
            while (workingDay.BreakIn < workingDay.BreakOut)
            {
                workingDay.BreakIn = workingDay.BreakIn.AddDays(1);
            }

            while (workingDay.MaxCheckIn < workingDay.CheckIn)
            {
                workingDay.MaxCheckIn = workingDay.MaxCheckIn.AddDays(1);
            }
            while (workingDay.MaxCheckOut < workingDay.CheckOut)
            {
                workingDay.MaxCheckOut = workingDay.MaxCheckOut.AddDays(1);
            }
            return(workingDay);
        }
        public JsonResult GetWorkingDay(string CalendarID, DateTime WorkingDate)
        {
            WorkingDayViewModel workingDayViewModel = null;

            return(ExecuteFunctionRun(() =>
            {
                WorkingDay workingDay = this.Engine.WorkingCalendarManager.GetWorkingDay(CalendarID, WorkingDate);
                workingDayViewModel = new WorkingDayViewModel()
                {
                    CalendarId = workingDay.CalendarId,
                    CurrentDate = workingDay.CurrentDate.ToString("yyyy-MM-dd"),
                    Description = workingDay.Description,
                    IsExceptional = workingDay.IsExceptional,
                    IsWorkingDay = workingDay.IsWorkingDay,
                    ObjectID = workingDay.ObjectID
                };
                if (workingDay.WorkingTimeSpans != null && workingDay.WorkingTimeSpans.Length > 0)
                {
                    workingDayViewModel.AMStartHour = workingDay.WorkingTimeSpans[0].StartTimeHour;
                    workingDayViewModel.AMStartMinute = workingDay.WorkingTimeSpans[0].StartTimeMinute;
                    workingDayViewModel.AMEndHour = workingDay.WorkingTimeSpans[0].EndTimeHour;
                    workingDayViewModel.AMEndMinute = workingDay.WorkingTimeSpans[0].EndTimeMinute;
                }
                if (workingDay.WorkingTimeSpans != null && workingDay.WorkingTimeSpans.Length > 1)
                {
                    workingDayViewModel.PMStartHour = workingDay.WorkingTimeSpans[1].StartTimeHour;
                    workingDayViewModel.PMStartMinute = workingDay.WorkingTimeSpans[1].StartTimeMinute;
                    workingDayViewModel.PMEndHour = workingDay.WorkingTimeSpans[1].EndTimeHour;
                    workingDayViewModel.PMEndMinute = workingDay.WorkingTimeSpans[1].EndTimeMinute;
                }
                return Json(workingDayViewModel, JsonRequestBehavior.DenyGet);
            }));
        }
        public void Calendar_SixDayWorkWeek()
        {
            var taskId1 = TaskId.Create();
            var taskId2 = TaskId.Create();

            var workingSaturday = WorkingDay.CreateEightToFive(DayOfWeek.Saturday);
            var sixDayWorkWeek  = WorkingWeek.Default.WithDay(workingSaturday);
            var calendar        = Calendar.Default.WithWorkingWeek(sixDayWorkWeek);

            var project = Project.Create()
                          .WithStart(new DateTime(2018, 1, 29))
                          .WithCalendar(calendar)
                          .AddTask(taskId1)
                          .WithDuration(ProjectTime.FromDays(10)).Project
                          .AddTask(taskId2)
                          .WithDuration(ProjectTime.FromDays(5))
                          .AddPredecessorLink(taskId1).Project;

            ProjectAssert.For(project)
            .ForTask(0)
            .AssertDuration(ProjectTime.FromDays(10))
            .AssertStart(new DateTime(2018, 1, 29, 8, 0, 0))
            .AssertFinish(new DateTime(2018, 2, 8, 17, 0, 0))
            .AssertWork(TimeSpan.Zero).Project
            .ForTask(1)
            .AssertDuration(ProjectTime.FromDays(5))
            .AssertStart(new DateTime(2018, 2, 9, 8, 0, 0))
            .AssertFinish(new DateTime(2018, 2, 14, 17, 0, 0))
            .AssertWork(TimeSpan.Zero);
        }
Example #12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,WorkingDayName,WorkingDayStart,WorkingDayEnd,HoursWorked")] WorkingDay workingDay)
        {
            if (id != workingDay.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workingDay);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkingDayExists(workingDay.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(workingDay));
        }
        public async Task <IActionResult> AddEvent(Event newEvent)
        {
            string     userID     = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            WorkingDay workingDay = await workingDayRepository.GetCurrentWorkingDay(userID);

            if (workingDay == null)
            {
                workingDay = new WorkingDay()
                {
                    UserID = userID
                };
                await workingDayRepository.Add(workingDay);
            }

            UserEvent lastEvent = workingDay.Events?.OrderByDescending(e => e.Time).FirstOrDefault();

            if (lastEvent != null && DateTime.Now.Minute == lastEvent.Time.Minute && DateTime.Now.Subtract(lastEvent.Time).TotalSeconds < 60)
            {
                TempData["StatusMessage"] = "Multiple events can't be recorded in the same minute.";
            }
            else
            {
                await userEventRepository.AddIfValid(userID,
                                                     new UserEvent
                {
                    WorkingDayID = workingDay.ID,
                    Event        = newEvent
                });

                await workingDayRepository.UpdateTimes(workingDay);
            }
            return(RedirectToAction("Index", "Home"));
        }
Example #14
0
        public async Task <string> CountDown(DateTime checkInTime, string userID)
        {
            ApplicationUser user = await appUser.GetUserWithVacations(userID);

            TimeSpan requiredWorkTime = user.WorkEndTime - user.WorkStartTime;

            // Account for half days
            if (user.IsOnHalfDayVacation(DateTime.Now))
            {
                requiredWorkTime = requiredWorkTime.Divide(2.0);
            }

            // Account for coming within grace period
            else if (checkInTime.TimeOfDay > user.WorkStartTime && checkInTime.TimeOfDay <= user.WorkStartTime.Add(user.GracePeriod))
            {
                requiredWorkTime = user.WorkEndTime - checkInTime.TimeOfDay;
            }

            // Account for time worked before
            WorkingDay workDay = await workingDayRepository.GetWorkingDayByUserID(userID);

            if (workDay?.WorkingTime.HasValue ?? false)
            {
                requiredWorkTime -= workDay.WorkingTime.Value;
            }

            // Remove time worked since last check in
            requiredWorkTime -= DateTime.Now.TimeOfDay - checkInTime.TimeOfDay;
            return(requiredWorkTime.Ticks > 0 ? $"{requiredWorkTime:hh\\:mm\\:ss}" : "-1");
        }
Example #15
0
        public async Task <IActionResult> PutWorkingDay([FromRoute] Guid id, [FromBody] WorkingDay workingDay)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != workingDay.Id)
            {
                return(BadRequest());
            }

            _context.Entry(workingDay).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkingDayExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #16
0
 public WorkingDay VHasValidMaxCheckIn(WorkingDay workingDay)
 {
     if (workingDay.MaxCheckIn < workingDay.CheckIn)
     {
         workingDay.Errors.Add("MaxCheckIn", "Harus lebih besar atau sama dengan CheckIn");
     }
     return(workingDay);
 }
Example #17
0
        public ActionResult DeleteConfirmed(int id)
        {
            WorkingDay workingDay = db.WorkingDays.Find(id);

            db.WorkingDays.Remove(workingDay);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #18
0
 public WorkingDay VHasMaxCheckIn(WorkingDay workingDay)
 {
     //if (workingDay.MaxCheckIn == null || workingDay.MaxCheckIn.Equals(DateTime.FromBinary(0)))
     //{
     //    workingDay.Errors.Add("MaxCheckIn", "Tidak valid");
     //}
     return(workingDay);
 }
Example #19
0
 public WorkingDay VHasValidMinCheckIn(WorkingDay workingDay)
 {
     if (workingDay.MinCheckIn > workingDay.CheckIn)
     {
         workingDay.Errors.Add("MinCheckIn", "Harus lebih kecil atau sama dengan CheckIn");
     }
     return(workingDay);
 }
Example #20
0
 public WorkingDay VHasMinCheckIn(WorkingDay workingDay)
 {
     if (workingDay.MinCheckIn == null || workingDay.MinCheckIn.Equals(DateTime.FromBinary(0)))
     {
         workingDay.Errors.Add("MinCheckIn", "Tidak valid");
     }
     return(workingDay);
 }
Example #21
0
 public WorkingDay VHasMaxCheckOut(WorkingDay workingDay)
 {
     if (workingDay.MaxCheckOut == null || workingDay.MaxCheckOut.Equals(DateTime.FromBinary(0)))
     {
         workingDay.Errors.Add("MaxCheckOut", "Tidak valid");
     }
     return(workingDay);
 }
Example #22
0
 public WorkingDay VHasValidMaxCheckOut(WorkingDay workingDay)
 {
     if (workingDay.MaxCheckOut < workingDay.CheckOut || workingDay.MaxCheckOut >= workingDay.MinCheckIn.AddDays(1))
     {
         workingDay.Errors.Add("MaxCheckOut", "Harus lebih besar atau sama dengan CheckOut dan sebelum MinCheckIn hari berikutnya");
     }
     return(workingDay);
 }
Example #23
0
 public WorkingDay VHasValidMinCheckOut(WorkingDay workingDay)
 {
     if (workingDay.MinCheckOut > workingDay.CheckOut || workingDay.MinCheckOut <= workingDay.MaxCheckIn)
     {
         workingDay.Errors.Add("MinCheckOut", "Harus lebih kecil atau sama dengan CheckOut dan setelah MaxCheckIn");
     }
     return(workingDay);
 }
        public JsonResult UpdateWorkingDay(WorkingDayViewModel workingDayViewModel)
        {
            ActionResult result = null;

            WorkingDay workingDay = this.Engine.WorkingCalendarManager.GetWorkingDay(workingDayViewModel.CalendarId,
                                                                                     Convert.ToDateTime(workingDayViewModel.CurrentDate));

            if (workingDay == null)
            {
                result = new ActionResult(false, "WorkingCalendar.WorkingDayNotExists");
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            workingDay.Description   = workingDayViewModel.Description;
            workingDay.IsWorkingDay  = workingDayViewModel.IsWorkingDay;
            workingDay.IsExceptional = workingDayViewModel.IsExceptional;
            List <WorkingTimeSpan> times = new List <WorkingTimeSpan>();

            if (workingDayViewModel.AMStartHour > -1 && workingDayViewModel.AMEndHour >= workingDayViewModel.AMStartHour &&
                workingDayViewModel.AMStartMinute > -1)
            {
                times.Add(new WorkingTimeSpan()
                {
                    StartTimeHour   = workingDayViewModel.AMStartHour,
                    StartTimeMinute = workingDayViewModel.AMStartMinute,
                    EndTimeHour     = workingDayViewModel.AMEndHour,
                    EndTimeMinute   = workingDayViewModel.AMEndMinute
                });
            }

            if (workingDayViewModel.PMStartHour > -1 && workingDayViewModel.PMEndHour >= workingDayViewModel.PMStartHour &&
                workingDayViewModel.PMStartMinute > -1)
            {
                times.Add(new WorkingTimeSpan()
                {
                    StartTimeHour   = workingDayViewModel.PMStartHour,
                    StartTimeMinute = workingDayViewModel.PMStartMinute,
                    EndTimeHour     = workingDayViewModel.PMEndHour,
                    EndTimeMinute   = workingDayViewModel.PMEndMinute
                });
            }
            workingDay.WorkingTimeSpans = times.ToArray();

            if (workingDay.IsWorkingDay &&
                (workingDay.WorkingTimeSpans == null || workingDay.WorkingTimeSpans.Length == 0))
            {// 没有设置工作时间
                result = new ActionResult(false, "WorkingCalendar.NoWorkingTimeSpans");
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            return(ExecuteFunctionRun(() =>
            {
                this.Engine.WorkingCalendarManager.UpdateWorkingDay(workingDay);
                result = new ActionResult(true, "msgGlobalString.SaveSucced");

                return Json(result, JsonRequestBehavior.DenyGet);
            }));
        }
 public static dtoWorkingDay castToDto(WorkingDay objToCast)
 {
     return(new dtoWorkingDay()
     {
         Id = objToCast.Id,
         WorkerId = objToCast.WorkerId,
         WeekDay = objToCast.WeekDay
     });
 }
Example #26
0
        public CreateWorkingDayDTO Insert(CreateWorkingDayDTO createWorkingDayDTO)
        {
            WorkingDay workingDay = Mapper.Map <WorkingDay>(createWorkingDayDTO);
            var        result     = TheUnitOfWork.WorkingDayRepo.Insert(workingDay);

            TheUnitOfWork.SaveChanges();
            createWorkingDayDTO.Id = result.Id;
            return(createWorkingDayDTO);
        }
Example #27
0
 public bool ValidCreateObject(WorkingDay workingDay, IWorkingTimeService _workingTimeService)
 {
     VHasWorkingTime(workingDay, _workingTimeService);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasCheckIn(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasCheckOut(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasMinCheckIn(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasMinCheckOut(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasMaxCheckIn(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasMaxCheckOut(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     // Need to fix the day before further validation for correct range checking
     FixWorkingDayRange(workingDay);
     VHasValidMinCheckIn(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasValidMaxCheckIn(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasValidMinCheckOut(workingDay);
     if (!isValid(workingDay))
     {
         return(false);
     }
     VHasValidMaxCheckOut(workingDay);
     return(isValid(workingDay));
 }
Example #28
0
 public bool IsShortestWorkingDay(WorkingDay workingDay)
 {
     if (!workingDay.IsEnabled)
     {
         return(false);
     }
     return(!GetQueryable().Where(x => x.WorkingTimeId == workingDay.WorkingTimeId && x.IsEnabled &&
                                  (x.WorkInterval < workingDay.WorkInterval || (x.WorkInterval == workingDay.WorkInterval && x.Id != workingDay.Id))).Any());
 }
        public void MakeWorkingDay(WorkingDay materialDto)
        {
            WorkingDay workingDay = new WorkingDay()
            {
                //Quantity = materialDto.Quantity
            };

            _repository.Create(workingDay);
        }
Example #30
0
 public ActionResult Edit([Bind(Include = "IDinitials,initials,name,description,photo")] WorkingDay workingDay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workingDay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workingDay));
 }
Example #31
0
        private Guid SaveWorkingDay(WorkingDay workingDay)
        {
            if (workingDay.Id == Guid.Empty)
                workingDay.Id = Guid.NewGuid();

            if (Uow.WorkingDays.IsExist(workingDay.Id))
                Uow.WorkingDays.Update(workingDay);
            else
                Uow.WorkingDays.Add(workingDay);

            return workingDay.Id;
        }
Example #32
0
        private static string GetWorkingDayString(WorkingDay workingDay)
        {
            var values = Enum.GetValues(typeof(WorkingDay));
            var stringValues = new List<string>();
            foreach (WorkingDay value in values)
            {
                if (value == WorkingDay.None)
                {
                    continue;
                }

                if ((workingDay & value) == value)
                {
                    stringValues.Add(value.ToString());
                }
            }

            return string.Join(", ", stringValues.ToArray());
        }
 public static bool Is(this WorkingDay workingDay, WorkingDay dayToCompare)
 {
     return (workingDay & dayToCompare) == dayToCompare;
 }