private void Reset() { this.Close(); frmMemDetails f = new frmMemDetails(); f.Show(); }
private void lboxBlack_DoubleClick(object sender, EventArgs e) { if (lboxBlack.SelectedItems.Count == 1) { frmMemDetails f = new frmMemDetails(); f.txtMemID.Text = lboxBlack.SelectedItem.ToString(); f.ShowDialog(); } }
private void updateMembershipToolStripMenuItem_Click(object sender, EventArgs e) { frmMemDetails f = new frmMemDetails(); f.MdiParent = this; f.btnUpdate.Size = f.lblButtons.Size; f.btnUpdate.Location = f.lblButtons.Location; f.btnRemove.Visible = f.btnRenew.Visible = false; f.Text = "Update Membership"; f.Show(); }
private void dtResults_CellClick(object sender, DataGridViewCellEventArgs e) { if (dtResults.SelectedCells.Count != 0) { int NowCol = dtResults.SelectedCells[0].ColumnIndex; string NowValue = dtResults.Rows[dtResults.CurrentCell.RowIndex].Cells[3].Value.ToString(); frmMemDetails f = new frmMemDetails(); if (NowCol == 3 || NowCol == 4) { f.txtMemID.Text = NowValue; f.ShowDialog(); } } }
private void dtResults_CellClick(object sender, DataGridViewCellEventArgs e) { if (dtResults.SelectedCells.Count != 0) { string NowValue = dtResults.CurrentCell.Value.ToString(); int NowCol = dtResults.SelectedCells[0].ColumnIndex; string NowBook = dtResults.Rows[dtResults.CurrentCell.RowIndex].Cells[7].Value.ToString(); frmBookDetail b = new frmBookDetail(); frmMemDetails m = new frmMemDetails(); if (NowCol == 4) { m.txtMemID.Text = NowValue; m.ShowDialog(); } else if (NowCol == 6) { b.txtTitleID.Text = NowValue; b.btnGetTitle_Click(sender, e); b.ShowDialog(); } else if (NowCol == 7 || NowCol == 2) { b.txtBookID.Text = NowBook; b.btnGetBook_Click(sender, e); b.ShowDialog(); } } }
private void memberDetailsToolStripMenuItem_Click(object sender, EventArgs e) { frmMemDetails f = new frmMemDetails(); f.MdiParent = this; f.Show(); }
private void lblLentTo_Click(object sender, EventArgs e) { frmMemDetails m = new frmMemDetails(); m.txtMemID.Text = lblLentTo.Text; m.Show(); }
private void btnLoss_Click(object sender, EventArgs e) { DialogResult sure = MessageBox.Show("Are you sure you want to mark this book as lost?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (sure == DialogResult.No) { goto End; } //Get TitleID from Book table string sqlBook = string.Format("SELECT TitleID FROM Book WHERE BookID = '{0}'", BookID); OleDbCommand cmdBook = new OleDbCommand(sqlBook, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } OleDbDataReader drBook = cmdBook.ExecuteReader(); drBook.Read(); string TitleID = drBook["TitleID"].ToString(); //Select Price from Title Table with BookID string sqlTitle = string.Format("SELECT Price FROM Title WHERE TitleID = '{0}'", TitleID); OleDbCommand cmdTitle = new OleDbCommand(sqlTitle, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } OleDbDataReader drTitle = cmdTitle.ExecuteReader(); drTitle.Read(); Price = double.Parse(drTitle["Price"].ToString()); //Call method to find fines for this book & member Tyoe bool isBFine, IsBlocked; double Fine; int Days; DateTime iDate; int MTi; Methods m = new Methods(); m.FindBookFine(BookID, out isBFine, out Fine, out Days, out iDate, out MemID, out IsBlocked, out MTi); //Remove member from Blacklist by shaowing member details if (IsBlocked) { DialogResult black = MessageBox.Show("This Member was blocked due to possible book theft or other security reasons. Since the member pays for the lost book, do you want to check details to remove the member from blacklist?", "Remove from Blacklist?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (black == DialogResult.Yes) { frmMemDetails n = new frmMemDetails(); n.txtMemID.Text = MemID; n.ShowDialog(); } } //Calculate Amount: Amount = (Price x Defined Times) + Present fine. AmountOnly = (Price * set.LostBookTimes[MTi]); Amount = AmountOnly + Fine; // If there's fine, receive the fine also. string FineText = ""; if (isBFine) { FineText = string.Format(" and fines of Rs. {0}/- ", Fine); } //Show messagebox and verify transaction DialogResult isok = MessageBox.Show(string.Format("This Book costs Rs. {0}/-.\r\n\r\nWith {1} times the price of the book{2}, amount to be paid in total is Rs. {3}/-. \r\n\r\nReceive the amount and press OK.", Price, set.LostBookTimes[MTi], FineText, Amount), string.Format("Rs. {0}/- must be paid Now", Amount), MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (isok == DialogResult.Cancel) { goto End; } //If Okay, continue. if (isBFine) { //Add details of Pay Fine and Pay for book to Cash table string sqlPayFine = string.Format("INSERT INTO Cash (Event, TDetail, TDate, Amount) VALUES ('FinePaid', '{0}', '{1}', {2})", string.Format("BookID = {0} | MemberID = {1}", BookID, MemID), DateTime.Now.ToString(), Fine); OleDbCommand cmdPayFine = new OleDbCommand(sqlPayFine, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } cmdPayFine.ExecuteNonQuery(); } string sqlRemCash = string.Format("INSERT INTO Cash (Event, TDetail, TDate, Amount) VALUES ('LostPaid', '{0}', '{1}', {2})", string.Format("MemberID = {0}", MemID), DateTime.Now.ToString(), AmountOnly); OleDbCommand cmdRemCash = new OleDbCommand(sqlRemCash, db.con); cmdRemCash.ExecuteNonQuery(); //Call method to remove Book from database m.RemBook(BookID, string.Format("Book Lost and Paid by Member = {0}", MemID), false); //Success MessageBox.Show(string.Format("Transaction of fine amount of Rs.{0}/- has beeen successfully recorded and Book has been successfully removed.", Amount), "Transaction & Removal Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); Reset(); End : if (db.con.State.Equals(ConnectionState.Open)) { db.con.Close(); } }