//
 //Adds feedback and returns success or error message
 //
 public string addFeedback(Feedback f)
 {
     try
     {
         conn.Open();
         cmd = new SqlCommand("Insert into Feedback (Employee_ID,Exam_ID,Answer1, Answer2, Answer3, Answer4, Answer5) values('" + f.Employee_ID + "', '" + f.exam_ID + "', " + f.answer1 + ", " + f.answer2 + ", " + f.answer3 + ", " + f.answer4 + ", " + f.answer5 + ")", conn);
         int i = cmd.ExecuteNonQuery();
         conn.Close();
         if (i == 1)
             return "You have successfully submitted your feedback.";
         else
             return "Some error occured. Sorry for the inconvenience.";
     }
     catch (Exception ex)
     {
         conn.Close();
         return "Some error occured. Sorry for the inconvenience.";
     }
 }
Esempio n. 2
0
        //
        //On click of Submit: Validates selection, stores feedback and navigates to Logout form
        //
        private void submit_Click(object sender, EventArgs e)
        {
            if((comboBox1.SelectedIndex == -1) || (comboBox2.SelectedIndex == -1) || (comboBox3.SelectedIndex== -1) || (comboBox4.SelectedIndex== -1) ||  (comboBox5.SelectedIndex == -1))
                MessageBox.Show("Please select a valid entry.","Error");
            else
            {
                Feedback g = new Feedback();
                g.employee_ID = emp.employee_Id;
                g.exam_ID = ed.exam_ID;
                g.answer1 = Convert.ToInt32(comboBox1.SelectedItem);
                g.answer2 = Convert.ToInt32(comboBox2.SelectedItem);
                g.answer3 = Convert.ToInt32(comboBox3.SelectedItem);
                g.answer4 = Convert.ToInt32(comboBox4.SelectedItem);
                g.answer5 = Convert.ToInt32(comboBox5.SelectedItem);
                string feed = f.addFeedback(g);
                MessageBox.Show(feed, "Feedback");

                LogoutForm fm9 = new LogoutForm(emp, ed);
                fm9.MdiParent = this.MdiParent;
                fm9.Dock = DockStyle.Fill;
                this.Close();
                fm9.Show();
            }
        }
 public string addFeedback(Feedback f)
 {
     string feed = f2.addFeedback(f);
     return feed;
 }