private void btnUpdate_Click(object sender, EventArgs e)
        {
            var  progarm       = cbProgram.SelectedItem as Programs;
            var  classSchedule = cbClassesSchedule.SelectedItem as ClassSchedule;
            bool updated       = false;

            if (classSchedule.Id == 1)
            {
                MorningStudent student = new MorningStudent
                {
                    StudentId       = int.Parse(txtSId.Text.Trim()),
                    Name            = txtName.Text.Trim(),
                    FatherName      = txtFatherName.Text.Trim(),
                    Address         = txtAddress.Text.Trim(),
                    DateOfBirth     = dtpDoB.Value,
                    DateOfAdmission = dtpDoAdmission.Value,
                    ProgramID       = progarm.ProgramsId,
                    ClassScheduleID = classSchedule.Id
                };
                updated = studentCRUD.UpdateStudent(student);
            }
            else if (classSchedule.Id == 2)
            {
                EveningStudent student = new EveningStudent
                {
                    StudentId       = int.Parse(txtSId.Text.Trim()),
                    Name            = txtName.Text.Trim(),
                    FatherName      = txtFatherName.Text.Trim(),
                    Address         = txtAddress.Text.Trim(),
                    DateOfBirth     = dtpDoB.Value,
                    DateOfAdmission = dtpDoAdmission.Value,
                    ProgramID       = progarm.ProgramsId,
                    ClassScheduleID = classSchedule.Id
                };
                updated = studentCRUD.UpdateStudent(student);
            }
            else if (classSchedule.Id == 3)
            {
                WeekendStudent student = new WeekendStudent
                {
                    StudentId       = int.Parse(txtSId.Text.Trim()),
                    Name            = txtName.Text.Trim(),
                    FatherName      = txtFatherName.Text.Trim(),
                    Address         = txtAddress.Text.Trim(),
                    DateOfBirth     = dtpDoB.Value,
                    DateOfAdmission = dtpDoAdmission.Value,
                    ProgramID       = progarm.ProgramsId,
                    ClassScheduleID = classSchedule.Id
                };
                updated = studentCRUD.UpdateStudent(student);
            }
            if (updated)
            {
                MessageBox.Show("Updated Successfully");
            }
        }
        public void UpdateStudentTest()
        {
            Student student = new Student();

            student.ID    = "STUD-001";
            student.Name  = "Ruchika Dubey";
            student.Class = "10th B";
            bool flag = StudentCRUD.UpdateStudent(student);

            Assert.AreEqual(true, flag);
        }
예제 #3
0
 public void UpdateStudent(Student dataToBeUpdated)
 {
     studentTableActions.UpdateStudent(dataToBeUpdated);
 }