Exemplo n.º 1
0
 public bool AddSchedule(SQLAdmin.Domain.Schedule schedule)
 {
     using (ChannelFactory <IScheduleService> channelFactory = new ChannelFactory <IScheduleService>("SQLAdmin.Timer"))
     {
         try
         {
             IScheduleService proxy = channelFactory.CreateChannel();
             SQLAdmin.TimerContract.Schedule entitySchedule = schedule.ToEntity();
             Monitor monitor = MonitorTypeHelper.GetMonitorByType(schedule.MonitorType);
             entitySchedule.Type     = monitor.Type;
             entitySchedule.Method   = monitor.Method;
             entitySchedule.Assembly = monitor.Assembly;
             monitor.Threshold       = schedule.Threshold;
             monitor.ToEmail         = schedule.ToEmail;
             monitor.DBConnect       = this.mDBConnect;
             entitySchedule.Context  = SerializerHelper.SerializerObjectByJsonConvert(monitor);
             return(proxy.AddSchedule(entitySchedule));
         }
         catch (Exception e)
         {
             throw;
         }
     }
 }