private void dgvBookList_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { bookid = Convert.ToInt64(dgvBookList.Rows[e.RowIndex].Cells[0].Value); BookDto book = new BookDto(); book = BookDao.GetByID(bookid); FromObjectToFrom(book); } }
private void btnrate_Click(object sender, EventArgs e) { BookDto bd = new BookDto(); bd = BookDao.GetByID(Convert.ToInt64(cmbBook.SelectedValue)); if (UserMasterDao.UpdateRatingByOne(bd.CreatedBy)) { btnrate.Visible = false; } }
private void btnSave_Click(object sender, EventArgs e) { if (txtAuthorName.Text.Trim() == string.Empty) { MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (txtBookName.Text.Trim() == string.Empty) { MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (txtReleseYear.Text.Trim() == string.Empty) { MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { int ry; if (!int.TryParse(txtReleseYear.Text.Trim(), out ry)) { MessageBox.Show(Constant.NOTIFICATION_MSG_INT, Constant.NOTIFICATION_DATA_MUST_BE_INTEGER, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } if (rtxtDescription.Text.Trim() == string.Empty) { MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } BookDto _book = new BookDto(); _book = BookDao.GetByID(bookid); BookDto book = new BookDto(); book.BookName = txtBookName.Text.ToString(); book.AuthorName = txtAuthorName.Text; book.ReleseYear = Convert.ToInt16(txtReleseYear.Text.ToString()); book.Remarks = rtxtDescription.Text; if (bookid > 0) { book.BookID = bookid; book.CreatedDate = _book.CreatedDate; book.CreatedBy = _book.CreatedBy; book.ModifyedBy = MDIParent._UserMasterID; book.ModifyDate = DateTime.Now; //Update if (BookDao.Update(book)) { MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Initiate(); } else { MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { book.CreatedBy = MDIParent._UserMasterID; book.CreatedDate = DateTime.Now; book.ModifyedBy = MDIParent._UserMasterID; book.ModifyDate = DateTime.Now; //Insert if (BookDao.Insert(book)) { MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Initiate(); } else { MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }