コード例 #1
0
        /// <summary>
        ///     Чтение входящих данных
        /// </summary>
        private void GetDataEngine(object obj, EventArgs e)
        {
            if (IsConnected == false)
            {
                return;
            }

            try
            {
                string data = GetData(_read);

                if (data == null)
                {
                    return;
                }
                else
                {
                    // Запускаем событие
                    EventUpdate?.Invoke(this, new EventNetworkUpdate(data));
                }
            }
            catch (IOException)
            {
                Disconnect("разрыв соединения.");
            }
        }
コード例 #2
0
        private void ShowConfirmationCommandExecuted()
        {
            var appPath    = (string)ApplicationSettings.Read("DocumentsPath");
            var fileName   = string.Format("{0}_{1}_{2}", _event.Name, "Confirmation", DateTime.Now.ToString("g").Replace(":", "").Replace(@"/", ""));
            var reportPath = string.Concat(fileName, ".pdf");
            var exportPath = string.Concat(appPath, reportPath);

            var invoice = GetInvoice();

            // create a pdf file
            ReportingService.CreateConfirmationReport(invoice, exportPath);

            // store report in the database
            var report = new Report()
            {
                ID      = Guid.NewGuid(),
                EventID = _event.Event.ID,
                Date    = DateTime.Now,
                Name    = string.Format("Confirmation"),
                Path    = reportPath
            };

            _event.Reports.Add(new ReportModel(report));
            _eventDataUnit.ReportsRepository.Add(report);
            _event.RefreshReports();

            // update Updates table
            var update = new EventUpdate()
            {
                ID       = Guid.NewGuid(),
                EventID  = _event.Event.ID,
                Date     = DateTime.Now,
                UserID   = AccessService.Current.User.ID,
                Message  = "Event confirmation was created",
                OldValue = null,
                NewValue = report.Name,
                ItemId   = report.ID,
                ItemType = "EventReport",
                Field    = "ConfirmationReport",
                Action   = UpdateAction.Added
            };

            _event.EventUpdates.Insert(0, update);
            _eventDataUnit.EventUpdatesRepository.Add(update);

            var document = new Document()
            {
                ID        = report.ID,
                EventID   = _event.Event.ID,
                Path      = reportPath,
                Name      = Path.GetFileNameWithoutExtension(reportPath),
                IsEnabled = true,
                IsCommon  = false
            };

            _event.Documents.Add(document);
            _eventDataUnit.DocumentsRepository.Add(document);
        }
コード例 #3
0
    public void addEventUpdate(Blaster[]  targets)
    {
        var e = new EventUpdate(EventUpdate.eventChanges.color);

        e.newColor = 1;
        e.time     = currentTime;
        events.Add(e);
        updateEventUpdates();
    }
コード例 #4
0
 public virtual void Reset()
 {
     ID      = -1;
     Cur     = 0;
     Total   = 0;
     Finish  = false;
     Content = string.Empty;
     Update  = null;
 }
コード例 #5
0
 public void swapEventUpdates(int indexA, int indexB)
 {
     try {
         EventUpdate tmp = events[indexA];
         events[indexA] = events[indexB];
         events[indexB] = tmp;
     }
     catch {
         Debug.Log("no naibor");
     }
 }
コード例 #6
0
 public void removeEventUpdate(EventUpdate ev)
 {
     if (events.Contains(ev))
     {
         events.Remove(ev);
     }
     else
     {
         Debug.LogWarning("Some Thing went Wrong");
     }
 }
コード例 #7
0
 public void Dispose()
 {
     EventAwake.Dispose();
     EventFixedUpdate.Dispose();
     EventLateUpdate.Dispose();
     EventOnDestroy.Dispose();
     EventOnDisable.Dispose();
     EventOnEnable.Dispose();
     EventOnGUI.Dispose();
     EventStart.Dispose();
     EventUpdate.Dispose();
 }
コード例 #8
0
        public async Task <string> UpdateEventAsync(EventPost eventPost, int eventId)
        {
            string      newUrl   = string.Concat(BaseUrl, "events");
            EventUpdate newEvent = new EventUpdate(eventPost)
            {
                Id = eventId
            };

            string body = JsonConvert.SerializeObject(newEvent);

            HttpResponseMessage responseMessage = await this._httpProvider.PostAsync(newUrl, this._authHeaders, body);

            if (!responseMessage.IsSuccessStatusCode)
            {
                throw new Exception("Un problème est survenu lors de l'envoie de la requête UpdateEventAsync.");
            }

            string response = await responseMessage.Content.ReadAsStringAsync();

            return(response);
        }
コード例 #9
0
        public async Task <IActionResult> Update(int userId, [FromBody] EventUpdate ev)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.Name)?.Value))
            {
                return(Unauthorized());
            }

            var _event = await _evRepo.GetEvent(ev.Id);

            if (_event.User.Id != userId)
            {
                return(Unauthorized());
            }

            _mapper.Map(ev, _event);

            if (!await _evRepo.SaveChanges())
            {
                return(BadRequest(new { message = $"Something when wrong while updating Event {ev.Id}..." }));
            }

            return(Ok(ev));
        }
コード例 #10
0
        public IActionResult Update([FromBody] EventUpdate model)
        {
            bool  status    = false;
            Event tempEvent = eventService.Read(model.EventId);

            if (tempEvent != null)
            {
                tempEvent.Title            = model.Title;
                tempEvent.TitleURL         = model.TitleURL;
                tempEvent.ShortDescription = model.ShortDescription;
                tempEvent.Description      = model.FullDescription;
                tempEvent.CountryId        = (int)model.Country.Id;
                tempEvent.Location         = model.Location;
                tempEvent.EventCategoryId  = (int)model.Category.Id;
                tempEvent.EventTypeId      = (int)model.EventType.Id;
                tempEvent.From             = model.FromDate;
                tempEvent.To            = model.ToDate;
                tempEvent.DatePublished = model.DatePublished;
                tempEvent.SourceUrl     = model.Url;

                eventService.Update(tempEvent);

                if (model.NewTags != null)
                {
                    if (model.NewTags.Count() > 0)
                    {
                        foreach (SimpleItem item in model.NewTags)
                        {
                            if (item.Id == null)
                            {
                                Tag tempTag = tagService.Read(item.Name, (int)TagGroupType.Event_Search);
                                if (tempTag == null)
                                {
                                    Tag tag = new Tag();
                                    tag.Name       = item.Name;
                                    tag.TagGroupId = (int)TagGroupType.Event_Search;
                                    tagService.Create(tag);
                                    item.Id = tag.TagId;
                                }
                                else
                                {
                                    item.Id = tempTag.TagId;
                                }
                            }

                            EventTag eventTag = new EventTag();
                            eventTag.EventId = tempEvent.EventId;
                            eventTag.TagId   = (int)item.Id;
                            eventTagService.Create(eventTag);
                        }
                    }
                }

                if (model.DeletedTags != null)
                {
                    if (model.DeletedTags.Count() > 0)
                    {
                        foreach (SimpleItem item in model.DeletedTags)
                        {
                            EventTag eventTag = new EventTag();
                            eventTag.EventId = tempEvent.EventId;
                            eventTag.TagId   = (int)item.Id;
                            eventTagService.Delete(eventTag);
                        }
                    }
                }

                status = true;
            }

            if (status)
            {
                return(Ok(status));
            }
            else
            {
                return(NotFound(status));
            }
        }
コード例 #11
0
        private void ShowFunctionSheetCommandExecuted()
        {
            var appPath = (string)ApplicationSettings.Read("DocumentsPath");

            var eventWasChanged = _event.Event.LastFunctionSheetPrint <= _event.Event.LastEditDate;
            var lastReport      = _event.Reports.Where(x => x.Name == "Function Sheet").OrderByDescending(x => x.Report.Date).FirstOrDefault();

            if (!eventWasChanged && lastReport != null)
            {
                var oldExportPath = string.Concat(appPath, lastReport.Report.Path);

                if (File.Exists(oldExportPath))
                {
                    Process.Start(oldExportPath);
                    return;
                }
            }

            var fileName   = string.Format("{0}_{1}_{2}", _event.Name, "Function Sheet", DateTime.Now.ToString("g").Replace(":", "").Replace(@"/", ""));
            var reportPath = string.Concat(fileName, ".pdf");
            var exportPath = string.Concat(appPath, reportPath);

            // create a pdf file
            ReportingService.CreateFunctionSheetReport(_event, exportPath);

            // store report in the database
            var report = new Report()
            {
                ID      = Guid.NewGuid(),
                EventID = _event.Event.ID,
                Date    = DateTime.Now,
                Name    = string.Format("Function Sheet"),
                Path    = reportPath
            };

            _event.Event.LastFunctionSheetPrint = DateTime.Now;

            _event.Reports.Insert(0, new ReportModel(report));
            _eventDataUnit.ReportsRepository.Add(report);
            _event.RefreshReports();

            // update Updates table
            var update = new EventUpdate()
            {
                ID       = Guid.NewGuid(),
                EventID  = _event.Event.ID,
                Date     = DateTime.Now,
                UserID   = AccessService.Current.User.ID,
                Message  = Resources.MESSAGE_FUNCTION_SHEET_WAS_CREATED,
                OldValue = null,
                NewValue = report.Name,
                ItemId   = report.ID,
                ItemType = "EventReport",
                Field    = "FunctionSheetReport",
                Action   = UpdateAction.Added
            };

            _event.EventUpdates.Insert(0, update);
            _eventDataUnit.EventUpdatesRepository.Add(update);

            var document = new Document()
            {
                ID        = report.ID,
                EventID   = _event.Event.ID,
                Path      = reportPath,
                Name      = Path.GetFileNameWithoutExtension(reportPath),
                IsEnabled = true,
                IsCommon  = false
            };

            _event.Documents.Add(document);
            _eventDataUnit.DocumentsRepository.Add(document);
        }
コード例 #12
0
ファイル: ViewModelBase.cs プロジェクト: stealzy/DataServer
 public static void GuiElement(string s)
 {
     EventUpdate?.Invoke(s);
 }
コード例 #13
0
        private async void SubmitCommandExecuted()
        {
            IsBusy = true;

            if (!_isResend)
            {
                var type = _corresponcenceTypes.FirstOrDefault(x => x.Type == "Event");
                Correspondence.CorresponcenceType = type;
            }

            var onCompleteAction = new Action(() =>
            {
                if (Correspondence.SendMailToCcAddress)
                {
                    AddCCContacts();
                }

                foreach (var document in Correspondence.Documents)
                {
                    var correspondenceDocument = new CorrespondenceDocument()
                    {
                        ID = Guid.NewGuid(),
                        CorrespondenceID = Correspondence.Correspondence.ID,
                        DocumentID       = document.ID
                    };

                    _eventDataUnit.CorrespondenceDocumentsRepository.Add(correspondenceDocument);
                }

                // add entry into update log
                var update = new EventUpdate()
                {
                    ID       = Guid.NewGuid(),
                    EventID  = _event.Event.ID,
                    Date     = DateTime.Now,
                    Message  = string.Format("Email was sent to {0}", _correspondence.ToAddress),
                    UserID   = AccessService.Current.User.ID,
                    OldValue = null,
                    NewValue = _correspondence.ToAddress,
                    ItemId   = _correspondence.Correspondence.ID,
                    ItemType = "Correspondence",
                    Field    = "Email",
                    Action   = UpdateAction.Added
                };

                _event.EventUpdates.Insert(0, update);
                _eventDataUnit.EventUpdatesRepository.Add(update);

                _event.Correspondences.Insert(0, Correspondence);
                _eventDataUnit.CorresponcencesRepository.Add(Correspondence.Correspondence);
            });

            bool success = await EmailService.SendEmail(Correspondence, onCompleteAction, MainEmailTemplate.MailTemplate.Template);

            IsBusy = false;

            if (success)
            {
                RaisePropertyChanged("CloseDialog");
            }
        }
コード例 #14
0
        private async void SubmitEventCommandExecuted()
        {
            IsBusy   = true;
            BusyText = "Processing";

            //Set the Items Count on change of Number of Places
            SetItemsCountOnPlacesChange();

            //Check whether the Sum of Invoived and Uninvoiced Items is equal or not
            if (!IsInvoicedandUnInvoicedPriceEquals())
            {
                IsBusy = false;
                return;
            }

            //Check whether the resources are available
            await ValidateResourcesAvailability();

            if (AlreadyBookedEventItems.Count > 0)
            {
                var alreadyBookedWindow = new EventItemsAlreadyBooked(Event, AlreadyBookedCaterings, AlreadyBookedRooms, AlreadyBookedGolfs, AlreadyBookedEventItems);
                RaisePropertyChanged("DisableParentWindow");
                alreadyBookedWindow.ShowDialog();
                RaisePropertyChanged("EnableParentWindow");
                if (alreadyBookedWindow.DialogResult == null || !alreadyBookedWindow.DialogResult.Value)
                {
                    IsBusy = false;
                    return;
                }
            }
            if (_isEditMode)
            {
                var eventUpdates = LoggingService.FindDifference(_originalEvent, _event);
                ProcessUpdates(_event, eventUpdates);
                _event.Event.LastEditDate = DateTime.Now;
                // Release lock
                _event.Event.LockedUserID = null;
            }
            else
            {
                _eventsDataUnit.EventsRepository.Add(_event.Event);

                var update = new EventUpdate()
                {
                    ID       = Guid.NewGuid(),
                    EventID  = _event.Event.ID,
                    Date     = DateTime.Now,
                    UserID   = AccessService.Current.User.ID,
                    Message  = string.Format("Event {0} was created", _event.Name),
                    OldValue = null,
                    NewValue = _event.Name,
                    ItemId   = _event.Event.ID,
                    ItemType = "Event",
                    Field    = "Event",
                    Action   = UpdateAction.Added
                };
                _event.EventUpdates.Add(update);
                _eventsDataUnit.EventUpdatesRepository.Add(update);

                var eventUpdates = LoggingService.FindDifference(_originalEvent, _event, true);
                ProcessUpdates(_event, eventUpdates);
            }
            await _eventsDataUnit.SaveChanges();

            IsBusy = false;
            RaisePropertyChanged("CloseDialog");
            PopupService.ShowMessage(
                _isEditMode
                    ? Properties.Resources.MESSAGE_NEW_EVENT_UPDATED
                    : Properties.Resources.MESSAGE_NEW_EVENT_ADDED, MessageType.Successful);
        }
コード例 #15
0
 public void thucThiEventUpdate(Software ungdung, MyEventArgs e)
 {
     EventUpdate?.Invoke(ungdung, e);
 }
コード例 #16
0
ファイル: ActivElement.cs プロジェクト: Derman01/MyGame
 public void Update()
 {
     deltaTime = _time.deltaTime;
     _time.Restart();
     EventUpdate?.Invoke();
 }
コード例 #17
0
 public void Dispose()
 {
     EventAwake.Dispose();
     EventFixedUpdate.Dispose();
     EventLateUpdate.Dispose();
     EventOnAnimatorIK.Dispose();
     EventOnAnimatorMove.Dispose();
     EventOnApplicationFocus.Dispose();
     EventOnApplicationPause.Dispose();
     EventOnApplicationQuit.Dispose();
     EventOnAudioFilterRead.Dispose();
     EventOnBecameInvisible.Dispose();
     EventOnBecameVisible.Dispose();
     EventOnCollisionEnter.Dispose();
     EventOnCollisionEnter2D.Dispose();
     EventOnCollisionExit.Dispose();
     EventOnCollisionExit2D.Dispose();
     EventOnCollisionStay.Dispose();
     EventOnCollisionStay2D.Dispose();
     EventOnJointBreak.Dispose();
     EventOnJointBreak2D.Dispose();
     EventOnControllerColliderHit.Dispose();
     EventOnConnectedToServer.Dispose();
     EventOnDisconnectedFromServer.Dispose();
     EventOnMasterServerEvent.Dispose();
     EventOnFailedToConnect.Dispose();
     EventOnFailedToConnectToMasterServer.Dispose();
     EventOnDestroy.Dispose();
     EventOnDisable.Dispose();
     EventOnEnable.Dispose();
     EventOnDrawGizmos.Dispose();
     EventOnDrawGizmosSelected.Dispose();
     EventOnGUI.Dispose();
     EventOnMouseDown.Dispose();
     EventOnMouseDrag.Dispose();
     EventOnMouseEnter.Dispose();
     EventOnMouseExit.Dispose();
     EventOnMouseOver.Dispose();
     EventOnMouseUp.Dispose();
     EventOnMouseUpAsButton.Dispose();
     EventOnNetworkInstantiate.Dispose();
     EventOnParticleCollision.Dispose();
     EventOnParticleTrigger.Dispose();
     EventOnPlayerConnected.Dispose();
     EventOnPlayerDisconnected.Dispose();
     EventOnPostRender.Dispose();
     EventOnPreCull.Dispose();
     EventOnPreRender.Dispose();
     EventOnRenderImage.Dispose();
     EventOnRenderObject.Dispose();
     EventOnSerializeNetworkView.Dispose();
     EventOnServerInitialized.Dispose();
     EventOnTransformChildrenChanged.Dispose();
     EventOnTransformParentChanged.Dispose();
     EventOnTriggerEnter.Dispose();
     EventOnTriggerEnter2D.Dispose();
     EventOnTriggerExit.Dispose();
     EventOnTriggerExit2D.Dispose();
     EventOnTriggerStay.Dispose();
     EventOnTriggerStay2D.Dispose();
     EventOnWillRenderObject.Dispose();
     EventReset.Dispose();
     EventStart.Dispose();
     EventUpdate.Dispose();
 }
コード例 #18
0
        private void AddFileFromHdd(string path)
        {
            var appPath  = (string)ApplicationSettings.Read("DocumentsPath");
            var filePath = Path.GetFileName(path);
            var fullPath = string.Concat(appPath, filePath);

            try
            {
                if (File.Exists(fullPath))
                {
                    File.Delete(fullPath);
                }

                File.Copy(path, fullPath);

                var report = new ReportModel(new Report()
                {
                    ID      = Guid.NewGuid(),
                    EventID = _event.Event.ID,
                    Date    = DateTime.Now,
                    Name    = Path.GetFileNameWithoutExtension(path),
                    Path    = filePath
                });

                _event.Reports.Insert(0, report);
                _eventDataUnit.ReportsRepository.Add(report.Report);
                _event.RefreshReports();

                // update Updates table
                var update = new EventUpdate()
                {
                    ID       = Guid.NewGuid(),
                    EventID  = _event.Event.ID,
                    Date     = DateTime.Now,
                    UserID   = AccessService.Current.User.ID,
                    Message  = Resources.MESSAGE_FUNCTION_SHEET_WAS_CREATED,
                    OldValue = null,
                    NewValue = report.Name,
                    ItemId   = report.Report.ID,
                    ItemType = "EventReport",
                    Field    = "DocumentUpload",
                    Action   = UpdateAction.Added
                };

                _eventDataUnit.EventUpdatesRepository.Add(update);

                var document = new Document()
                {
                    ID        = report.Report.ID,
                    EventID   = _event.Event.ID,
                    Path      = filePath,
                    Name      = Path.GetFileNameWithoutExtension(path),
                    IsEnabled = true,
                    IsCommon  = false
                };

                _event.Documents.Add(document);
                _eventDataUnit.DocumentsRepository.Add(document);
            }
            catch (Exception ex)
            {
                PopupService.ShowMessage(ex.Message, MessageType.Failed);
            }
        }
コード例 #19
0
 /// <summary>
 /// Change the entry in the DB to use this data.
 /// </summary>
 private void ButtonUpdate_Click(object sender, EventArgs e)
 {
     EventUpdate?.Invoke();
 }
コード例 #20
0
        private async void BookCommandExecute()
        {
            bool?  dialogResult = null;
            string confirmText  = Properties.Resources.MESSAGE_ASK_BEFORE_BOOKING_ENQUIRY;

            RadWindow.Confirm(new DialogParameters()
            {
                Owner   = Application.Current.MainWindow,
                Content = confirmText,
                Closed  = (sender, args) => { dialogResult = args.DialogResult; }
            });

            if (dialogResult != true)
            {
                return;
            }

            Enquiry.EnquiryStatus = EnquiryStatuses.FirstOrDefault(x => x.Status == "Booked");
            EnquiryStatus         = Enquiry.EnquiryStatus;

            var newEvent = new Event()
            {
                ID             = Guid.NewGuid(),
                Name           = Enquiry.Name,
                Date           = (DateTime)Enquiry.Date,
                Places         = (int)Enquiry.Places,
                CreationDate   = DateTime.Now,
                ShowOnCalendar = true,
                IsDeleted      = false,
                LastEditDate   = DateTime.Now,
                EventTypeID    = Enquiry.EventType.ID,
                EnquiryID      = Enquiry.Enquiry.ID,
                EventStatusID  = _eventStatuses.FirstOrDefault(x => x.Name == "Provisional").ID
            };

            if (_enquiry.PrimaryContact != null)
            {
                newEvent.ContactID = _enquiry.PrimaryContact.Contact.ID;
            }

            _crmDataUnit.EventsRepository.Add(newEvent);

            var update = new EventUpdate()
            {
                ID       = Guid.NewGuid(),
                EventID  = newEvent.ID,
                Date     = DateTime.Now,
                UserID   = AccessService.Current.User.ID,
                Message  = string.Format("Event {0} was created", newEvent.Name),
                OldValue = null,
                NewValue = newEvent.Name,
                ItemId   = newEvent.ID,
                ItemType = "Event",
                Field    = "Event",
                Action   = UpdateAction.Added
            };

            _crmDataUnit.EventUpdatesRepository.Add(update);
            _crmDataUnit.SaveChanges();

            // Warning: Here we use EventDataUnit!

            var events = await _eventDataUnit.EventsRepository.GetLightEventsAsync(x => x.ID == newEvent.ID);

            var @event = events.FirstOrDefault();

            var item = new EventModel(@event);

            // Open Add Event window in UI thread
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                var bookingView = new BookingView(BookingViews.Event, item);
                bookingView.ShowDialog();

                if (bookingView.DialogResult != null && bookingView.DialogResult == true)
                {
                    string campaingText = Enquiry.Campaign == null ? "" : ", via Campaign " + Enquiry.Campaign.Name;

                    var note = new EventNoteModel(new EventNote()
                    {
                        ID            = Guid.NewGuid(),
                        EventID       = newEvent.ID,
                        Date          = DateTime.Now,
                        EventNoteType = _eventNoteTypes.FirstOrDefault(x => x.Type == "Internal"),
                        UserID        = AccessService.Current.User.ID,
                        Note          = String.Format("From Enquiry, made on {0}, Taken by {1} Assigned to {2} enquiry via {3} {4}. {5} Notes, {6} Updates, {7} Activities & {8} Follow-Ups.",
                                                      DateTime.Now,
                                                      Enquiry.LoggedUser.FirstName,
                                                      Enquiry.AssignedToUser.FirstName,
                                                      Enquiry.ReceivedMethod.ReceiveMethod,
                                                      campaingText,
                                                      Enquiry.EnquiryNotes.Count,
                                                      Enquiry.EnquiryUpdates.Count,
                                                      Enquiry.Activities.Count,
                                                      Enquiry.FollowUps.Count)
                    });

                    _crmDataUnit.EventNotesRepository.Add(note.EventNote);
                    _crmDataUnit.SaveChanges();
                }
            }));

            BookCommand.RaiseCanExecuteChanged();
        }