Ejemplo n.º 1
0
        private void btnComfirm_Click(object sender, EventArgs e)
        {
            StudentDto newStudentDto;

            if (Utilities.StringIsNullOrEmpty(txtStudentId.Text, txtName.Text, txtAddress.Text, txtNation.Text, txtReligion.Text,
                                              txtPhone.Text, txtSsn.Text, lookUpEditClass.Text))
            {
                XtraMessageBox.Show(@"Please fill in all fields", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                newStudentDto = CreateStudent();
            }
            catch (Exception)
            {
                XtraMessageBox.Show(@"Please input valid information.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                StudentBusiness.AddStudent(newStudentDto);
            }
            catch (Exception)
            {
                XtraMessageBox.Show(@"Duplicate student. Please check the input information.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Close();
        }
Ejemplo n.º 2
0
        public void AddStudentTest()
        {
            var studentDto = new StudentDto
            {
                StudentId = "1"
            };

            StudentBusiness.AddStudent(studentDto);
            Assert.IsTrue(true);
        }
Ejemplo n.º 3
0
 [Route("AddStudent")]//添加信息
 public IHttpActionResult AddStudent(Student student)
 {
     StudentBusiness.AddStudent(student.xuehao, student.name, student.phone, student.sushehao, student.xiangmu, student.states);
     return(Ok(new ResponseData()));
 }