コード例 #1
0
        private void pictureBox9_Click(object sender, EventArgs e)
        {
            try
            {
                dgstudent.DataSource    = null;
                dgfess.DataSource       = null;
                dgfess.Visible          = false;
                tbstudent.Visible       = true;
                tbstudent.SelectedIndex = 1;
                CourseDT                = CourseAdapter.SelectCourse();
                cmbscoure.DataSource    = CourseDT;
                cmbscoure.DisplayMember = "CourseName";
                cmbscoure.ValueMember   = "Coursefees";
                cmbscoure.Text          = "SELECT";

                TeaDT = TeaAdapter.select();
                cmmtach.DataSource    = TeaDT;
                cmmtach.DisplayMember = "TeacherName";
                cmmtach.ValueMember   = "ID";
                cmmtach.Text          = "SELECT";

                txtsname.Text  = "";
                lblrecord.Text = "";
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message.ToString(), "Error!!  Student");
            }
        }
コード例 #2
0
 private void button15_Click(object sender, EventArgs e)
 {
     try{
         if (txtcid.Text == "")
         {
             MessageBox.Show("Please, Enter Course ID", "Student");
         }
         else
         {
             CourseDT = CourseAdapter.SelectCoursebyID(Convert.ToInt32(txtcid.Text));
             if (CourseDT.Rows.Count > 0)
             {
                 gpupdatecourse.Visible    = true;
                 txtcname.Text             = CourseDT.Rows[0]["Coursename"].ToString();
                 txtcfees.Text             = CourseDT.Rows[0]["CourseFees"].ToString();
                 cmbcduration.SelectedItem = CourseDT.Rows[0]["Duration"].ToString();
             }
             else
             {
                 MessageBox.Show("Invalid Course ID", " Student");
             }
         }
     }
     catch (Exception a)
     {
         MessageBox.Show(a.Message.ToString(), "Error !!");
     }
 }
コード例 #3
0
 private void pictureBox7_Click(object sender, EventArgs e)
 {
     try
     {
         tbstudent.Visible       = true;
         tbstudent.SelectedIndex = 4;
         CourseDT            = CourseAdapter.SelectCourse();
         dgcourse.DataSource = CourseDT;
     }
     catch (Exception a)
     {
         MessageBox.Show(a.Message.ToString(), "Error!!  Student");
     }
 }
コード例 #4
0
        private void tbstudent_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (tbstudent.SelectedIndex == 0)
                {
                    tbstudent.Visible = true;
                    //tbstudent.SelectedIndex = 0;
                    studentclear();
                    CourseDT                = CourseAdapter.SelectCourse();
                    cmbcourse.DataSource    = CourseDT;
                    cmbcourse.DisplayMember = "CourseName";
                    cmbcourse.ValueMember   = "Coursefees";
                    cmbcourse.SelectedIndex = 0;
                }
                else if (tbstudent.SelectedIndex == 1)
                {
                    tbstudent.Visible    = true;
                    dgstudent.DataSource = null;
                    dgfess.DataSource    = null;
                    dgfess.Visible       = false;
                    //tbstudent.SelectedIndex = 1;
                    CourseDT                = CourseAdapter.SelectCourse();
                    cmbscoure.DataSource    = CourseDT;
                    cmbscoure.DisplayMember = "CourseName";
                    cmbscoure.ValueMember   = "Coursefees";
                    cmbscoure.Text          = "SELECT";


                    TeaDT = TeaAdapter.select();
                    cmmtach.DataSource    = TeaDT;
                    cmmtach.DisplayMember = "TeacherName";
                    cmmtach.ValueMember   = "ID";
                    cmmtach.Text          = "SELECT";
                    txtsname.Text         = "";
                    lblrecord.Text        = "";
                }
                else if (tbstudent.SelectedIndex == 2)
                {
                    tbstudent.Visible = true;
                    lblfees.Text      = "";
                    //tbstudent.SelectedIndex = 2;
                    lblfeeerror.Text     = "";
                    gpupdatefees.Visible = false;
                    txtfeeid.Text        = "";
                    txtfeeadd.Text       = "";
                    btnedit.Visible      = false;
                }
                else if (tbstudent.SelectedIndex == 3)
                {
                    lblcourse.Text    = "";
                    tbstudent.Visible = true;
                    // tbstudent.SelectedIndex = 3;
                }
                else if (tbstudent.SelectedIndex == 4)
                {
                    tbstudent.Visible = true;
                    // tbstudent.SelectedIndex = 4;
                    CourseDT            = CourseAdapter.SelectCourse();
                    dgcourse.DataSource = CourseDT;
                }
                else if (tbstudent.SelectedIndex == 5)
                {
                }
                else if (tbstudent.SelectedIndex == 6)
                {
                    dgteacher.DataSource = null;
                    TeaDT = TeaAdapter.select();
                    dgteacher.DataSource = TeaDT;
                }
                else if (tbstudent.SelectedIndex == 7)
                {
                    lblerror.Text = "";

                    if (userid == 1 || userid == 2)
                    {
                        tbadmin.Visible  = true;
                        lblerror.Visible = false;
                        lblerror.Text    = "";
                        txtsid.Text      = "";
                        dgstu.Visible    = false;
                        dgstu.DataSource = null;
                        btndel.Visible   = false;
                    }
                    else
                    {
                        tbadmin.Visible  = false;
                        lblerror.Visible = true;
                        lblerror.Text    = "Sorry !!, You are unable to get this faclity !!";
                    }
                }
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message.ToString(), "Error!!  Student");
            }
        }
コード例 #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                int blank = 0;
                if (txtname.Text == "")
                {
                    lblnamee.Visible = true;
                    blank            = 1;
                }
                else
                {
                    lblnamee.Visible = false;
                }
                if (txtsurname.Text == "")
                {
                    lblsurnamee.Visible = true;
                    blank = 1;
                }
                else
                {
                    lblsurnamee.Visible = false;
                }
                if (txtemail.Text == "")
                {
                    lblemaile.Visible = true;
                    blank             = 1;
                }
                else
                {
                    lblemaile.Visible = false;
                }

                if (txtemail.Text.Contains("@") && txtemail.Text.Contains("."))
                {
                    lblemaile.Visible = false;
                }
                else
                {
                    lblemaile.Visible = true;
                    blank             = 1;
                }
                if (txtcontact.Text == "")
                {
                    lblmoe.Visible = true;
                    blank          = 1;
                }
                else
                {
                    lblmoe.Visible = false;
                }

                if (blank == 0)
                {
                    lblmoe.Visible      = false;
                    lblemaile.Visible   = false;
                    lblnamee.Visible    = false;
                    lblsurnamee.Visible = false;
//gpcourse.Visible = true;
                    Drpyear.SelectedItem    = 0;
                    gpcourse.Enabled        = true;
                    CourseDT                = CourseAdapter.SelectCourse();
                    cmbcourse.DataSource    = CourseDT;
                    cmbcourse.DisplayMember = "CourseName";
                    cmbcourse.ValueMember   = "Coursefees";
                    cmbcourse.Text          = "SELECT";

                    TeaDT = TeaAdapter.select();
                    cmbteacher.DataSource    = TeaDT;
                    cmbteacher.DisplayMember = "TeacherName";
                    cmbteacher.ValueMember   = "ID";
                    cmbteacher.Text          = "SELECT";

                    txtfees.Text = "";
                }
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message.ToString(), "Error!!  Student");
            }
        }