コード例 #1
0
        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);
            }
        }
コード例 #2
0
 private void SetAttributeInRow(DataGridViewRow row, BllEvent Event)
 {
     foreach (var attr in Event.AttributeLib.SelectedEntities)
     {
         row.Cells[ColumnIndicies[COL_ATTRIBUTE]].Value += attr.Entity.Name + "; ";
     }
 }
コード例 #3
0
        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]]);
            }
        }
コード例 #4
0
 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);
 }
コード例 #5
0
 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;
     }
 }
コード例 #6
0
 public static BllStatus GetCurrentEventStatus(BllEvent source)
 {
     if (source.StatusLib.SelectedEntities.Count == 0)
     {
         throw new NoItemsInCollectionException();
     }
     return(source.StatusLib.SelectedEntities.Last().Entity);
 }
コード例 #7
0
        public void GetEvent(BllEvent Event)
        {
            UiEvent newEvent = new NewEvent(Event, "");

            AddNewEvent(newEvent);
            SerializeEvents();
            Signal.PlaySignalAccordingToEventConfigValue();
            SortEventsUsingLastOrderFromCache();
        }
コード例 #8
0
        public void AddNewEventAndSerialize(BllEvent Event)
        {
            UiEvent wrappedEvent = new RegularEvent(Event, "");

            Events.Add(wrappedEvent);
            dataGridManager.AddRowToDataGridUsingEvent(dataGridView, wrappedEvent);
            SortEventsUsingLastOrderFromCache();
            SerializeEvents();
        }
コード例 #9
0
 public void UpdateRecieversAndSendOnEvent(BllEvent Event, List <BllUser> newRecievers)
 {
     try
     {
         server.UpdateRecieversAndSendOnEvent(Event, newRecievers);
     }
     catch
     {
         throw new ConnectionFailedException();
     }
 }
コード例 #10
0
 public BllEvent CreateAndSendOutEvent(BllEvent Event)
 {
     try
     {
         return(server.CreateAndSendOutEvent(Event));
     }
     catch
     {
         throw new ConnectionFailedException();
     }
 }
コード例 #11
0
 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);
 }
コード例 #12
0
 public BllEvent UpdateAcceptedUsersAndSendOutEvent(BllEvent Event, BllUser sender)
 {
     try
     {
         return(server.UpdateAcceptedUsersAndSendOutEvent(Event, sender));
     }
     catch
     {
         throw new ConnectionFailedException();
     }
 }
コード例 #13
0
        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 + " ф.";
            }
        }
コード例 #14
0
 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);
         }
     }
 }
コード例 #15
0
        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
        }
コード例 #16
0
 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();
             }));
         }
     }
 }
コード例 #17
0
        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();
            }
        }
コード例 #18
0
 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);
         }
     }
 }
コード例 #19
0
        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);
        }
コード例 #20
0
        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);
        }
コード例 #21
0
 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);
 }
コード例 #22
0
 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, "");
     }
 }
コード例 #23
0
        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);
            }
        }
コード例 #24
0
 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);
     }
 }
コード例 #25
0
 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, "");
     }
 }
コード例 #26
0
 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);
     }
 }
コード例 #27
0
 public RegularEvent(BllEvent Event, string note) : base(Event, note)
 {
     EventState = EventStates.RegularEvent;
 }
コード例 #28
0
 public UiEvent(BllEvent Event, string note, bool MissedStatus)
 {
     EventData         = Event;
     Note              = note;
     this.MissedStatus = MissedStatus;
 }
コード例 #29
0
 public void UpdateEvent(BllEvent Event)
 {
     throw new NotImplementedException();
 }
コード例 #30
0
 public UiEvent(BllEvent Event, string note)
 {
     EventData = Event;
     Note      = note;
 }