private void RentOKBtn_Click(object sender, EventArgs e) { if (DeliveredByTxt.Text.Trim() == "" || RecordedByTxt.Text.Trim() == "" || PickByTxt.Text.Trim() == "") { MessageBox.Show("Please fill-up the required fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (Syspasstxt.Text.Trim() != password) { MessageBox.Show("Invalid System Password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Syspasstxt.Text = ""; } else { string id; int a = 0, id2 = 0; SqlCommand cmd5 = new SqlCommand("Select * from [Rental Checklist]", conn); SqlDataReader dr8 = cmd5.ExecuteReader(); while (dr8.Read()) { id = dr8["Checklist Number"].ToString(); id2 = Convert.ToInt32(id); if (a < id2) { a = id2; } } dr8.Close(); a++; for (int b = 0; b < c; b++) { BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter addrent = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter(); addrent.AddChecklist(a, Convert.ToInt32(COFNumLbl.Text), Convert.ToInt32(itemid[b]), cat[b], subcat[b], speccat[b], itemnme[b], DateReleased.Value, TimeReleased.Value, unit[b], Convert.ToInt32(quanti[b]), DeliveredByTxt.Text.Trim(), PickByTxt.Text, RecordedByTxt.Text.Trim(), idstat, Convert.ToDecimal(RentSecurityAmt.Text.Trim())); a++; } MessageBox.Show("Item has been successfully delivered and this transaction is recorded in Rental Checklist", "Delivery Message", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); SqlCommand uporstat = new SqlCommand("Update Orderline set Status='Waiting' where [COF Number]=" + "'" + COFNumLbl.Text + "'", conn); uporstat.ExecuteNonQuery(); } }
private void RentalViewbtn_Click(object sender, EventArgs e) { if (RentalViewrbtn.Checked == true) { BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter view = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter(); DataTable datatable = view.ViewRentalChecklist(); Rental_Checklist_M rpt = new Rental_Checklist_M(); ViewRental vi = new ViewRental(); vi.SetDataSource(datatable); rpt.Checklist(vi); rpt.Show(); } else { if (RentalDatetxt.Text == "") { MessageBox.Show("Enter date first.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { int a = Convert.ToInt32(RentalDatetxt.Text); BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter rent = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter(); DataTable datatable = rent.COFRented(a); Rental_Checklist_M rpt = new Rental_Checklist_M(); ViewRental vi = new ViewRental(); vi.SetDataSource(datatable); rpt.Checklist(vi); rpt.Show(); } } }
private void frmRentalChcklst_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'balloonKingdomDataSet.Rental_Checklist' table. You can move, or remove it, as needed. // this.rental_ChecklistTableAdapter.Fill(this.balloonKingdomDataSet.Rental_Checklist); try { conn = new SqlConnection(); conn.ConnectionString = str_conn; conn.Open(); if (conn.State != ConnectionState.Open) { MessageBox.Show("Unable to connect to database", "Connection Status"); } } catch (Exception x) { MessageBox.Show(x.GetBaseException().ToString(), "Connection status"); } BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter viewrentalchklst = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Rental_ChecklistTableAdapter(); CheckListDataGV.DataSource = viewrentalchklst.ViewRentalChecklist(); }