private void BtnLoadBooks_Click(object sender, EventArgs e) { //loading all the issued books adReg.Fill(tblReg, Program.UserID.ToString()); var row = tblReg[0]; adIssue.FillIssue(tblIssue, row.UserId); for (int i = 0; i < tblIssue.Count; i++) { var fillRows = tblIssue[i]; int id = fillRows.BookId; LibraryMSDataSet3.RegisterDataTable tblReg = new LibraryMSDataSet3.RegisterDataTable(); LibraryMSDataSet3TableAdapters.RegisterTableAdapter adReg = new LibraryMSDataSet3TableAdapters.RegisterTableAdapter(); LibraryMSDataSet3.RequestDataTable tblRequest = new LibraryMSDataSet3.RequestDataTable(); LibraryMSDataSet3TableAdapters.RequestTableAdapter adRequest = new LibraryMSDataSet3TableAdapters.RequestTableAdapter(); adReg.Fill(tblReg, Program.UserID.ToString()); var urow = tblReg[0]; LibraryMSDataSet3.BookDataTable tblBID = new LibraryMSDataSet3.BookDataTable(); LibraryMSDataSet3TableAdapters.BookTableAdapter adBID = new LibraryMSDataSet3TableAdapters.BookTableAdapter(); adBID.FillById(tblBID, id); var arow = tblBID[0]; fillRows.BookName = arow.BookName; fillRows.Email = Program.UserID.ToString(); } adIssue.Update(tblIssue); gridBooks.DataSource = adIssue.GetIssueData(row.UserId); }
private void BtnIssue_Click(object sender, EventArgs e) { //requesting for issueing a book int id = -100; if (cmbField.SelectedIndex == 0) { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } else if (cmbField.SelectedIndex == 1) { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } else if (cmbField.SelectedIndex == 2) { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } else if (cmbField.SelectedIndex == 3) { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } else if (cmbField.SelectedIndex == 4) { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } else if (cmbField.SelectedIndex == 5) { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } else { id = Convert.ToInt32(LstInfo.GetItemText(LstInfo.SelectedIndex)); } var iRow = libraryMSDataSet.NumOfIssues[0]; var cRow = libraryMSDataSet.Copies[0]; //checking the limit if (iRow.Expr1 < cRow.NoofIssue) { id = id + 1; LibraryMSDataSet3.RegisterDataTable tblReg = new LibraryMSDataSet3.RegisterDataTable(); LibraryMSDataSet3TableAdapters.RegisterTableAdapter adReg = new LibraryMSDataSet3TableAdapters.RegisterTableAdapter(); LibraryMSDataSet3.RequestDataTable tblRequest = new LibraryMSDataSet3.RequestDataTable(); LibraryMSDataSet3TableAdapters.RequestTableAdapter adRequest = new LibraryMSDataSet3TableAdapters.RequestTableAdapter(); adReg.Fill(tblReg, Program.UserID.ToString()); var urow = tblReg[0]; LibraryMSDataSet3.BookDataTable tblBID = new LibraryMSDataSet3.BookDataTable(); LibraryMSDataSet3TableAdapters.BookTableAdapter adBID = new LibraryMSDataSet3TableAdapters.BookTableAdapter(); adBID.FillById(tblBID, id); var arow = tblBID[0]; adRequest.Insert(arow.BookId, null, "issue", DateTime.Now.Date, urow.UserId, arow.BookName, Program.UserID.ToString()); MessageBox.Show("Your Selected book is requested for issue"); } else { MessageBox.Show("Limit Exceeded"); } }
public History() { InitializeComponent(); AppDomain.CurrentDomain.SetData("DataDirectory", @Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10))); //intializing all the required dataset tables and adapters tblRequest = new LibraryMSDataSet3.RequestDataTable(); adRequest = new LibraryMSDataSet3TableAdapters.RequestTableAdapter(); tblIssue = new LibraryMSDataSet3.IssueDataTable(); adIssue = new LibraryMSDataSet3TableAdapters.IssueTableAdapter(); tblBooks = new LibraryMSDataSet3.BookDataTable(); adBooks = new LibraryMSDataSet3TableAdapters.BookTableAdapter(); tblReg = new LibraryMSDataSet3.RegisterDataTable(); adReg = new LibraryMSDataSet3TableAdapters.RegisterTableAdapter(); }