private void Edit(BookmakerDisplayModel bookmakerDisplayModel)
        {
            BookmakerEditModel bookmakerEditModel = Mapper.Map <BookmakerDisplayModel, BookmakerEditModel>(bookmakerDisplayModel);

            BookmakerInfoViewModel viewModel = new BookmakerInfoViewModel(bookmakerEditModel);
            BookmakerInfoControl   control   = new BookmakerInfoControl(viewModel);
            Window window = WindowFactory.CreateByContentsSize(control);

            viewModel.BookmakerEdited += (s, e) =>
            {
                bookmakerEditModel = e.Bookmaker;
                BookmakerEditDTO bookmakerEditDTO = Mapper.Map <BookmakerEditModel, BookmakerEditDTO>(bookmakerEditModel);

                using (IBookmakerService service = factory.CreateBookmakerService())
                {
                    ServiceMessage serviceMessage = service.Update(bookmakerEditDTO, bookmakerDisplayModel.Login);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        window.Close();
                        Notify();
                    }
                }
            };

            window.Show();
        }
Esempio n. 2
0
        private bool FilterBookmaker(object obj)
        {
            BookmakerDisplayModel bookmaker = obj as BookmakerDisplayModel;

            return
                (bookmaker.FirstName.Contains(FirstNameFilter ?? String.Empty) &&
                 bookmaker.LastName.Contains(LastNameFilter ?? String.Empty) &&
                 bookmaker.PhoneNumber.Contains(PhoneNumberFilter ?? String.Empty));
        }
        private void RaiseBookmakerDeleteRequestEvent(BookmakerDisplayModel bookmaker)
        {
            var handler = BookmakerDeleteRequest;

            if (handler != null)
            {
                BookmakerDisplayEventArgs e = new BookmakerDisplayEventArgs(bookmaker);
                handler(this, e);
            }
        }
 public BookmakerDisplayEventArgs(BookmakerDisplayModel bookmaker)
 {
     this.Bookmaker = bookmaker;
 }