private void btn_Search_Book_Click(object sender, EventArgs e) { SqlDataReader y = info.Find_Book(int.Parse(txt_Book_Id.Text)); if (y.Read()) { lbl_Book_Catagory_Display_In.Text = y[1].ToString(); lbl_Book_Title_Display_In.Text = y[3].ToString(); SqlDataReader z = info.Find_Book_Status(int.Parse(txt_Book_Id.Text)); if (z.Read()) { if (z[1].ToString() == "Yes") { SqlDataReader x = info.Find_Reference_No(); if (x.Read()) { string Count = x[0].ToString(); int Count_2; if (int.TryParse(Count, out Count_2)) { } Count_2++; lbl_Reference_No_Display.Text = Count_2.ToString(); } gbo_Outsider.Enabled = true; txt_NIC.Focus(); txt_Book_Id.Enabled = false; txt_NIC.Enabled = true; } else if (z[1].ToString() == "No") { MessageBox.Show("The Book Has Been Lended, Please Check The Book Id", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Book_Id.Clear(); txt_Book_Id.Focus(); } else { MessageBox.Show("The Book Has Been Lost Alredy, Please Check The Book Id", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Book_Id.Clear(); txt_Book_Id.Focus(); } } } else { MessageBox.Show("The Book Does Not Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Book_Id.Clear(); txt_Book_Id.Focus(); } }
private void dtp_In_Time_LostFocus(object sender, System.EventArgs e) { SqlDataReader x = info.Find_Mutimedia_Usage_No(); if (x.Read()) { string Count = x[0].ToString(); int Count_2; if (int.TryParse(Count, out Count_2)) { } Count_2++; lbl_Circulation_No_Display.Text = Count_2.ToString(); } dtp_Duration.Text = ((((dtp_Out_Time.Value).AddMinutes(1)).Subtract(dtp_In_Time.Value))).ToString(); double Cost1 = ((dtp_Duration.Value).Minute) * 0.6666; double Cost2 = ((dtp_Duration.Value).Hour) * 40; double Cost3 = Cost1 + Cost2; lbl_Cost_Display.Text = (Math.Round(Cost3, 0)).ToString(); txt_Recipt_No.Focus(); dtp_In_Time.Enabled = false; txt_Recipt_No.Enabled = true; }
private void txt_Member_Id_LostFocus(object sender, System.EventArgs e) { SqlDataReader q = info.Find_Members_Basic(int.Parse(txt_Member_Id.Text)); if (q.Read()) { dtp_Membership_Date.Text = q[7].ToString(); info.Set_Membership_Status(int.Parse(txt_Member_Id.Text), dtp_Membership_Date.Value); SqlDataReader z = info.Find_Membership_Status(int.Parse(txt_Member_Id.Text)); if (z.Read()) { lbl_Satatus_Display.Text = z[0].ToString(); } DataSet ds = info.List_Of_Lended_Books(int.Parse(txt_Member_Id.Text)); dgv_Member.DataSource = ds.Tables["Lended Book Details"]; if (lbl_Satatus_Display.Text == "Active") { int p = info.Find_No_Book_To_Returned(int.Parse(txt_Member_Id.Text)); if (p >= 2) { MessageBox.Show("Lended Books Are Not Returend Yet", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Member_Id.Clear(); txt_Member_Id.Focus(); btn_Submit.Enabled = false; } else { SqlDataReader x = info.Find_Circulation_No(); if (x.Read()) { string Count = x[0].ToString(); int Count_2; if (int.TryParse(Count, out Count_2)) { } Count_2++; lbl_Circulation_No_Display.Text = Count_2.ToString(); } txt_Member_Id.Enabled = false; btn_Submit.Enabled = true; } } else { MessageBox.Show("Membership Suspended", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Member_Id.Clear(); txt_Member_Id.Focus(); btn_Submit.Enabled = false; } } else { MessageBox.Show("The Member Does Not Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Member_Id.Clear(); txt_Member_Id.Focus(); btn_Submit.Enabled = false; } }