private void Process(RequestedEvents<AtomEntry> requestedEvents) { AddEventsToDocument(requestedEvents); if (feedCancelled) return; Thread.Sleep(TimeSpan.FromMilliseconds(100)); Self.Tell(new PollForEvents(Context.Sender)); }
public static void ScheduleEvents() { List <RequestedEvents> reqEvents = new RequestedEvents().GetRequestedEvents(); Contract contractFirst; Contract contractSecond; foreach (RequestedEvents item in reqEvents) { if (item.Status == "Completed") { reqEvents.Remove(item); } else { item.RemoveEvent(); } } RequestedEvents[] eventList = reqEvents.ToArray(); int eventOrder = eventList[0].EventId; List <Contract> contracts; for (int i = 0; i < eventList.Count() - 1; i++) { contracts = new Contract().GetAllContracts(eventList[i].TechLog_Client.ClientIdentifier); contractFirst = contracts[contracts.Count - 1]; for (int k = i + 1; k > 0; k--) { contracts = new Contract().GetAllContracts(eventList[k].TechLog_Client.ClientIdentifier); contractSecond = contracts[contracts.Count - 1]; RequestedEvents temp; if (((contractSecond.SLevel.Level == "HIGH") && (contractFirst.SLevel.Level == "STANDARD" || contractFirst.SLevel.Level == "LOW")) || ((contractSecond.SLevel.Level == "STANDARD") && (contractFirst.SLevel.Level == "LOW"))) { temp = eventList[i]; eventList[i] = eventList[k]; eventList[k] = temp; } else if ((eventList[i].RequestedDate - eventList[k].RequestedDate).Days > 7) { temp = eventList[i]; eventList[i] = eventList[k]; eventList[k] = temp; } } } foreach (RequestedEvents item in eventList) { item.ScheduleOrder = eventOrder; item.NewEvent(); eventOrder++; } }
private void btnShowAll_Click(object sender, EventArgs e) { List <RequestedEvents> reqEvents = new RequestedEvents().GetRequestedEvents(); foreach (RequestedEvents item in reqEvents) { if (item.Status == "Completed") { reqEvents.Remove(item); } } PdfWriter.CreateSchedule(reqEvents); }
private void Process(RequestedEvents <AtomEntry> requestedEvents) { AddEventsToDocument(requestedEvents); if (feedCancelled) { return; } Thread.Sleep(TimeSpan.FromMilliseconds(100)); Self.Tell(new PollForEvents(Context.Sender)); }
private void AddEventsToDocument(RequestedEvents<AtomEntry> requestedEvents) { foreach (var itemEnvelope in requestedEvents.Events) { LogTraceInfo($"Saving event with id {itemEnvelope.ItemToStore.Id} " + $"and sequence number {itemEnvelope.ItemSequenceNumber} to repo with document id {DocumentId.Id}"); _repository.Add(this.CurrentDocumentId, itemEnvelope.ItemToStore).Wait(); lastEventIdProcessed = itemEnvelope.ItemSequenceNumber; entriesInCurrentDocument++; CheckEventsPerDocument(); } }
private void AddEventsToDocument(RequestedEvents <AtomEntry> requestedEvents) { foreach (var itemEnvelope in requestedEvents.Events) { LogTraceInfo($"Saving event with id {itemEnvelope.ItemToStore.Id} " + $"and sequence number {itemEnvelope.ItemSequenceNumber} to repo with document id {DocumentId.Id}"); _repository.Add(this.CurrentDocumentId, itemEnvelope.ItemToStore).Wait(); lastEventIdProcessed = itemEnvelope.ItemSequenceNumber; entriesInCurrentDocument++; CheckEventsPerDocument(); } }
private void btnReqEvent_Click(object sender, EventArgs e) { if (ValidateEvent()) { RequestedEvents reqEvent = new RequestedEvents((Client)clientBind.Current, dtpReqDate.Value, cmbStatus.SelectedItem.ToString(), txtRemarks.Text, cmbSkill.SelectedItem.ToString()); if (reqEvent.NewEvent()) { MessageBoxShower.ShowInfo("The event has been logged succesfully.", "Success"); Scheduler.ScheduleEvents(); } else { CustomExceptions error = new CustomExceptions("The event could not be scheduled. Please try again later.", "Success"); } } else { CustomExceptions error = new CustomExceptions("Please complete all fields correctly.", "Validation Error!"); } }
private void GetEvents(RequestEvents eventRequest) { lowestItemTracker.AddEntry(eventRequest.LastProcessedId, eventRequest.FeedId.Id); queuedItems.RemoveItemsWithIndexLowerThan(lowestItemTracker.GetLowestValue() + 1); LogTraceInfo($"Received event request for {eventRequest.EventsToSend} events with {eventRequest.LastProcessedId} last events from actor {Context.Sender.Path}"); List<ItemEnvelope<AtomEntry>> eventEnvelope; if (eventRequest.LastProcessedId == 0) eventEnvelope = queuedItems.Get(eventRequest.EventsToSend, eventRequest.EarliestEventsToSend); else eventEnvelope = queuedItems.Get(eventRequest.EventsToSend, eventRequest.LastProcessedId, eventRequest.FeedId); if (eventEnvelope.Count > 0) LogTraceInfo($"Returning events {string.Join(",", (from p in eventEnvelope select p.ItemToStore.Id).ToArray())} events with {eventRequest.LastProcessedId} last events from actor {Context.Sender.Path}"); RequestedEvents<AtomEntry> events = new RequestedEvents<AtomEntry>(eventEnvelope, queueAddress); Context.Sender.Tell(events, Context.Self); }
private void btnUpdateEvent_Click(object sender, EventArgs e) { if (Validation.ValidateCombo(ref cmbEvents) && Validation.ValidateCombo(ref cmbTechs)) { RequestedEvents currentEvent = (RequestedEvents)eventBind.Current; TechnicalLog tl = new TechnicalLog(currentEvent, (Technicians)techBind.Current); if (currentEvent.UpdateEvent() && tl.LogEvent()) { MessageBoxShower.ShowInfo("The event was successfully updated.", "Success!"); } else { CustomExceptions error = new CustomExceptions("The event could not be updated. Please try again later.", "Something went wrong.."); } Scheduler.ScheduleEvents(); } else { CustomExceptions error = new CustomExceptions("Please complete all fields correctly.", "Validation Error"); } }