/// <summary> /// 建構式 /// </summary> /// <param name="detector">偵測器</param> /// <param name="record">接收記錄訊息</param> /// <param name="deviceType">設備類型</param> /// <param name="sourceIp">來源 IP</param> public GenericRecordDirector(Detector detector, string record, DeviceType deviceType, NotifierStrategy strategy, string sourceIp = null) { _license = new LicenseBusinessLogic(); _workDirector = new WorkDirector(detector, record, deviceType, sourceIp); _notificationDirector = new NotificationDirector(strategy); _pusher = new MonitorPushStrategy(); }
public IHttpActionResult Post(Repair repair) { var name = "Repair"; var logger = NLog.LogManager.GetLogger(name); try { var license = new LicenseBusinessLogic(); license.Verify(DateTime.Now); var output = Save(repair); GenericPushStrategy pusher = new RepairPushStrategy(output); pusher.Execute(); return(Ok()); } catch (Exception ex) { logger.Error(ex); return(Content(HttpStatusCode.InternalServerError, ex)); } }