public BllEvent UpdateStatusAndSendOutEvent(BllEvent Event, BllUser updater) { try { var datetime = DateTime.Now; Event.StatusLib.SelectedEntities.Last().Date = datetime; using (ServiceDB serviceDB = new ServiceDB()) { IUnitOfWork uow = new UnitOfWork(serviceDB); StatusLibService service = new StatusLibService(uow); Event.StatusLib = service.Update(Event.StatusLib); UserLibService userservice = new UserLibService(uow); Event.RecieverLib = userservice.Update(Event.RecieverLib); new Thread(() => { UpdateEventWithUsers(Event, updater); }).Start(); return(Event); } } catch (Exception ex) { LogWriter.WriteMessage("UpdateStatusAndSendOutEvent", ex.Message + ex.InnerException, updater.Fullname); return(Event); } }
private void SetAttributeInRow(DataGridViewRow row, BllEvent Event) { foreach (var attr in Event.AttributeLib.SelectedEntities) { row.Cells[ColumnIndicies[COL_ATTRIBUTE]].Value += attr.Entity.Name + "; "; } }
public void AddRowToDataGridUsingEvent(DataGridView grid, UiEvent uiEvent) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(grid); row.DefaultCellStyle.Font = new Font("Tahoma", 9); BllEvent Event = uiEvent.EventData; row.Cells[ColumnIndicies[COL_SENDER]].Value = Event.Sender.Fullname; row.Cells[ColumnIndicies[COL_TITLE]].Value = Event.Name; row.Cells[ColumnIndicies[COL_DATE]].Value = Event.Date.ToString(DATE_FORMAT); row.Cells[ColumnIndicies[COL_TIME]].Value = Event.Date.ToString(TIME_FORMAT); row.Cells[ColumnIndicies[COL_DESCTIPTION]].Value = Event.Description; row.Cells[ColumnIndicies[COL_NOTE]].Value = uiEvent.Note; SetStatusInRow(row, Event); SetAttributeInRow(row, Event); SetFileCountInRow(row, Event); uiEvent.SetRowStyle(row); grid.Rows.Add(row); if (uiEvent.MissedStatus) { RowStyleManager.MakeCellBoldFont(row.Cells[ColumnIndicies[COL_STATUS]]); } }
private void PopulateTextBoxesUsingEvent(BllEvent Event) { textBox2.Text = Event.Sender.Fullname; textBox3.Text = Event.Name; textBox4.Text = Event.Date.ToString(DATE_FORMAT); textBox5.Text = Event.Date.ToString(TIME_FORMAT); }
public void SetStatusInRow(DataGridViewRow row, BllEvent Event) { if (Event.StatusLib.SelectedEntities.Count > 0) { var status = Event.StatusLib.SelectedEntities.Last(); row.Cells[ColumnIndicies[COL_STATUS]].Value = status.Entity.Name + " " + status.Date; } }
public static BllStatus GetCurrentEventStatus(BllEvent source) { if (source.StatusLib.SelectedEntities.Count == 0) { throw new NoItemsInCollectionException(); } return(source.StatusLib.SelectedEntities.Last().Entity); }
public void GetEvent(BllEvent Event) { UiEvent newEvent = new NewEvent(Event, ""); AddNewEvent(newEvent); SerializeEvents(); Signal.PlaySignalAccordingToEventConfigValue(); SortEventsUsingLastOrderFromCache(); }
public void AddNewEventAndSerialize(BllEvent Event) { UiEvent wrappedEvent = new RegularEvent(Event, ""); Events.Add(wrappedEvent); dataGridManager.AddRowToDataGridUsingEvent(dataGridView, wrappedEvent); SortEventsUsingLastOrderFromCache(); SerializeEvents(); }
public void UpdateRecieversAndSendOnEvent(BllEvent Event, List <BllUser> newRecievers) { try { server.UpdateRecieversAndSendOnEvent(Event, newRecievers); } catch { throw new ConnectionFailedException(); } }
public BllEvent CreateAndSendOutEvent(BllEvent Event) { try { return(server.CreateAndSendOutEvent(Event)); } catch { throw new ConnectionFailedException(); } }
public static bool IsEventAcceptedByUser(BllEvent Event, BllUser User) { foreach (var item in Event.RecieverLib.SelectedEntities) { if (AreUsersEqual(item.Entity, User) && item.IsEventAccepted) { return(true); } } return(false); }
public BllEvent UpdateAcceptedUsersAndSendOutEvent(BllEvent Event, BllUser sender) { try { return(server.UpdateAcceptedUsersAndSendOutEvent(Event, sender)); } catch { throw new ConnectionFailedException(); } }
private void SetFileCountInRow(DataGridViewRow row, BllEvent Event) { var cellFile = (DataGridViewButtonCell)row.Cells[ColumnIndicies[COL_FILE]]; if (Event.FilepathLib.Entities.Count == 0) { cellFile.Value = "-"; cellFile.ReadOnly = true; } else { cellFile.Value += " " + Event.FilepathLib.Entities.Count + " ф."; } }
private void InvokeEventWithUsers(BllEvent Event, List <BllUser> users) { foreach (var user in users) { try { Clients[user.Login].GetEvent(Event); } catch (Exception ex) { Clients.Remove(user.Login); } } }
public void GetEventPositiveTest() { string ExecutablePath = "E:\\Projects\\Visual Studio\\Pipeline\\MainFormTest\\bin\\Debug\\Client.exe"; MainForm mainForm = new MainForm(ExecutablePath); BllEvent testEvent = CreateTestEvent(); // mainForm.GetEvent(testEvent); //isTaskBarHighliths //isTrayHighlights //isDataContainersPopulatedProperly //isProperRowSelected //isListSortedProperly //HasFilesDownloaded //isRowBold }
public void UpdateSelectedEvent(BllEvent source, int rowNum) //confirmed { if (dataGridView1.SelectedRows.Count > 0) { if (SelectedRowIndex == rowNum) { Invoke(new Action(() => { PopulateStatusDataGridUsingStatusLib(source.StatusLib); FillUserChecklist(source.RecieverLib.SelectedEntities); HandleStatusChanging(); })); } } }
public void UpdateEvent(BllEvent Event) { int updatedEventNum = FindUpdatedEventInEventSequenceById(Event.Id); var updatingEvent = Events[updatedEventNum]; if (updatedEventNum >= 0) { if (EventHelper.IsTargetStatusObsolete(Event, updatingEvent.EventData)) { updatingEvent.EventData = Event; UpdateEventAccordingToCurrentStatus(updatingEvent, updatedEventNum); } updatingEvent.EventData = Event; ownerForm.UpdateSelectedEvent(Event, updatedEventNum); SerializeEvents(); } }
private void InvokeEventWithRecievers(BllEvent Event) { foreach (var reciever in Event.RecieverLib.SelectedEntities) { try { if (Event.Sender.Id != reciever.Entity.Id) { Clients[reciever.Entity.Login].GetEvent(Event); } } catch (Exception ex) { Clients.Remove(reciever.Entity.Login); } } }
public BllEvent MapToBll(DalEvent entity) { BllEvent bllEntity = new BllEvent { Id = entity.Id, Name = entity.Name, AttributeLib = attributeLibService.Get(entity.Attribute_lib_id), Date = entity.Date, Description = entity.Description, FilepathLib = filepathLibService.Get(entity.Filepath_lib_id), RecieverLib = userLibService.Get(entity.Receiver_lib_id), StatusLib = statusLibService.Get(entity.Status_lib_id), Sender = userService.Get(entity.Sender_id), Type = eventTypeService.Get(entity.Type_id) }; return(bllEntity); }
public DalEvent MapToDal(BllEvent entity) { DalEvent dalEntity = new DalEvent { Id = entity.Id, Name = entity.Name, Attribute_lib_id = entity.AttributeLib.Id, Date = entity.Date, Description = entity.Description, Filepath_lib_id = entity.FilepathLib.Id, Receiver_lib_id = entity.RecieverLib.Id, Status_lib_id = entity.StatusLib.Id, Sender_id = entity.Sender.Id, Type_id = entity.Type.Id }; return(dalEntity); }
public static bool IsTargetStatusObsolete(BllEvent source, BllEvent target) { if (source.StatusLib.SelectedEntities.Count > 0) { var selectedStatuses = target.StatusLib.SelectedEntities; var newstatus = source.StatusLib.SelectedEntities.Last(); if (selectedStatuses.Count > 0) { var oldstatus = selectedStatuses.Last(); if (newstatus.Date != oldstatus.Date) { return(true); } } else { return(true); } } return(false); }
public void UpdateRecieversAndSendOnEvent(BllEvent Event, List <BllUser> newRecievers) { try { using (ServiceDB serviceDB = new ServiceDB()) { IUnitOfWork uow = new UnitOfWork(serviceDB); UserLibService userservice = new UserLibService(uow); Event.RecieverLib = AddUsersToLib(Event.RecieverLib, newRecievers); Event.RecieverLib = userservice.Update(Event.RecieverLib); new Thread(() => { InvokeEventWithUsers(Event, newRecievers); UpdateEventWithRecieversExceptUsers(Event, newRecievers); }).Start(); } } catch (Exception ex) { LogWriter.WriteMessage("UpdateRecieversAndSendOutEvent", ex.Message + ex.InnerException, ""); } }
public BllEvent UpdateAcceptedUsersAndSendOutEvent(BllEvent Event, BllUser updater) { try { using (ServiceDB serviceDB = new ServiceDB()) { IUnitOfWork uow = new UnitOfWork(serviceDB); UserLibService userservice = new UserLibService(uow); Event.RecieverLib = userservice.Update(Event.RecieverLib); new Thread(() => { UpdateEventWithUsers(Event, updater); }).Start(); return(Event); } } catch (Exception ex) { LogWriter.WriteMessage("UpdateAcceptedUsersAndSendOutEvent", ex.Message + ex.InnerException, updater.Fullname); return(Event); } }
private void UpdateEventWithUsers(BllEvent Event, BllUser updater) { try { foreach (var reciever in Event.RecieverLib.SelectedEntities) { try { if (updater.Id != reciever.Entity.Id) { Clients[reciever.Entity.Login].UpdateEvent(Event); } } catch (Exception ex) { Clients.Remove(reciever.Entity.Login); } } } catch (Exception ex) { LogWriter.WriteMessage("UpdateEventWithUsers", ex.Message + ex.InnerException, updater.Fullname); } }
private void UpdateEventWithRecieversExceptUsers(BllEvent Event, List <BllUser> users) { try { foreach (var reciever in Event.RecieverLib.SelectedEntities) { try { if (!users.Contains(reciever.Entity)) { Clients[reciever.Entity.Login].UpdateEvent(Event); } } catch (Exception ex) { Clients.Remove(reciever.Entity.Login); } } } catch (Exception ex) { LogWriter.WriteMessage("UpdateEventWithRecieversExceptUsers", ex.Message + ex.InnerException, ""); } }
public BllEvent CreateAndSendOutEvent(BllEvent Event) { try { var datetime = DateTime.Now; Event.Date = datetime; using (ServiceDB serviceDB = new ServiceDB()) { IUnitOfWork uow = new UnitOfWork(serviceDB); IEventService eventService = new EventService(uow); BllEvent res = eventService.Create(Event); new Thread(() => { InvokeEventWithRecievers(Event); }).Start(); return(res); } } catch (Exception ex) { LogWriter.WriteMessage("CreateAndSendOutEvent", ex.Message + ex.InnerException, Event.Sender.Fullname); return(Event); } }
public RegularEvent(BllEvent Event, string note) : base(Event, note) { EventState = EventStates.RegularEvent; }
public UiEvent(BllEvent Event, string note, bool MissedStatus) { EventData = Event; Note = note; this.MissedStatus = MissedStatus; }
public void UpdateEvent(BllEvent Event) { throw new NotImplementedException(); }
public UiEvent(BllEvent Event, string note) { EventData = Event; Note = note; }