Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oMBorrower      = new Model.Borrower();
            oBorrower       = new DataAccess.Borrower();
            oCommonFunction = new CommonFunction.CommonFunction();
            oImageFunction  = new CommonFunction.CommonFunction();

            if (eVariable.IsFieldEmpty(pnlMain))
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " "));
                oFrmMsgBox.ShowDialog();
                return;
            }

            oMBorrower.PERSON_ID   = txtBorrowerID.Text;
            oMBorrower.FIRST_NAME  = txtFname.Text;
            oMBorrower.MIDDLE_NAME = txtMname.Text;
            oMBorrower.LAST_NAME   = txtLname.Text;
            oMBorrower.DOB         = dtDOB.Value.ToString("yyyy-MM-dd");
            oMBorrower.AGE         = txtAge.Text;
            oMBorrower.CONTACT_NO  = txtContactNo.Text;
            oMBorrower.ADDRESS     = txtAddress.Text;

            if (pImage.Image != null)
            {
                oMBorrower.PROFILE_PIC = oCommonFunction.CompressString(oImageFunction.ImageToBaseString(pImage.Image, ImageFormat.Png));
            }


            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.EDIT)
            {
                oMBorrower.MODIFIED_BY   = eVariable.sUsername;
                oMBorrower.MODIFIED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oBorrower.UpdateBorrower(oMBorrower);
            }
            else
            {
                oMBorrower.ADDED_BY   = eVariable.sUsername;
                oMBorrower.ADDED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oBorrower.InsertBorrower(oMBorrower);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            oFrmBorrowerLst.LoadBorrower();
            eVariable.ClearText(pnlMain);
            ResetFields();
            Close();
        }
Exemple #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 oMRecordList)
                {
                    oMTransaction                = new Model.Transaction();
                    oBook                        = new DataAccess.Book();
                    oMTransaction.PERSON_ID      = oData.PERSON_ID;
                    oMTransaction.BOOK_ID        = oData.BOOK_ID;
                    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       = eVariable.sUsername;
                    oMTransaction.TRANSACTION_NO = eVariable.sTransactionNo;


                    oBook.CheckOutBook(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();
            }
        }
Exemple #3
0
        void IsDBExists()
        {
            oDatabase = new DataAccess.BackupRestoreDB();
            if (!oDatabase.IsDatabaseExits())
            {
                oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.DATABASE_DOES_NOT_EXISTS.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();

                Maintenance.frmBackupRestoreDB oFrmDB = new Maintenance.frmBackupRestoreDB();
                oFrmDB.ShowDialog();

                return;
            }
        }
Exemple #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         oBook = new DataAccess.Book();
         if (optRequest.Checked)
         {
             oBook.DeleteUnsettledRequestTransaction(dtFrom.Value, dtTo.Value);
             oFrmMsgBox = new frmMessageBox(ePublicVariable.eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_DELETED.ToString().Replace("_", " "));
             oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
             oFrmMsgBox.ShowDialog();
         }
     }
     catch (Exception ex)
     { }
 }
Exemple #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oMAuthor = new Model.Author();
            oAuthor  = new DataAccess.Author();

            if (eVariable.IsFieldEmpty(pnlBody))
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.EDIT)
            {
                oMAuthor.PERSON_ID   = eVariable.sUniqueID;
                oMAuthor.FIRST_NAME  = txtFname.Text;
                oMAuthor.MIDDLE_NAME = txtMname.Text;
                oMAuthor.LAST_NAME   = txtLname.Text;
                oMAuthor.STATUS      = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";
                oAuthor.UpdateAuthor(oMAuthor);
            }
            else
            {
                oMAuthor.FIRST_NAME  = txtFname.Text;
                oMAuthor.MIDDLE_NAME = txtMname.Text;
                oMAuthor.LAST_NAME   = txtLname.Text;

                if (oAuthor.isRecordExists(oMAuthor))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                oMAuthor.STATUS = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";
                oAuthor.InsertAuthor(oMAuthor);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            eVariable.ClearText(pnlBody);
            eVariable.m_ActionType = eVariable.ACTION_TYPE.ADD;
            LoadAuthor();
        }
Exemple #6
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (dgDetails.Rows.Count > 0)
     {
         if (oMBorrower.PERSON_ID != string.Empty)
         {
             frmBorrowerEntry oForm = new frmBorrowerEntry(this, oMBorrower);
             oForm.ShowDialog();
         }
         else
         {
             oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_A_RECORD.ToString().Replace("_", " "));
             oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
             oFrmMsgBox.ShowDialog();
         }
     }
 }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oMCategory = new Model.Category();
            oCategory  = new DataAccess.Category();

            if (eVariable.IsFieldEmpty(pnlBody))
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.EDIT)
            {
                oMCategory.CATEGORY_ID = eVariable.sUniqueID;
                oMCategory.CATEGORY    = txtCategory.Text;
                oMCategory.STATUS      = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";
                oCategory.UpdateCategory(oMCategory);
            }
            else
            {
                oMCategory.CATEGORY = txtCategory.Text;
                oMCategory.STATUS   = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";

                if (oCategory.isRecordExists(oMCategory))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                oCategory.InsertCategory(oMCategory);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            eVariable.ClearText(pnlBody);
            eVariable.m_ActionType = eVariable.ACTION_TYPE.ADD;
            LoadCategory();
        }
Exemple #8
0
        private void dgBooks_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 9 || e.ColumnIndex == 10 && e.RowIndex >= 0)
                {
                    if (dgBooks.Rows[e.RowIndex].Cells[9].Value == null || dgBooks.Rows[e.RowIndex].Cells[9].Value.ToString() == "")
                    {
                        oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.THE_DATA_YOU_HAVE_ENTERED_IS_INVALID.ToString().Replace("_", " "));
                        oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                        dgBooks.Rows[e.RowIndex].Cells[9].Value = 1;
                        return;
                    }

                    if (dgBooks.Rows[e.RowIndex].Cells[10].Value == null || dgBooks.Rows[e.RowIndex].Cells[10].Value.ToString() == "")
                    {
                        oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.THE_DATA_YOU_HAVE_ENTERED_IS_INVALID.ToString().Replace("_", " "));
                        oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                        dgBooks.Rows[e.RowIndex].Cells[10].Value = 1;
                        return;
                    }

                    int iBookCount = 0;
                    foreach (DataGridViewRow row in dgBooks.Rows)
                    {
                        iBookCount += Convert.ToInt32(row.Cells[9].Value);
                    }
                    int i = oMTransactionNoList.Count;
                    while (i > iBookCount)
                    {
                        oMTransactionNoList.RemoveAt(i - 1);
                        i--;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #9
0
        void DatagridSelect(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgBooks.Rows.Count > 0)
                {
                    oMTransaction = new Model.Transaction();

                    #region Borrower Data
                    oMTransaction.PERSON_ID   = txtBorrowerID.Text;
                    oMTransaction.FIRST_NAME  = txtFname.Text;
                    oMTransaction.MIDDLE_NAME = txtMname.Text;
                    oMTransaction.LAST_NAME   = txtLname.Text;
                    #endregion

                    eVariable.sBookID          = dgBooks.Rows[e.RowIndex].Cells[0].Value.ToString();
                    oMTransaction.BOOK_ID      = dgBooks.Rows[e.RowIndex].Cells[0].Value.ToString();
                    oMTransaction.TITLE        = dgBooks.Rows[e.RowIndex].Cells[1].Value.ToString();
                    oMTransaction.SUBJECT      = dgBooks.Rows[e.RowIndex].Cells[2].Value.ToString();
                    oMTransaction.CATEGORY     = dgBooks.Rows[e.RowIndex].Cells[3].Value.ToString();
                    oMTransaction.AUTHOR       = dgBooks.Rows[e.RowIndex].Cells[4].Value.ToString();
                    oMTransaction.PUBLISH_DATE = dgBooks.Rows[e.RowIndex].Cells[5].Value.ToString();
                    oMTransaction.LOCATION     = dgBooks.Rows[e.RowIndex].Cells[6].Value.ToString();
                    oMTransaction.BOOK_PRICE   = dgBooks.Rows[e.RowIndex].Cells[7].Value.ToString();
                    oMTransaction.RENT_PRICE   = dgBooks.Rows[e.RowIndex].Cells[8].Value.ToString();
                    oMTransaction.TOTAL_QTY    = dgBooks.Rows[e.RowIndex].Cells[9].Value.ToString();
                    oMTransaction.TOTAL_DAYS   = dgBooks.Rows[e.RowIndex].Cells[10].Value.ToString();
                }
                else
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_A_RECORD.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #10
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();
            }
        }
Exemple #11
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            BrowseData.frmSearch oFrm = new BrowseData.frmSearch();
            oFrm.oFilterFindOption = ePublicVariable.eVariable.FIND_OPTION.BOOKS;
            oFrm.oFilterBook       = eVariable.FILTER_BOOK.BOOK_TITLE;
            oFrm.StartPosition     = FormStartPosition.CenterScreen;
            oFrm.ShowDialog();

            if (dgBooks.Rows.Count > 0)
            {
                if (dgBooks.Rows.Cast <DataGridViewRow>().Any(r => r.Cells[0].Value.Equals(oFrm.oMBook.BOOK_ID)))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
            }

            dgBooks.Rows.Add(oFrm.oMBook.BOOK_ID, oFrm.oMBook.TITLE, oFrm.oMBook.SUBJECT, oFrm.oMBook.CATEGORY, oFrm.oMBook.AUTHOR, oFrm.oMBook.PUBLISH_DATE, oFrm.oMBook.LOCATION, oFrm.oMBook.BOOK_PRICE, oFrm.oMBook.RENT_PRICE, 1, 1);

            ChangeCellGridColor();
        }
Exemple #12
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Boolean bFound = false;


            if (!chkAutoNumber.Checked)
            {
                if (txtBookNo.Text.Trim() == string.Empty)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_BOOK_NUMBER.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
            }

            if (txtISBN.Text.Trim() == string.Empty)
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_ISBN_NUMBER.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }


            oBook = new DataAccess.Book();
            eVariable.sISBN_Number = txtISBN.Text;
            if (oBook.IsBookRecordDataExists(ePublicVariable.eVariable.FIND_TYPE.ISBN_NUMBER, eVariable.sISBN_Number))
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ISBN_NUMBER_ALREADY_EXISTS.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                txtISBN.Focus();
                return;
            }

            if (!chkAutoNumber.Checked)
            {
                eVariable.sBookNumber = txtBookNo.Text;
                if (oBook.IsBookRecordDataExists(eVariable.FIND_TYPE.BOOK_NO, eVariable.sBookNumber.Trim()))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.BOOK_NUMBER_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    txtBookNo.Focus();
                    return;
                }
            }
            else
            {
                eVariable.sBookNumber = GetBookNo(oMTransactionList);
            }

            bFound = oMTransactionList.Any(fw => fw.BOOK_NO == eVariable.sBookNumber || fw.ISBN_NUMBER == eVariable.sISBN_Number);

            if (!bFound)
            {
                oMTransactionList.Add(new Model.Transaction {
                    BOOK_ID = eVariable.sBookID, TITLE = txtTitle.Text, SUBJECT = txtSubject.Text, CATEGORY = txtCategory.Text, AUTHOR = txtAuthor.Text, PUBLISH_DATE = dtDatePublish.Value.ToString("yyyy-MM-dd"), LOCATION = txtLocation.Text, BOOK_PRICE = txtBookPrice.Text, RENT_PRICE = txtRentPrice.Text, BOOK_NO = eVariable.sBookNumber, ISBN_NUMBER = eVariable.sISBN_Number, REMARKS = "", STATUS = "ACTIVE"
                });

                iGridControl.FindOption             = iControlGrid.iGridControl.FIND_OPTION.ADD_BOOK_NO;
                iGridControl.BookCommonData         = oMTransaction;
                iGridControl.BookListData           = oMTransactionList;
                iGridControl.SetDeleteColumnVisible = true;
                iGridControl.SetHeaderVisible       = false;
                iGridControl.PopulateRecord();
                iGridControl.Visible = true;


                txtBookNo.Text = string.Empty;
                txtISBN.Text   = string.Empty;
            }
            else
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
        }
Exemple #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (eVariable.IsFieldEmpty(pnlMain))
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.ADD)
            {
                foreach (var oData in oMTransactionList)
                {
                    oMTransaction = new Model.Transaction();
                    oBook         = new DataAccess.Book();

                    oMTransaction.BOOK_ID      = eVariable.sBookID;
                    oMTransaction.BOOK_NO      = oData.BOOK_NO;
                    oMTransaction.TITLE        = txtTitle.Text;
                    oMTransaction.SUBJECT      = txtSubject.Text;
                    oMTransaction.CATEGORY     = txtCategory.Text;
                    oMTransaction.AUTHOR       = txtAuthor.Text;
                    oMTransaction.PUBLISH_DATE = dtDatePublish.Value.ToString("yyyy-MM-dd");
                    oMTransaction.ISBN_NUMBER  = oData.ISBN_NUMBER;
                    oMTransaction.LOCATION     = txtLocation.Text;
                    oMTransaction.BOOK_PRICE   = txtBookPrice.Text;
                    oMTransaction.RENT_PRICE   = txtRentPrice.Text;
                    oMTransaction.ADDED_DATE   = DateTime.Now.ToString("yyyy-MM-dd");
                    oMTransaction.ADDED_BY     = eVariable.sUsername;
                    oMTransaction.STATUS       = "ACTIVE";
                    oBook.InsertBook(oMTransaction);
                }
            }
            else
            {
                oMTransaction = new Model.Transaction();
                oBook         = new DataAccess.Book();

                oMTransaction.BOOK_ID       = eVariable.sBookID;
                oMTransaction.TITLE         = txtTitle.Text;
                oMTransaction.SUBJECT       = txtSubject.Text;
                oMTransaction.CATEGORY      = txtCategory.Text;
                oMTransaction.AUTHOR        = txtAuthor.Text;
                oMTransaction.PUBLISH_DATE  = dtDatePublish.Value.ToString("yyyy-MM-dd");
                oMTransaction.LOCATION      = txtLocation.Text;
                oMTransaction.BOOK_PRICE    = txtBookPrice.Text;
                oMTransaction.RENT_PRICE    = txtRentPrice.Text;
                oMTransaction.MODIFIED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oMTransaction.MODIFIED_BY   = eVariable.sUsername;
                oMTransaction.STATUS        = "ACTIVE";
                oBook.UpdateBookDetails(oMTransaction);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            oFrmBookList.LoadRecords();
            EDControls(true);
            Close();
            ResetFields();
        }
Exemple #14
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            Boolean bSelected = false;

            foreach (var oData in oMRecordList)
            {
                if (Convert.ToBoolean(oData.BFLAG) == true)
                {
                    bSelected = true;
                }
            }

            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 (bSelected == false)
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_A_RECORD.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            oMTransactionList = new List <Model.Transaction>();
            foreach (var oData in oMRecordList)
            {
                oMTransaction              = new Model.Transaction();
                oMTransaction.BOOK_ID      = oData.BOOK_ID;
                oMTransaction.TITLE        = oData.TITLE;
                oMTransaction.SUBJECT      = oData.SUBJECT;
                oMTransaction.CATEGORY     = oData.CATEGORY;
                oMTransaction.AUTHOR       = oData.AUTHOR;
                oMTransaction.PUBLISH_DATE = oData.PUBLISH_DATE;
                oMTransaction.LOCATION     = oData.LOCATION;
                oMTransaction.BOOK_PRICE   = oData.BOOK_PRICE;
                oMTransaction.RENT_PRICE   = oData.RENT_PRICE;
                oMTransaction.DUE_INTEREST = Convert.ToDouble(oData.DUE_INTEREST);
                oMTransaction.LD_INTEREST  = Convert.ToDouble(oData.LD_INTEREST);
                oMTransaction.TOTAL_QTY    = oData.TOTAL_QTY;
                oMTransaction.TOTAL_DAYS   = oData.TOTAL_DAYS;
                oMTransaction.ADDED_DATE   = oData.ADDED_DATE;
                oMTransaction.BOOK_NO      = oData.BOOK_NO;
                oMTransaction.ISBN_NUMBER  = oData.ISBN_NUMBER;
                oMTransaction.BFLAG        = oData.BFLAG;



                #region Borrower
                oMTransaction.PERSON_ID   = oData.PERSON_ID;
                oMTransaction.FIRST_NAME  = oData.FIRST_NAME;
                oMTransaction.MIDDLE_NAME = oData.MIDDLE_NAME;
                oMTransaction.LAST_NAME   = oData.LAST_NAME;
                #endregion



                oMTransactionList.Add(oMTransaction);
            }

            this.Dispose();
            Forms.frmProcessReturnBook oFrm = new frmProcessReturnBook(oMTransactionList);
            oFrm.ShowDialog();
        }
Exemple #15
0
        private void dgBooks_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgBooks.Rows.Count > 0)
                {
                    if (e.ColumnIndex == 9 || e.ColumnIndex == 10 && e.RowIndex >= 0)
                    {
                        if (oTranType != eVariable.FIND_BOOK.BOOK_REQUESTED)
                        {
                            dgBooks.ReadOnly = false;
                            DataGridViewCell cell = dgBooks.Rows[e.RowIndex].Cells[e.ColumnIndex];
                            dgBooks.CurrentCell = cell;
                            dgBooks.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
                            dgBooks.BeginEdit(true);
                        }
                        return;
                    }

                    ChangeCellGridColor();
                    DatagridSelect(sender, e);

                    if (e.ColumnIndex == 11 && e.RowIndex >= 0)
                    {
                        if (oTranType == eVariable.FIND_BOOK.BOOK_REQUESTED)
                        {
                            iGridControl.BookCommonData   = oMTransaction;
                            iGridControl.BookListData     = oMTransactionNoList;
                            iGridControl.FindOption       = iControlGrid.iGridControl.FIND_OPTION.SEARCH_LOCAL_BORROWED_BOOK_ISBN;
                            iGridControl.SetHeaderVisible = true;
                            iGridControl.Visible          = true;
                            iGridControl.PopulateRecord();
                        }
                        else
                        {
                            iGridControl.BookCommonData         = oMTransaction;
                            iGridControl.BookListData           = oMTransactionNoList;
                            iGridControl.FindOption             = iControlGrid.iGridControl.FIND_OPTION.INPUT_BOOK_NO;
                            iGridControl.SetDeleteColumnVisible = true;
                            iGridControl.SetFooterVisible       = true;
                            iGridControl.SetHeaderVisible       = true;
                            iGridControl.Visible = true;
                            iGridControl.PopulateRecord();
                        }
                    }


                    if (e.ColumnIndex == 12 && e.RowIndex >= 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")
                        {
                            if (oMTransactionNoList.Count > 0)
                            {
                                oMTransactionNoList.RemoveAt(e.RowIndex);
                            }

                            dgBooks.Rows.RemoveAt(e.RowIndex);
                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            { }
        }
Exemple #16
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            int iDaysCount = 0;
            int iBookCount = 0;

            if (txtBorrowerID.Text.Trim() == string.Empty || dgBooks.Rows.Count == 0)
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            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;
            }

            foreach (DataGridViewRow row in dgBooks.Rows)
            {
                if (Convert.ToInt32(row.Cells[9].Value) == 0)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_NUMBER_OF_BOOK.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                if (Convert.ToInt32(row.Cells[10].Value) == 0)
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_NUMBER_OF_DAYS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
            }

            foreach (DataGridViewRow row in dgBooks.Rows)
            {
                iBookCount += Convert.ToInt32(row.Cells[9].Value);
            }

            if (oMTransactionNoList.Count != iBookCount || oMTransactionNoList.Count == 0)
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.PLEASE_ENTER_BOOK_NUMBER.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            foreach (var oData in oMTransactionNoList)
            {
                iDaysCount = Convert.ToInt32(oData.TOTAL_DAYS);


                if (iBookCount > Convert.ToInt32(eVariable.iBookLimit))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TOTAL_BOOK_COUNT_ALREADY_EXCEED_LIMIT.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
                //change field
                if (iDaysCount > Convert.ToInt32(eVariable.iDaysLimit))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.TOTAL_DAY_COUNT_ALREADY_EXCEED_LIMIT.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
            }

            oMTransactionList = new List <Model.Transaction>();
            foreach (Model.Transaction oData in oMTransactionNoList)
            {
                oMTransaction = new Model.Transaction();

                oMTransaction.PERSON_ID   = txtBorrowerID.Text;
                oMTransaction.FIRST_NAME  = txtFname.Text;
                oMTransaction.MIDDLE_NAME = txtMname.Text;
                oMTransaction.LAST_NAME   = txtLname.Text;


                oMTransaction.BOOK_ID      = oData.BOOK_ID;
                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.ADDED_DATE   = DateTime.Now.ToString("yyyy-MM-dd");
                oMTransaction.LD_INTEREST  = oData.LD_INTEREST;
                oMTransaction.DUE_INTEREST = oData.DUE_INTEREST;
                oMTransaction.BOOK_PRICE   = oData.BOOK_PRICE;
                oMTransaction.RENT_PRICE   = oData.RENT_PRICE;
                oMTransaction.TOTAL_QTY    = oData.TOTAL_QTY;
                oMTransaction.TOTAL_DAYS   = oData.TOTAL_DAYS;

                oMTransactionList.Add(oMTransaction);
            }


            Forms.frmCheckOutBook oFrm = new frmCheckOutBook(this, oMTransactionList);
            oFrm.ShowDialog();
            Close();
        }
Exemple #17
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            oUser           = new DataAccess.User();
            oCommonFunction = new CommonFunction.CommonFunction();

            if (oCommonFunction.Decrypt(oDefUser.USERNAME.Trim()) == txtUsername.Text && oCommonFunction.Decrypt(oDefUser.PASSWORD.Trim()) == txtPassword.Text) //Default Login
            {
                this.ShowInTaskbar = false;
                this.Hide();
                oMainForm = new MAIN(txtUsername.Text, txtPassword.Text, oCommonFunction.Decrypt(oDefUser.FULLNAME), oCommonFunction.Decrypt(oDefUser.ROLE));
                oMainForm.ShowDialog();
                return;
            }

            else
            {
                #region CheckDatabase

                oDatabase = new DataAccess.BackupRestoreDB();

                if (!oDatabase.IsDatabaseExits())
                {
                    oFrmMsgBox = new frmMessageBox(ePublicVariable.eVariable.TransactionMessage.THE_DATABASE_DOES_NOT_EXITS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();

                    Maintenance.frmBackupRestoreDB oFrm = new Maintenance.frmBackupRestoreDB();
                    oFrm.ShowDialog();
                }

                #endregion


                #region DBLogin

                if (oUser.IsLogin(txtUsername.Text.Trim(), txtPassword.Text.Trim()))
                {
                    foreach (DataRow row in oUser.GetUser("username", txtUsername.Text).Rows)
                    {
                        oMUser            = new Model.User();
                        oMUser.USERNAME   = row[0].ToString();
                        oMUser.FULLNAME   = row[1].ToString();
                        oMUser.PASSWORD   = row[2].ToString();
                        oMUser.ROLE       = row[3].ToString();
                        oMUser.CONTACT_NO = row[4].ToString();
                        oMUser.ADDRESS    = row[5].ToString();
                    }

                    this.ShowInTaskbar = false;
                    this.Hide();
                    oMainForm = new MAIN(oMUser);
                    oMainForm.ShowDialog();
                    return;
                }
                else
                {
                    lblNotification.Text = "THE USERNAME AND PASSWORD YOU HAVE ENTERED ARE INCORRECT";
                    txtUsername.Focus();
                }
                #endregion
            }
        }
Exemple #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (oMTransactionList.Count <= 0)
            {
                return;
            }

            #region ADD
            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.ADD)
            {
                foreach (var oItem in oMTransactionList)
                {
                    oMTransaction              = new Model.Transaction();
                    oBook                      = new DataAccess.Book();
                    oMTransaction.BOOK_ID      = oItem.BOOK_ID;
                    oMTransaction.BOOK_NO      = oItem.BOOK_NO;
                    oMTransaction.TITLE        = oItem.TITLE;
                    oMTransaction.SUBJECT      = oItem.SUBJECT;
                    oMTransaction.CATEGORY     = oItem.CATEGORY;
                    oMTransaction.AUTHOR       = oItem.AUTHOR;
                    oMTransaction.ISBN_NUMBER  = oItem.ISBN_NUMBER;
                    oMTransaction.PUBLISH_DATE = oItem.PUBLISH_DATE;
                    oMTransaction.LOCATION     = oItem.LOCATION;
                    oMTransaction.BOOK_PRICE   = oItem.BOOK_PRICE;
                    oMTransaction.RENT_PRICE   = oItem.RENT_PRICE;
                    oMTransaction.REMARKS      = txtRemarks.Text;
                    oMTransaction.STATUS       = "ACTIVE";
                    oMTransaction.ADDED_DATE   = DateTime.Now.ToString("yyyy-MM-dd");
                    oMTransaction.ADDED_BY     = eVariable.sUsername;
                    oBook.InsertBook(oMTransaction);
                }
            }
            #endregion

            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.EDIT)
            {
                oMTransaction = new Model.Transaction();
                oBook         = new DataAccess.Book();

                oMTransaction.TITLE        = txtTitle.Text;
                oMTransaction.SUBJECT      = txtSubject.Text;
                oMTransaction.CATEGORY     = txtCategory.Text;
                oMTransaction.AUTHOR       = txtAuthor.Text;
                oMTransaction.PUBLISH_DATE = txtDatePublish.Text;
                oMTransaction.LOCATION     = txtLocation.Text;
                oMTransaction.BOOK_PRICE   = txtPrice.Text;
                oMTransaction.RENT_PRICE   = txtLDPrice.Text;

                oMTransaction.BOOK_ID     = oMTransactionRecord.BOOK_ID;
                oMTransaction.BOOK_NO     = oMTransactionRecord.BOOK_NO;
                oMTransaction.ISBN_NUMBER = oMTransactionRecord.ISBN_NUMBER;
                oMTransaction.REMARKS     = txtRemarks.Text;
                oMTransaction.STATUS      = cboStatus.Text;

                if (oMTransaction.STATUS == "INACTIVE")
                {
                    if (oBook.IsBookCheckout(oMTransaction))
                    {
                        oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.THE_RECORD_YOU_HAVE_SELECTED_HAVE_ACTIVE_TRANSACTION.ToString().Replace("_", " "));
                        oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                        return;
                    }
                }

                oMTransaction.ADDED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oMTransaction.ADDED_BY   = eVariable.sUsername;
                oBook.UpdateBook(oMTransaction);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            oFrmBookLst.LoadRecords();
            LoadRecord();
            clearText();
        }