Esempio n. 1
0
        public static Holiday UpdateHoliday(Holiday holiday)
        {
            using (var entity = new StaffingModelContainer())
            {
                entity.VacanceTable.Single(o => o.ID == holiday.Id).Update(holiday);
                entity.SaveChanges();

                holiday = entity.VacanceTable.Single(o => o.ID == holiday.Id).CreateHoliday();
            }

            switch (holiday.Status)
            {
                case ItemStatus.Waiting:
                    Mail.Send(holiday.ConsultantId, MailType.HolidayRequest, holiday);
                    break;
                case ItemStatus.Refused:
                    Mail.Send(holiday.ConsultantId, MailType.HolidayRefused, holiday);
                    break;
                case ItemStatus.Validate:
                    Mail.Send(holiday.ConsultantId, MailType.HolidayValidated, holiday);
                    break;
            }

            return holiday;
        }
Esempio n. 2
0
 public static void DeleteHoliday(Holiday holiday)
 {
     using (var entity = new StaffingModelContainer())
     {
         entity.VacanceTable.Single(o => o.ID == holiday.Id).Actif = false;
         entity.SaveChanges();
     }
 }
Esempio n. 3
0
        internal static Holiday AddHoliday(Holiday newHoliday)
        {
            using (var entity = new StaffingModelContainer())
            {
                var result = entity.VacanceTable.Add(newHoliday.CreateDatabaseHoliday());
                entity.SaveChanges();

                return result.CreateHoliday();
            }
        }
Esempio n. 4
0
        public void DeleteHoliday(Holiday holiday, string token)
        {
            if (!IsConnected(token))
            {
                throw new NotConnectedException();
            }

            HolidayDAL.DeleteHoliday(holiday);
        }
Esempio n. 5
0
        public Holiday UpdateHoliday(Holiday holiday, string token)
        {
            if (!IsConnected(token))
            {
                throw new NotConnectedException();
            }

            return HolidayDAL.UpdateHoliday(holiday);
        }