示例#1
0
 private void Submit_Click(object sender, EventArgs e)
 {
     try
     {
         String desctiption = FeedbackDetails.Text;
         if (comboBoxLecturers.Text == "" && comboBoxStudents.Text == "" && MentorBox.Text == "")
         {
             throw new Exception("Feedback person is required");
         }
         if (string.IsNullOrWhiteSpace(desctiption))
         {
             throw new Exception("Activity feedback is required");
         }
         ActivityFeedback af = new ActivityFeedback(Program.activityFeedback.Count + 1, DateTime.Now, desctiption, Program.empUser, resEmp, resStud);
         Program.activityFeedback.Add(af);
         Program.create_ActivityFeedback_In_DB(af);
         Program.empUser.addCreatedActivityFeedback(af);
         if (resEmp != null)
         {
             resEmp.addRecievedActivityFeedback(af);
             Program.update_ActivityFeedback_Recieve_Employee_In_DB(af);
         }
         if (resStud != null)
         {
             resStud.addStudentActivityFeedbacks(af);
             Program.update_ActivityFeedback_Recieve_Student_In_DB(af);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Activity feedback is required", MessageBoxButtons.OK);
     }
 }
 public static void update_ActivityFeedback_Recieve_Student_In_DB(ActivityFeedback af)
 {
     if (af.getRecieveStudent() != null)
     {
         SqlCommand c = new SqlCommand();
         c.CommandText = "EXECUTE dbo.SP_add_ActivityFeedback_Recieve_Student @RecieveStudent, @Id";
         c.Parameters.AddWithValue("@RecieveStudent", af.getRecieveStudent().getId());
         c.Parameters.AddWithValue("@Id", af.getId());
         SQL_CON SC = new SQL_CON();
         SC.execute_non_query(c);
     }
 }
        public static void create_ActivityFeedback_In_DB(ActivityFeedback af)
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_add_ActivityFeedback1 @Id, @Dt, @Description, @Creator";
            c.Parameters.AddWithValue("@id", af.getId());
            c.Parameters.AddWithValue("@Dt", af.getDateTime());
            c.Parameters.AddWithValue("@Description", af.getDescription());
            if (af.getCreator() != null)
            {
                c.Parameters.AddWithValue("@Creator", af.getCreator().getId());
            }
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
        public static void init_ActivityFeedback()
        { //מילוי המערך מתוך בסיס הנתונים
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_ActivityFeedbacks";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            activityFeedback = new List <ActivityFeedback>();

            while (rdr.Read())
            {
                ActivityFeedback af = new ActivityFeedback(int.Parse(rdr.GetValue(0).ToString()), DateTime.Parse((rdr.GetValue(1).ToString())),
                                                           rdr.GetValue(2).ToString(), getEmployeeObject(rdr.GetValue(3).ToString()), getEmployeeObject(rdr.GetValue(4).ToString()), getStudentObject(rdr.GetValue(5).ToString()));
                activityFeedback.Add(af);
                getEmployeeObject(rdr.GetValue(3).ToString()).addCreatedActivityFeedback(af);
            }
        }
 public void addRecievedActivityFeedback(ActivityFeedback b)
 {
     this.recievedActivityFeedback.Add(b);
 }
 public void addCreatedActivityFeedback(ActivityFeedback a)
 {
     this.createdActivityFeedback.Add(a);
 }
示例#7
0
 public void addStudentActivityFeedbacks(ActivityFeedback c)
 {
     studentActivityFeedbacks.Add(c);
 }
示例#8
0
 public void setStudentActivityFeedbacks(ActivityFeedback ActivityFeedbacksOnStudent)
 {
     studentActivityFeedbacks.Add(ActivityFeedbacksOnStudent);
 }