private void Submit_Click(object sender, EventArgs e)
 {
     if (Validate_Form())
     {
         DateTime     today           = DateTime.Today;
         SQL_Operator sql_operator    = new SQL_Operator();
         int          graduation_year = today.Year + 4;
         string       sqlQuery        = null;
         if (YesButton.Checked)
         {
             sqlQuery = "INSERT INTO STUDENT_INFO (usn, name, dob, graduation_year, hostel_id) VALUES ('" + USNBox.Text.ToUpper() + "', '" + NameBox.Text.ToUpper() + "', DATE '" + DOBBox.Text + "', " + graduation_year + ", HOSTEL_ID_SEQUENCE.NEXTVAL)";
         }
         else
         {
             sqlQuery = "INSERT INTO STUDENT_INFO (usn, name, dob, graduation_year) VALUES ('" + USNBox.Text.ToUpper() + "', '" + NameBox.Text.ToUpper() + "', DATE '" + DOBBox.Text + "', " + graduation_year + ")";
         }
         if (sql_operator.Insert(sqlQuery))
         {
             MessageBox.Show("Inserted Entry", "Successful");
             Clear_All_Entries();
         }
         else
         {
             MessageBox.Show("USN Must Be Unique", "Failed");
         }
     }
 }
Example #2
0
 private void Submit_Click(object sender, EventArgs e)
 {
     if (Validate_Form())
     {
         DateTime today    = DateTime.Today;
         string   date     = today.Year.ToString() + "-" + today.Month.ToString() + "-" + today.Day.ToString();
         string   sqlQuery = "INSERT INTO STAFF_INFO (employee_id, name, type, join_date, designation) VALUES ('" + EmployeeIDBox.Text.ToUpper() + "', '" + NameBox.Text.ToUpper() + "', '" + TypeList.Text.ToUpper() + "', date '" + date + "', '" + DesignationList.Text.ToUpper() + "')";
         if (sql_operator.Insert(sqlQuery))
         {
             MessageBox.Show("Inserted Entry", "Successful");
             Clear_All_Entries();
         }
         else
         {
             MessageBox.Show("Employee ID Must Be Unique", "Failed");
         }
     }
 }