public async static Task Update(m.Transaction obj) { using (var db = DbAccess.ConnectionFactory()) { await db.ExecuteAsync(DbAccess.Update <m.Transaction>(), obj); } }
void DatagridSelect(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { if (dgDetails.Rows.Count > 0) { oMTransaction = new Model.Transaction(); oMTransaction.BOOK_ID = dgDetails.Rows[e.RowIndex].Cells[0].Value.ToString(); oMTransaction.TITLE = dgDetails.Rows[e.RowIndex].Cells[1].Value.ToString(); oMTransaction.SUBJECT = dgDetails.Rows[e.RowIndex].Cells[2].Value.ToString(); oMTransaction.CATEGORY = dgDetails.Rows[e.RowIndex].Cells[3].Value.ToString(); oMTransaction.AUTHOR = dgDetails.Rows[e.RowIndex].Cells[4].Value.ToString(); oMTransaction.PUBLISH_DATE = dgDetails.Rows[e.RowIndex].Cells[5].Value.ToString(); oMTransaction.BOOK_PRICE = dgDetails.Rows[e.RowIndex].Cells[6].Value.ToString(); oMTransaction.RENT_PRICE = dgDetails.Rows[e.RowIndex].Cells[7].Value.ToString(); oMTransaction.LOCATION = dgDetails.Rows[e.RowIndex].Cells[8].Value.ToString(); } } } catch (Exception ex) { } }
void DatagridSelectedData(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { if (dgBorrowedBooks.Rows.Count > 0) { oMTransaction = new Transaction(); #region Borrower Data oMTransaction.PERSON_ID = txtBorrowerID.Text; #endregion eVariable.sBookID = dgBorrowedBooks.Rows[e.RowIndex].Cells[0].Value.ToString(); oMTransaction.BOOK_ID = dgBorrowedBooks.Rows[e.RowIndex].Cells[0].Value.ToString(); oMTransaction.TITLE = dgBorrowedBooks.Rows[e.RowIndex].Cells[1].Value.ToString(); oMTransaction.SUBJECT = dgBorrowedBooks.Rows[e.RowIndex].Cells[2].Value.ToString(); oMTransaction.CATEGORY = dgBorrowedBooks.Rows[e.RowIndex].Cells[3].Value.ToString(); oMTransaction.AUTHOR = dgBorrowedBooks.Rows[e.RowIndex].Cells[4].Value.ToString(); oMTransaction.PUBLISH_DATE = dgBorrowedBooks.Rows[e.RowIndex].Cells[5].Value.ToString(); oMTransaction.BOOK_PRICE = dgBorrowedBooks.Rows[e.RowIndex].Cells[6].Value.ToString(); oMTransaction.RENT_PRICE = dgBorrowedBooks.Rows[e.RowIndex].Cells[7].Value.ToString(); oMTransaction.LOCATION = dgBorrowedBooks.Rows[e.RowIndex].Cells[8].Value.ToString(); oMTransaction.TOTAL_QTY = dgBorrowedBooks.Rows[e.RowIndex].Cells[9].Value.ToString(); oMTransaction.TOTAL_DAYS = dgBorrowedBooks.Rows[e.RowIndex].Cells[10].Value.ToString(); } } } catch (Exception ex) { } }
private void clearText() { iTotalAmount = 0; lblTotalPayment.Text = "P 0.00"; dgBorrowedBooks.Rows.Clear(); oMTransaction = new Transaction(); oMTransactionList = new List <Transaction>(); btnCheck.Enabled = true; txtBorrowerID.Enabled = true; txtBorrowerID.Text = ""; lblMemberStatus.Text = ""; }
public async static Task <m.Transaction> Get(Guid id) { using (var db = DbAccess.ConnectionFactory()) { m.Transaction transaction = await db.QueryFirstOrDefaultAsync <m.Transaction>(DbAccess.Select <m.Transaction>(), new { TransactionId = id }); transaction.Category = await Category.Get(transaction.CategoryId); transaction.Account = await Account.Get(transaction.AccountId); return(transaction); } }
private void btnSubmit_Click(object sender, EventArgs e) { int iDaysCount = 0; int iBookCount = 0; try { if (dgBorrowedBooks.Rows.Count == 0) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_A_RECORD.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } foreach (DataGridViewRow row in dgBorrowedBooks.Rows) { iBookCount += Convert.ToInt32(row.Cells[9].Value); } if (oMTransactionList.Count != iBookCount || oMTransactionList.Count == 0) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_BOOK_NUMBER.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } if (iGridControl.Visible == true) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_CLOSE_THE_ISBN_PANEL.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } foreach (var oData in oMTransactionList) { iDaysCount = Convert.ToInt32(oData.TOTAL_DAYS); if (iBookCount > Convert.ToInt32(lblMaxBook.Text)) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TOTAL_BOOK_COUNT_ALREADY_EXCEED_LIMIT.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } if (iDaysCount > Convert.ToInt32(lblMaxDays.Text)) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TOTAL_DAY_COUNT_ALREADY_EXCEED_LIMIT.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } } oBorrower = new DataAccess.Borrower(); if (dgBorrowedBooks.Rows.Count > 0) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ARE_YOU_SURE_YOU_WANT_TO_PROCEED_TO_THE_TRANSACTION.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.QUERY; oFrmMsgBox.ShowDialog(); if (oFrmMsgBox.sAnswer == "YES") { foreach (Model.Transaction oData in oMTransactionList) { oMTransaction = new Model.Transaction(); oBook = new DataAccess.Book(); oMTransaction.BOOK_ID = oData.BOOK_ID; oMTransaction.PERSON_ID = txtBorrowerID.Text; oMTransaction.BOOK_NO = oData.BOOK_NO; oMTransaction.TITLE = oData.TITLE; oMTransaction.SUBJECT = oData.SUBJECT; oMTransaction.CATEGORY = oData.CATEGORY; oMTransaction.AUTHOR = oData.AUTHOR; oMTransaction.PUBLISH_DATE = oData.PUBLISH_DATE; oMTransaction.ISBN_NUMBER = oData.ISBN_NUMBER; oMTransaction.LOCATION = oData.LOCATION; oMTransaction.BOOK_PRICE = oData.BOOK_PRICE; oMTransaction.RENT_PRICE = oData.RENT_PRICE; oMTransaction.DUE_INTEREST = oData.DUE_INTEREST; oMTransaction.LD_INTEREST = oData.LD_INTEREST; oMTransaction.TOTAL_QTY = oData.TOTAL_QTY; oMTransaction.TOTAL_DAYS = oData.TOTAL_DAYS; oMTransaction.ADDED_DATE = DateTime.Now.ToString("yyyy-MM-dd"); oMTransaction.ADDED_BY = txtBorrowerID.Text; oMTransaction.STATUS = "REQUEST"; oBook.RequestBook(oMTransaction); } oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TRANSACTION_HAS_BEEN_SUCESSFULLY_SAVE.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.QUERY; oFrmMsgBox.ShowDialog(); LoadRecords(); clearText(); } } } catch (Exception ex) { } }