Exemplo n.º 1
0
 public void btnNew_Click(object sender, EventArgs e)
 {
     try
     {
         mSetPublisher = new SetPublisher();
         mSetPublisher.ShowDialog();
         if (mSetPublisher.DialogResult == DialogResult.Cancel)
         {
             loadGrid();
         }
         ContentMenuUtil contentMenu = new ContentMenuUtil(new LstMenu());
         contentMenu.createContentMenu(ref pan, "go");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 2
0
        public Task Handle(object command)
        {
            return(command switch
            {
                Create cmd => HandleCreate(cmd),
                Update cmd => HandleFullUpdate(cmd),
                SetTitle cmd => HandleUpdate(cmd.Id, (a) => a.SetTitle(cmd.Title),
                                             (a) => Repository.Update(a)),
                SetReleaseYear cmd => HandleUpdate(cmd.Id, (a) => a.SetReleaseYear(cmd.ReleaseYear),
                                                   (a) => Repository.Update(a)),
                SetPageCount cmd => HandleUpdate(cmd.Id, (a) => a.SetPageCount(cmd.PageCount),
                                                 (a) => Repository.Update(a)),
                SetWordCount cmd => HandleUpdate(cmd.Id, (a) => a.SetWordCount(cmd.WordCount),
                                                 (a) => Repository.Update(a)),
                SetIsbn cmd => HandleUpdate(cmd.Id, (a) => a.SetIsbn(cmd.Isbn),
                                            (a) => Repository.Update(a)),
                SetBookCoverPath cmd => HandleUpdate(cmd.Id, (a) => a.SetBookCoverPath(cmd.BookCoverPath),
                                                     (a) => Repository.Update(a)),
                SetDescription cmd => HandleUpdate(cmd.Id, (a) => a.SetDescription(cmd.Description),
                                                   (a) => Repository.Update(a)),
                SetNotes cmd => HandleUpdate(cmd.Id, (a) => a.SetNotesOld(cmd.Notes),
                                             (a) => Repository.Update(a)),
                SetIsRead cmd => HandleUpdate(cmd.Id, (a) => a.SetIsRead(cmd.IsRead),
                                              (a) => Repository.Update(a)),

                SetLanguage cmd => HandleUpdateAsync(cmd.Id,
                                                     async a => await UpdateLanguageAsync(a, cmd.Language.Id)),
                SetPublisher cmd => HandleUpdateAsync(cmd.Id,
                                                      async a => await UpdatePublisherAsync(a, cmd.Publisher.Id)),

                SetAuthors cmd => HandleUpdateAsync(cmd.Id,
                                                    async a => await UpdateBookAuthorsAsync(a, cmd.Authors)),
                SetFormats cmd => HandleUpdateAsync(cmd.Id,
                                                    async a => await UpdateBookFormatsAsync(a, cmd.Formats)),
                SetGenres cmd => HandleUpdateAsync(cmd.Id,
                                                   async a => await UpdateBookGenresAsync(a, cmd.Genres)),
                SetBookReadDates cmd => HandleUpdateAsync(cmd.Id,
                                                          async a => await UpdateBookReadDatesAsync(a, cmd.BookReadDates)),
                Delete cmd => HandleDeleteAsync(cmd),
                _ => Task.CompletedTask
            });
Exemplo n.º 3
0
 public void btnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvPublisher.Rows.Count > 0)
         {
             if (dgvPublisher.CurrentRow.Cells[0].Value != null)
             {
                 SetPublisher mSetPublisher = new SetPublisher((long)dgvPublisher.CurrentRow.Cells[0].Value);
                 mSetPublisher.ShowDialog();
                 if (mSetPublisher.DialogResult == DialogResult.Cancel)
                 {
                     loadGrid();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }