Пример #1
0
        public string SaveCalendar(CalendarJson json)
        {
            var manager  = new CalendarManager(new UnitOfWork());
            var calendar = CalendarAssembler.ToCalender(json);

            manager.SaveCalendar(calendar);
            return("بروزرسانی با موفقیت انجام شد.");
        }
Пример #2
0
        public static Calendar ToCalender(CalendarJson json)
        {
            var calendar = new Calendar();

            calendar.ID            = json.ID;
            calendar.IsFridayWD    = json.IsFridayWD;
            calendar.IsMondayWD    = json.IsMondayWD;
            calendar.IsSaturdayWD  = json.IsSaturdayWD;
            calendar.IsSundayWD    = json.IsSundayWD;
            calendar.IsThursdayWD  = json.IsThursdayWD;
            calendar.IsWednesdayWD = json.IsWednesdayWD;
            calendar.Title         = json.Title;
            calendar.IsTuesdayWD   = json.IsTuesdayWD;
            calendar.Holidays      = HolidayAssembler.ToHolidays(json.Holidays, calendar.ID);


            return(calendar);
        }
Пример #3
0
        public static CalendarJson ToJson(Calendar calendar, IUnitOfWork uow)
        {
            ProjectManager projectManager = new ProjectManager(uow);
            var            json           = new CalendarJson();

            json.ID            = calendar.ID;
            json.IsFridayWD    = calendar.IsFridayWD;
            json.IsMondayWD    = calendar.IsMondayWD;
            json.IsSaturdayWD  = calendar.IsSaturdayWD;
            json.IsSundayWD    = calendar.IsSundayWD;
            json.IsThursdayWD  = calendar.IsThursdayWD;
            json.IsWednesdayWD = calendar.IsWednesdayWD;
            json.Title         = calendar.Title;
            json.IsTuesdayWD   = calendar.IsTuesdayWD;
            json.Holidays      = HolidayAssembler.ToJsons(calendar.Holidays);
            json.AssignStatus  = projectManager.GetAll().Any(x => x.CalendarID == calendar.ID) ? "تخصیص داده شده" : "فاقد تخصیص";
            return(json);
        }