private void සයලලToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Search_Student ss = Search_Student.getInstance();

            ss.MdiParent = this;
            ss.Show();
            ss.WindowState     = FormWindowState.Maximized;
            ss.FormBorderStyle = FormBorderStyle.FixedSingle;
        }
예제 #2
0
        private void edit_student_FormClosed(object sender, FormClosedEventArgs e)
        {
            Search_Student ss = Search_Student.getInstance();
            Search_Students_By_Dahampasala ssd = Search_Students_By_Dahampasala.getInstance();

            ssd.Enabled = true;
            ssd.updateDatagridview();
            ss.updateDatagridview();
            ss.Enabled = true;
        }
 public static Search_Student getInstance()
 {
     if (inst9 == null || inst9.IsDisposed)
     {
         inst9 = new Search_Student();
         return(inst9);
     }
     else
     {
         return(inst9);
     }
 }
예제 #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (avail_lbl.Text == "Unavailable")
     {
         MessageBox.Show("තරග අංකය භාවිතයේ පවතී", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (textBox1.Text == "")
     {
         MessageBox.Show("නම ඇතුලත් කර නොමැත", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (dateTimePicker1.Value == DateTime.Today)
     {
         MessageBox.Show("උපන්දිනය ඇතුලත් කර නොමැත", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (textBox2.Text == "")
     {
         MessageBox.Show("ඉංග්‍රීසි නම ඇතුලත් කර නොමැත", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (comboBox1.SelectedItem == null)
     {
         MessageBox.Show("ශ්‍රේණියක් තෝරා නොමැත", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (comboBox2.SelectedItem == null)
     {
         MessageBox.Show("තරගයක් තෝරා නොමැත", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         String       competitionID = getCompetitionID(comboBox1.Text, comboBox2.Text);
         MySqlCommand cmd           = new MySqlCommand();
         cmd.Connection = SqlCon.con;
         DateTime max_birthday = getMaximumAge(comboBox1.Text);          //get the maximum date for the selected student
         try
         {
             if (dateTimePicker1.Value >= max_birthday)      //checking for over age students
             {
                 cmd.CommandText = "INSERT INTO `studentstable`(`StudentID`, `Name`, `Birthday`, `Name_english`, `Telephone`, `CompetitionID`, `dahampasala`) VALUES('" + numericUpDown1.Value.ToString() + "','" + textBox1.Text + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + textBox2.Text + "','" + textBox3.Text + "','" + competitionID + "','" + comboBox3.Text + "');";
                 SqlCon.con.Open();
                 cmd.ExecuteNonQuery();
                 SqlCon.con.Close();
                 Search_Student ss = Search_Student.getInstance();
                 ss.updateDatagridview();
                 Search_Students_By_Dahampasala ssd = Search_Students_By_Dahampasala.getInstance();
                 ssd.updateDatagridview();
                 MessageBox.Show("දත්ත ඇතුලත් කිරීම සාර්ථකයි", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 resetValues();          //reset values
                 numericUpDown1_ValueChanged(sender, e);
             }
             else                        //adding one to the over age students
             {
                 cmd.CommandText = "INSERT INTO `studentstable`(`StudentID`, `Name`, `Birthday`, `Name_english`, `Telephone`, `CompetitionID`, `dahampasala`,`overage`) VALUES('" + numericUpDown1.Value.ToString() + "','" + textBox1.Text + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + textBox2.Text + "','" + textBox3.Text + "','" + competitionID + "','" + comboBox3.Text + "',1);";
                 SqlCon.con.Open();
                 cmd.ExecuteNonQuery();
                 SqlCon.con.Close();
                 Search_Student ss = Search_Student.getInstance();
                 Search_Students_By_Dahampasala ssd = Search_Students_By_Dahampasala.getInstance();
                 ssd.updateDatagridview();
                 ss.updateDatagridview();
                 MessageBox.Show("දත්ත ඇතුලත් කිරීම සාර්ථකයි", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 resetValues();
                 numericUpDown1_ValueChanged(sender, e);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             SqlCon.con.Close();
         }
     }
     //resetValues();          //reset values
 }