Exemplo 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;
        }
Exemplo 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();
     }
 }
Exemplo 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();
            }
        }
Exemplo n.º 4
0
        public void DeleteHoliday(Holiday holiday, string token)
        {
            if (!IsConnected(token))
            {
                throw new NotConnectedException();
            }

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

            return HolidayDAL.UpdateHoliday(holiday);
        }