public override void btnedit_Click(object sender, EventArgs e) { add_edit = false; c.GetMdiParent(this).DisableAllEditMenuButtons(); ATxtScholar.Focus(); DesignForm.fromDesign1(this); }
public override void btnnew_Click(object sender, EventArgs e) { add_edit = true; c.cleartext(this); c.GetMdiParent(this).DisableAllEditMenuButtons(); ATxtScholar.Focus(); cmbmonth.SelectedIndex = 0; DesignForm.fromDesign2(this); }
private void ATxtScholar_Leave(object sender, EventArgs e) { try { SqlDataReader reader; int count = 0; if (ATxtScholar.Text.Trim() != string.Empty) { //int studentno; c.returnconn(c.myconn); string mysql; mysql = "select * from tbl_student where scholarno='" + ATxtScholar.Text + "'"; SqlCommand com; com = new SqlCommand(mysql, c.myconn); reader = com.ExecuteReader(); DataSet dss = Connection.GetDataSet("select studentno from tbl_student where scholarno='" + ATxtScholar.Text + "'"); if (dss.Tables[0].Rows.Count > 0) { stuno = Convert.ToInt32(dss.Tables[0].Rows[0][0]); } DataSet ds = Connection.GetDataSet("select count(*) from tbl_roomdet where studentno='" + stuno + "'"); if (ds.Tables[0].Rows.Count > 0) { count = Convert.ToInt32(ds.Tables[0].Rows[0][0]); } int i = 0; if (reader.HasRows && count != 0) { reader.Read(); stuno = Convert.ToInt16(reader["studentno"]); lblstudentno.Text = stuno.ToString(); lblfathername.Text = Convert.ToString(reader["father"]); lblname.Text = Convert.ToString(reader["name"]); reader.Close(); mysql = "select t.studentno,a.classno,b.classname+' '+c.sectionname as class,e.hostelname,d.bedno,e.hostelfee,e.messfee from tbl_classstudent t ,tbl_class a,tbl_classmaster b,tbl_section c ,tbl_hostel e,tbl_roomdet d"; mysql = mysql + " where b.classcode=a.classcode and c.sectioncode=a.sectioncode and t.classno=a.classno and t.sessioncode=" + school.CurrentSessionCode + " and t.studentno=" + stuno + " and t.studentno=d.studentno and d.hostelcode=e.hostelcode"; com = new SqlCommand(mysql, c.myconn); reader = com.ExecuteReader(); i = 0; if (reader.HasRows) { reader.Read(); //DataSet ds = Connection.GetDataSet("select feeno from tbl_hostelfee where studentno='"+studentno +"' and "); //textBox1.Text = ds. Tables [0].Rows[0]["feeno"].ToString (); lblclass.Text = Convert.ToString(reader["class"]); lblbedno.Text = Convert.ToString(reader["hostelname"]) + " " + Convert.ToString(reader["bedno"]); lblhostelfee.Text = Convert.ToString(reader["hostelfee"]); lblmessfee.Text = Convert.ToString(reader["messfee"]); reader.Close(); } else { reader.Close(); } this.ShowFeeDetails(); } else { MessageBox.Show("Room Not Alloted Yet to this student..."); c.GetMdiParent(this).DisableAllEditMenuButtons(); ATxtScholar.Focus(); } } else { MessageBox.Show("Please Enter Scholar NO."); } ShowFeeDetails(); } catch (Exception ex) { throw ex; } }