Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (oMTransactionList.Count > 0)
            {
                if (iGridControl.Visible)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_CLOSE_THE_ISBN_PANEL.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                if (dTotalAmount > iPaymentWindow.ReceiveAmount)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_EXACT_PAYMENT_AMOUNT.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                if (oMTransactionList.Where(fw => fw.BFLAG == true).Count() == 0)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_A_RECORD.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                foreach (var oItem in oMTransactionList)
                {
                    oBook                       = new DataAccess.Book();
                    oMTransaction               = new Model.Transaction();
                    oMTransaction.PERSON_ID     = txtBorrowerID.Text;
                    oMTransaction.BOOK_ID       = oItem.BOOK_ID;
                    oMTransaction.BOOK_NO       = oItem.BOOK_NO;
                    oMTransaction.TOTAL_AMOUNT  = dTotalAmount;
                    oMTransaction.MODIFIED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                    oMTransaction.MODIFIED_BY   = eVariable.sUsername;
                    oMTransaction.REMARKS       = rdDamage.Checked == true ? "DAMAGE" : "LOST";
                    if (oItem.BFLAG)
                    {
                        oMTransaction.STATUS = "INACTIVE";
                        oBook.ReturnBook(oMTransaction);
                    }
                }

                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TRANSACTION_HAS_BEEN_SUCESSFULLY_SAVE.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                iPaymentWindow.clearText();
                eVariable.ClearText(pnlMain);
                dgBooks.Rows.Clear();
            }
            else
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_A_RECORD.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dgBooks.Rows.Count > 0)
            {
                if (iTotalAmount > iPaymentWindow.ReceiveAmount)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_EXACT_PAYMENT_AMOUNT.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                foreach (Model.Transaction oData in oMTransactionList)
                {
                    oMTransaction = new Model.Transaction();
                    oBook         = new DataAccess.Book();

                    if (oData.BFLAG == true)
                    {
                        oMTransaction.PERSON_ID     = oData.PERSON_ID;
                        oMTransaction.BOOK_ID       = oData.BOOK_ID;
                        oMTransaction.BOOK_NO       = oData.BOOK_NO;
                        oMTransaction.MODIFIED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                        oMTransaction.MODIFIED_BY   = eVariable.sUsername;
                        oMTransaction.TOTAL_AMOUNT  = iTotalAmount;
                        oMTransaction.STATUS        = "RETURNED";
                        oBook.ReturnBook(oMTransaction);
                    }
                }

                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TRANSACTION_HAS_BEEN_SUCESSFULLY_SAVE.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                iPaymentWindow.clearText();
                eVariable.ClearText(pnlMain);
                dgBooks.Rows.Clear();
            }
        }