Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ServiceEvent serviceEvent = Repository.getServiceEvent(id);

            Repository.deleteServiceEvent(serviceEvent);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult AddEvent(AddEventModel viewModel)
        {
            var session = Session["Login"] as SessionModel;

            if (session != null)
            {
                using (var db = new MechAppProjectEntities())
                {
                    var serviceId        = Convert.ToInt32(viewModel.WorkshopService.Value);
                    var service          = db.WorkshopServices.First(x => x.ServiceId == serviceId);
                    var serviceStartTime = viewModel.ServiceHours.Value.Split(':');

                    var startDate = viewModel.ServiceDate + new TimeSpan(Convert.ToInt32(serviceStartTime[0]), Convert.ToInt32(serviceStartTime[1]), 0);
                    var endDate   = startDate + new TimeSpan(service.DurationInHrs, service.DurationInMinutes, 0);

                    var serviceEventModel = new ServiceEvent()
                    {
                        CustomerId  = session.UserId,
                        ServiceId   = service.ServiceId,
                        OrderStatus = (int)OrderStatus.OrderReceived,
                        StartDate   = startDate,
                        EndDate     = endDate
                    };

                    db.ServiceEvents.Add(serviceEventModel);
                    db.SaveChanges();
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Publish a service related event to the Disa Android client.
 ///
 /// IMPORTANT: Note that this is internal so that only the Disa.Framework assembly can call this function.
 /// </summary>
 /// <param name="eventAction">The type safe representation of the Event Action.</param>
 /// <param name="eventCategory">The type safe representation of the Event Category.</param>
 /// <param name="service">The <see cref="Service"/> to be associated with this Google Analytics event.</param>
 internal static void RaiseServiceEvent(
     EventAction eventAction,
     EventCategory eventCategory,
     Service service)
 {
     ServiceEvent?.Invoke(eventAction, eventCategory, service);
 }
Exemplo n.º 4
0
        private void OrdersPropertyChanged(object sender, ServiceEvent <SalepointAddedOrdersEvents> e)
        {
            switch (e.Type)
            {
            case SalepointAddedOrdersEvents.AddedList:
                this.Orders.Clear();
                foreach (OrderSalepoint addedOrder in this.salepointOrdersService.AddedOrders)
                {
                    CreateOrderViewModel(addedOrder);
                }

                break;

            case SalepointAddedOrdersEvents.AddedOrder:
                this.CreateOrderViewModel((OrderSalepoint)e.Resource);
                break;

            case SalepointAddedOrdersEvents.RemovedOrder:
                var orderToRemove = (OrderSalepoint)e.Resource;
                var orderVM       = this.Orders.Where(x => x.Order.Id == orderToRemove.Id).FirstOrDefault();
                if (orderVM != null)
                {
                    this.Orders.Remove(orderVM);
                }
                break;
            }
            this.RaisePropertyChanged(() => this.Orders);
        }
Exemplo n.º 5
0
        public void ServiceAdded(ServiceEvent ev)
        {
            Log.Info(TAG, "ServiceAdded: " + ev.Name);

            // Required to force serviceResolved to be called again (after the first search)
            _mainActivity.JmDNS.RequestServiceInfo(ev.Type, ev.Name, 1);
        }
Exemplo n.º 6
0
 public void SaveEvent(ServiceEvent newEvent)
 {
     lock (rwLock)
     {
         Cache.Add(newEvent);
     }
 }
        private async void onActiveRouteUpdated(object sender, ServiceEvent <CarrierRouteEvents> e)
        {
            //first init should be handled by InitializeSideViewContent method, after view load
            if (!dataInitialised)
            {
                return;
            }

            //handle only major route events
            if (e.Type == CarrierRouteEvents.CancelledPoint || e.Type == CarrierRouteEvents.PassedPoint)
            {
                return;
            }

            this.InProgress = true;

            BaseViewModel vmToLoad         = e.Type == CarrierRouteEvents.AddedRoute ? this.activeRouteVM : (BaseViewModel)this.editRouteVM;
            Type          currentChildType = this.currentChildViewModel?.GetType();

            if (currentChildType != vmToLoad.GetType())
            {
                await this.navigationService.Navigate(vmToLoad).ContinueWith(t =>
                {
                    this.InProgress = false;
                });

                this.currentChildViewModel = vmToLoad;
            }
        }
Exemplo n.º 8
0
 internal void fireServiceEvent(ServiceEvent serviceEvent)
 {
     foreach (ServiceListener listener in serviceListenerList)
     {
         listener.serviceChanged(serviceEvent);
     }
 }
Exemplo n.º 9
0
        private static void OnTimedEvent(Object source, ElapsedEventArgs e)
        {
            try
            {
                var service = new ServiceController("OpenALPRMilestone");

                if (service != null)
                {
                    if (service.Status != ServiceControllerStatus.Running)
                    {
                        Logger.Log.Info("starting OpenALPRMilestone service");
                        ServiceEvent?.Invoke(null, new MessageEventArgs($"{DateTime.Now.ToString()}: OpenALPR Milestone service was not running, restarted now."));

                        service.Start();
                    }
                }
                else
                {
                    Logger.Log.Warn("service object is null");
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Error(null, ex);
            }
        }
Exemplo n.º 10
0
        public void TestRemoveInCallback()
        {
            var event1 = new ServiceEvent();

            int callback1Fired = 0;
            int callback2Fired = 0;
            int callback3Fired = 0;

            // Test removing the callback in the callback (oneshot)
            IDisposable unregister1 = event1.Register(() => callback1Fired++);
            IDisposable unregister2 = event1.Register(() => callback2Fired++);

            _unregister3 = event1.Register(() => {
                callback3Fired++;
                _unregister3.Dispose();
            });
            event1.Fire();
            Assert.Equal(1, callback1Fired);
            Assert.Equal(1, callback2Fired);
            Assert.Equal(1, callback3Fired);

            unregister1.Dispose();
            unregister2.Dispose();

            // Remove the test of them and make none of them fire
            callback1Fired = 0;
            callback2Fired = 0;
            callback3Fired = 0;
            event1.Fire();
            Assert.Equal(0, callback1Fired);
            Assert.Equal(0, callback2Fired);
            Assert.Equal(0, callback3Fired);
            _unregister3 = null;
        }
Exemplo n.º 11
0
        //Receive message ack event handle
        private void ReceiveMessageACK(ServiceEvent serviceEvent)
        {
            this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
            {
                try
                {
                    if (!_msgRequesetIdMsgItemInfoDict.ContainsKey(serviceEvent._requestID))
                    {
                        return;
                    }

                    //Get message ack result
                    bool success = serviceEvent._eventData._result == 0 ? true : false;
                    if (success == true)
                    {
                        MessageBox.Show("Send to " + _msgRequesetIdMsgItemInfoDict[serviceEvent._requestID] + " succed!");
                    }
                    else
                    {
                        MessageBox.Show("Send  to " + _msgRequesetIdMsgItemInfoDict[serviceEvent._requestID] + " failed!");
                    }

                    _msgRequesetIdMsgItemInfoDict.Remove(serviceEvent._requestID);
                }
                catch (Exception exception)
                {
                }
            }));
        }
Exemplo n.º 12
0
        // GET: ServiceEvent/Create
        public ActionResult Create(string vin)

        {
            ServiceEvent myServiceEvent = new ServiceEvent();

            myServiceEvent.Vin = vin;
            return(View(myServiceEvent));
        }
Exemplo n.º 13
0
        public IEnumerable <IEventHandler> Get(string service, string @event)
        {
            var serviceEvent = new ServiceEvent(service, @event);

            return(_eventHandlers.TryGetValue(serviceEvent, out var handlers) ?
                   handlers :
                   new List <IEventHandler>());
        }
Exemplo n.º 14
0
        public ActionResult MyEvents()
        {
            IserviceEvent spe = new ServiceEvent();

            List <Event> eve = spe.GetMany(x => x.creator.username == User.Identity.Name).ToList();

            return(View(eve));
        }
Exemplo n.º 15
0
        public async Task CircuitBreaker_must_reply_with_special_failure_message_on_Write_requests_if_open()
        {
            var events = new[] { new DurableEvent("a", "emitter") };

            breaker.Tell(ServiceEvent.Failed(LogId, 1, TestLogFailureException));
            breaker.Tell(new Write(events, probe.Ref, probe.Ref, 1, 2));
            probe.ExpectMsg(new WriteFailure(events, CircuitBreaker.Exception, 1, 2));
            probe.Sender.Should().Be(probe.Ref);
        }
Exemplo n.º 16
0
 protected override void OnArgusTVEvent(SynchronizationContext uiSyncContext, ServiceEvent @event)
 {
     if (@event.Name == ServiceEventNames.UpcomingRecordingsChanged ||
         @event.Name == ServiceEventNames.UpcomingAlertsChanged ||
         @event.Name == ServiceEventNames.UpcomingSuggestionsChanged)
     {
         uiSyncContext.Post(s => RefreshUpcomingPrograms(), null);
     }
 }
Exemplo n.º 17
0
 protected override void OnArgusTVEvent(SynchronizationContext uiSyncContext, ServiceEvent @event)
 {
     if (@event.Name == ServiceEventNames.RecordingStarted ||
         @event.Name == ServiceEventNames.RecordingEnded ||
         @event.Name == ServiceEventNames.ActiveRecordingsChanged)
     {
         uiSyncContext.Post(s => RefreshActiveRecordings(), null);
     }
 }
Exemplo n.º 18
0
 public ActionResult Edit([Bind(Include = "Id,ServiceDate,Vin,ServiceType,ServiceMileage,ServiceAmount")] ServiceEvent serviceEvent)
 {
     if (ModelState.IsValid)
     {
         Repository.editServiceEvent(serviceEvent);
         return(RedirectToAction("Index"));
     }
     return(View(serviceEvent));
 }
Exemplo n.º 19
0
        public FileContentResult GetServiceEventImage(int id)
        {
            ServiceEvent service = _unitOfWork.GetServiceEventById(id);

            if (service == null)
            {
                return(null);
            }
            return(File(service.Image, service.ContentType));
        }
Exemplo n.º 20
0
        public ActionResult Create([Bind(Include = "Id,ServiceDate,Vin,ServiceType,ServiceMileage,ServiceAmount")] ServiceEvent serviceEvent, string vin)
        {
            if (ModelState.IsValid)
            {
                serviceEvent.Vin = vin;
                Repository.createServiceEvent(serviceEvent);
                return(RedirectToAction("Index"));
            }

            return(View(serviceEvent));
        }
Exemplo n.º 21
0
        private void PublishEvent(ServiceEvent newEvent,
                                  string topicName,
                                  string filter)
        {
            ConnectionFactory connFactory = new ConnectionFactory()
            {
                HostName = config.brokerAddress,
                Port     = config.brokerPort
            };

            IConnection connection = null;
            IModel      channel    = null;

            try
            {
                connection = connFactory.CreateConnection();
                channel    = connection.CreateModel();

                string txtEvent = JsonConvert.SerializeObject(newEvent);
                byte[] content  = Encoding.UTF8.GetBytes(txtEvent);

                // Console.WriteLine("Publishing: " + txtEvent);

                channel.ExchangeDeclare(topicName,
                                        "topic",
                                        true,
                                        true,
                                        null);

                channel.BasicPublish(topicName,
                                     filter,
                                     false,
                                     null,
                                     content);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Failed to establish connection with message broker: "
                                  + $"address: {config.brokerAddress}:{config.brokerPort}, "
                                  + $"reason: {e.Message} ");
            }
            finally
            {
                if (channel != null && channel.IsOpen)
                {
                    channel.Close();
                }

                if (connection != null && connection.IsOpen)
                {
                    connection.Close();
                }
            }
        }
Exemplo n.º 22
0
 protected virtual void FetchEventHandler(string type, ServiceEvent inEvent, float inProgress, object inObject, object inUserData)
 {
     if (inEvent == ServiceEvent.COMPLETE)
     {
         a1 = inObject as MockAPIData;
     }
     else
     {
         Debug.LogError("Mock PAI Data fetch");
     }
 }
Exemplo n.º 23
0
        static void Main(string[] args)
        {
            //DriverExecute();
            //Inicio
            IEventLogs   iEventLogs = new EventLosgRepository();
            ServiceEvent service    = new ServiceEvent(iEventLogs);

            service.Insert_Event("Menu", "Juan");
            service.Insert_Event("Menu1", "Juan");
            service.Save_Event();
        }
Exemplo n.º 24
0
        public async Task CircuitBreaker_must_publish_ServiceFailed_once_on_event_stream_when_opened()
        {
            Sys.EventStream.Subscribe(probe.Ref, typeof(ServiceEvent));

            var serviceFailed = ServiceEvent.Failed(LogId, 1, TestLogFailureException);

            breaker.Tell(serviceFailed);
            probe.ExpectMsg(serviceFailed);

            breaker.Tell(ServiceEvent.Failed(LogId, 2, TestLogFailureException));
            probe.ExpectNoMsg(300.Milliseconds());
        }
Exemplo n.º 25
0
        public void LogMethodEndEvent(Guid correlationId, string methodName, long milliseconds)
        {
            var startEvent = new ServiceEvent()
            {
                CorrelationId = correlationId,
                DebugInfo     = string.Concat("Ticks:", milliseconds),
                Message       = string.Concat(methodName, " End Event"),
                EventId       = EventId.MethodEndEventId
            };

            ServiceEventSource.EventSource.LogServiceEvent(startEvent.ToLogLine());
        }
Exemplo n.º 26
0
 public async Task CircuitBreaker_must_open_after_first_failed_retry()
 {
     breaker.Tell(ServiceEvent.Failed(LogId, 1, TestLogFailureException));
     try
     {
         await breaker.Ask("a", Timeout);
     }
     catch (AggregateException e) when(e.Flatten().InnerException is EventLogUnavailableException)
     {
         // as expected
     }
 }
Exemplo n.º 27
0
        public async Task CircuitBreaker_must_publish_ServiceNormal_once_on_event_stream_when_closed()
        {
            Sys.EventStream.Subscribe(probe.Ref, typeof(ServiceEvent));

            breaker.Tell(ServiceEvent.Failed(LogId, 1, TestLogFailureException));
            probe.FishForMessage(msg => msg is ServiceEvent e && e.Type == ServiceEvent.EventType.ServiceFailed);
            breaker.Tell(ServiceEvent.Normal(LogId));
            probe.ExpectMsg(ServiceEvent.Normal(LogId));

            breaker.Tell(ServiceEvent.Normal(LogId));
            probe.ExpectNoMsg(300.Milliseconds());
        }
Exemplo n.º 28
0
        public async Task <IList <ServiceEvent> > GetServiceEventsAsync(string serviceName, Duration duration, IList <Type> types, CancellationToken token)
        {
            var filter           = FilterFactory.CreateServiceFilter(this.traceStoreReader, types, serviceName);
            var allServiceEvents = (await this.traceStoreReader.ReadTraceRecordsAsync(duration, filter, token).ConfigureAwait(false)).Select(oneRecord => ServiceEventAdapter.Convert(oneRecord)).ToList();

            if (this.traceStoreReader.IsPropertyLevelFilteringSupported() || string.IsNullOrWhiteSpace(serviceName))
            {
                return(allServiceEvents);
            }

            return(allServiceEvents.Where(oneEvent => oneEvent.ServiceId.Equals(ServiceEvent.TransformServiceName(serviceName), StringComparison.InvariantCultureIgnoreCase)).ToList());
        }
    public RetentionPolicy Match(ServiceEvent seEvent, IEnumerable <RetentionPolicy> policies)
    {
        var matchScores = (from p in policies
                           let score = (string.Equals(seEvent.AppName, p.ForAppName, StringComparison.CurrentCultureIgnoreCase) ? 10 : 0)
                                       + (seEvent.Severity == p.ForSeverity ? 10 : 0)
                                       + (string.Equals(seEvent.Description, p.ForDescription, StringComparison.CurrentCultureIgnoreCase) ? 10 : 0)
                                       select new { policy = p, score = score }).ToArray();

        var highestScore = matchScores.OrderByDescending(ms => ms.score).FirstOrDefault();

        return(highestScore?.policy);
    }
Exemplo n.º 30
0
        protected virtual void FetchEventHandler(string type, ServiceEvent inEvent, float inProgress, object inObject, object inUserData)
        {
            if (inEvent == ServiceEvent.COMPLETE)
            {
                mockData = inObject as MockAPIData;
            }
            else
            {
                Debug.LogError("Mock API Data fetch failed");
            }

            PopulateList();
        }
        /// <summary>
        /// This method adds a service event to the collection.
        /// </summary>
        /// <param name="status">The event status</param>
        /// <param name="theEvent">The event</param>
        public void ServiceEventAdd(XimuraServiceStatus status, ServiceEvent value)
        {
            lock (this)
            {
                if (EventsCollection == null)
                    EventsCollection = new Dictionary<XimuraServiceStatus, ServiceEvent>();

                if (EventsCollection.ContainsKey(status))
                    EventsCollection[status] += value;
                else
                    EventsCollection.Add(status, value);
            }
        }
Exemplo n.º 32
0
        /// <summary>
		/// This method fires an event to all parties that have registered with the ServiceEvent
		/// </summary>
		/// <param name="theEvent">The ServiceEvent Type to fire</param>
		protected virtual void ProcessEvent(ServiceEvent theEvent)
		{
			ProcessEvent(theEvent,this,null);
		}
Exemplo n.º 33
0
        private static void MakeDocumentationOfNode(ClinicalDocument ccda)
        {
            ServiceEvent se = new ServiceEvent();
            se.EffectiveTime = new IVL<TS>(new TS(DateTime.Now), new TS(DateTime.Now));

            Performer1 performer = new Performer1();
            performer.AssignedEntity = MakeAssignedEntity("DocumentationOf");
            performer.TypeCode = new CS<x_ServiceEventPerformer>(x_ServiceEventPerformer.PRF);

            DocumentationOf docOf = new DocumentationOf();
            docOf.ServiceEvent = new ServiceEvent();
            docOf.ServiceEvent = se;

            ccda.DocumentationOf = new List<DocumentationOf>();
            ccda.DocumentationOf.Add(docOf);
        }
Exemplo n.º 34
0
 public void RaiseServiceEvent(ServiceEvent evnt)
 {
     m_eventServer.SendEvent(new ServiceEventDispatcher(m_serviceListeners, evnt));
     m_eventServer.SendEvent(new AllServiceEventDispatcher(m_allServiceListeners, evnt));
 }
Exemplo n.º 35
0
		/// <summary>
		/// This method fires an event to all parties that have registered with the ServiceEvent
		/// </summary>
		/// <param name="theEvent">The ServiceEvent Type to fire</param>
		/// <param name="e">The ServiceEventArgs object to pass</param>
		protected virtual void ProcessEvent(ServiceEvent theEvent, ServiceEventArgs e)
		{
			ProcessEvent(theEvent,this,e);
		}
        /// <summary>
        /// This method handles service event removal.
        /// </summary>
        /// <param name="status">The service status.</param>
        /// <param name="value">The event.</param>
        public void ServiceEventRemove(XimuraServiceStatus status, ServiceEvent value)
        {
            lock (this)
            {
                if (EventsCollection == null)
                    EventsCollection = new Dictionary<XimuraServiceStatus, ServiceEvent>();

                if (!EventsCollection.ContainsKey(status))
                    return;

                ServiceEvent current = EventsCollection[status] - value;

                if (current == null)
                    EventsCollection.Remove(status);
                else
                    EventsCollection[status] = current;
            }
        }
        /// <summary>
        /// This method fires an event to all parties that have registered with the ServiceEvent
        /// </summary>
        /// <param name="theEvent">The ServiceEvent Type to fire</param>
        /// <param name="sender">The sended object to pass</param>
        /// <param name="e">The ServiceEventArgs object to pass</param>
        public virtual void ProcessEvent(ServiceEvent theEvent, object sender, ServiceEventArgs e)
        {
            //Check whether anyone is attached to the event
            if (theEvent == null)
                return;

            foreach (ServiceEvent te in theEvent.GetInvocationList())
            {
                te(sender, e);
            }
        }
 /// <summary>
 /// This method fires an event to all parties that have registered with the ServiceEvent
 /// </summary>
 /// <param name="theEvent">The ServiceEvent Type to fire</param>
 /// <param name="e">The ServiceEventArgs object to pass</param>
 public virtual void ProcessEvent(ServiceEvent theEvent, ServiceEventArgs e)
 {
     ProcessEvent(theEvent, rootClass, e);
 }
 /// <summary>
 /// This method fires an event to all parties that have registered with the ServiceEvent
 /// </summary>
 /// <param name="theEvent">The ServiceEvent Type to fire</param>
 public virtual void ProcessEvent(ServiceEvent theEvent)
 {
     ProcessEvent(theEvent, rootClass, null);
 }
Exemplo n.º 40
0
 public AllServiceEventDispatcher(ListenerQueue<IAllServiceListener> listeners, ServiceEvent evnt)
 {
     m_queueView = listeners.getView();
     m_event = evnt;
 }
Exemplo n.º 41
0
 public ServiceEventDispatcher(ListenerQueue<IServiceListener> listeners, ServiceEvent evnt)
 {
     m_queueView = listeners.getView();
     m_event = evnt;
     throw new NotImplementedException("add filtering first!!!");
 }