private void UnivInfo_Load(object sender, EventArgs e)
 {
     StudentProfile sp = new StudentProfile();
     List<string> s = sp.getSession();
     for (int i = 0; i < s.Count; i++) {
         session_comboBox.Items.Add(s[i]);
     }
 }
 private void StudentWiseResultPrint_Load(object sender, EventArgs e)
 {
     StudentProfile sp = new StudentProfile();
     List<string> id = sp.getID();
     for (int i = 0; i < id.Count; i++) {
         Id_comboBox.Items.Add(id[i]);
     }
     Id_comboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
     Id_comboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
 }
 private void InsertPayment_Load(object sender, EventArgs e)
 {
     StudentProfile sp = new StudentProfile();
     date = dateTimePicker1.Value.ToShortDateString();
     List<string> id = sp.getID();
     for (int i = 0; i < id.Count; i++) {
         Id_comboBox.Items.Add(id[i]);
     }
     Id_comboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
     Id_comboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
 }
 private void AddResult_Load(object sender, EventArgs e)
 {
     StudentProfile sp=new StudentProfile();
      List<string> session = sp.getSession();
      for (int i = 0; i < session.Count; i++) {
          session_comboBox.Items.Add(session[i]);
      }
        date = dateTimePicker1.Value.ToShortDateString();
        subject_comboBox.Items.Add("Mathematics");
        subject_comboBox.Items.Add("Physics");
        subject_comboBox.Items.Add("Chemistry");
 }
        private void session_comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {

                StudentProfile sp = new StudentProfile();
                univInfo_dataGridView.DataSource = sp.getUniversityInfo(session_comboBox.SelectedItem.ToString());
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }
 private void BatchWisePrintResult_Load(object sender, EventArgs e)
 {
     StudentProfile sp = new StudentProfile();
     List<string> sesssion = sp.getSession();
     List<string> batch = sp.getBatch();
     for (int i = 0; i < sesssion.Count; i++) {
         session_comboBox.Items.Add(sesssion[i]);
     }
     for (int i = 0; i < batch.Count; i++) {
         batch_comboBox.Items.Add(batch[i]);
     }
     date = dateTimePicker1.Value.ToShortDateString();
 }
        private void ID_comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                StudentProfile sp = new StudentProfile();
                image.Visible = true;
                ssc_label.Visible = true;
                hsc_label.Visible = true;
                DataTable dt = sp.getInformationOfAStudent(ID_comboBox.Text);
                DataTable dt1 = sp.getEduBackOfAStudent(ID_comboBox.Text);
                session_label.Text = "Session: " + dt.Rows[0].Field<string>(1);
                name_label.Text = "Name :" + dt.Rows[0].Field<string>(2);
                fname_label.Text = "Father Name: " + dt.Rows[0].Field<string>(3);
                mname_label.Text = "Mother Name: " + dt.Rows[0].Field<string>(4);
                foccupation_label.Text = "Father's Ocuupation: " + dt.Rows[0].Field<string>(5);
                blood_label.Text = "Blood Group: " + dt.Rows[0].Field<string>(7);
                paddress_label.Text = "Present Address: " + dt.Rows[0].Field<string>(6);
                amntpayment_label.Text = "Total Payment: " + dt.Rows[0].Field<string>(14);
                infomedia_label.Text = "Info Media: " + dt.Rows[0].Field<string>(8);
                batch_label.Text = "Batch: " + dt.Rows[0].Field<string>(9);
                stdmbl_label.Text = "Student's Mobile No: " + dt.Rows[0].Field<string>(10);
                grdmbl_label.Text = "Guardian's Mobile No: " + dt.Rows[0].Field<string>(11);
                gender_label.Text = "Gender: " + dt.Rows[0].Field<string>(13);
                school_label.Text = "School Name: " + dt1.Rows[1].Field<string>(2);
                ssc_gpa_label.Text = "GPA: " + dt1.Rows[1].Field<string>(3);
                ssc_passyear_label.Text = "Passing Year: " + dt1.Rows[1].Field<string>(4);
                college_label.Text = "College Name: " + dt1.Rows[0].Field<string>(2);
                hsc_gpa_label.Text = "GPA: " + dt1.Rows[0].Field<string>(3);
                hsc_passyear_label.Text = "Passing Year: " + dt1.Rows[0].Field<string>(4);
             if (pictureBox1.Image != null)
             {
             pictureBox1.Image.Dispose();
               }
            //using filestream object write the column as bytes and store
             FileStream FS1 = new FileStream("image.jpg", FileMode.Create);
                Byte[] blob = (Byte[])dt.Rows[0].Field<Byte[]>(12);
                FS1.Write(blob, 0, blob.Length);
                FS1.Close();
                FS1 = null;
                pictureBox1.Image = Image.FromFile("image.jpg");
                 pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                pictureBox1.Refresh();

            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }
        private void AddStudent_button_Click(object sender, EventArgs e)
        {
            StudentProfile sp = new StudentProfile();
            StudentPayment pay = new StudentPayment();
            string id = Id_textBox.Text;
            string session = Session_textBox.Text;
            string batch = Batch_textBox.Text;
            string name = Name_textBox.Text;
            Byte [] image = buffer;
            string fname = FatherName_textBox.Text;
            string mname = MotherName_textBox.Text;
            string foccupation = FatherOccupation_textBox.Text;
            string paddress = PresentAddress_textBox.Text;
            string stdmbl = stdmbl_textBox.Text;
            string grdmbl = Guardianmbl_textBox.Text;
            string blood=BloodGroup_comboBox.SelectedItem.ToString();
            string payment = Payment_textBox.Text;
            string infomedia = InfoMedia_textBox.Text;
            string schoolname = school_textBox.Text;
            string sscgpa = SSC_Gpa_textBox.Text;
            string sscpassyear = SSCPassingYear_comboBox.SelectedItem.ToString();
            string collegename = College_textBox.Text;
            string hscgpa = hscgpa_textBox.Text;
            string hscpassyear = HSCPassingYear_comboBox.SelectedItem.ToString();
            try
            {

                sp.AddStudent(id,session,batch,name,image,fname,mname,foccupation,paddress,stdmbl,grdmbl,blood,payment,infomedia);
                sp.AddEducationalBackground(id, "SSC", schoolname, sscgpa, sscpassyear);
                sp.AddEducationalBackground(id, "HSC", collegename, hscgpa, hscpassyear);
                pay.insert_DuePayment(id, payment, "Not Paid");
                MessageBox.Show("Information Saved Successfully");
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString()+ex.StackTrace);
            }
        }
 private void bloodGroup_comboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     StudentProfile sp = new StudentProfile();
     bloodGroup_dataGridView.DataSource = sp.getBloodGroupOfStudent(bloodGroup_comboBox.SelectedItem.ToString());
 }
 private void session_comboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     StudentProfile sp=new StudentProfile();
     List<string> id=sp.getIdOfSelectedSession(session_comboBox.Text);
     DataTable dt = new DataTable();
     dt.Columns.Add("ID");
     dt.Columns.Add("Written");
     dt.Columns.Add("MCQ");
     dt.Columns.Add("Remarks");
     DataRow dr;
     for (int i = 0; i < id.Count; i++)
     {
         dr = dt.NewRow();
         dr["ID"] = id[i];
         dt.Rows.Add(dr);
     }
     this.InsertMark_dataGridView.DataSource = dt;
 }
 private void ViewStudent_Load(object sender, EventArgs e)
 {
     StudentProfile sp = new StudentProfile();
     showInfo_comboBox.Items.Add("View All Information Of A Student");
     showInfo_comboBox.Items.Add("Students Of Particular Blood Group");
     showInfo_comboBox.Items.Add("University Information And Educational Background");
     showInfo_comboBox.Items.Add("Number Of Student In Universities");
     List<string> ids;
     ids = sp.getID();
     for (int j = 0; j < ids.Count; j++)
     {
        ID_comboBox.Items.Add(ids[j]);
     }
 }
 private void session_comboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     StudentProfile sp=new StudentProfile();
     number_dataGridView.DataSource = sp.getStudentNumberInUniversity(session_comboBox.SelectedItem.ToString());
 }