Beispiel #1
0
 public ActionResult Create(StudentInfo newStudent)
 {
     try
     {
         studentService.CreateStudent(newStudent);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        private void Save()
        {
            string szGender = string.Empty;
            if (cmbGender.Text == "Female") szGender = "F";
            if (cmbGender.Text == "Male") szGender = "M";
            Boolean ret = false;
            string message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);

            StudentServiceClient studentService = new StudentServiceClient();

            Student student = new Student()
            {
                StudentId = txtStudentId.Text,
                FirstName = txtFirstName.Text,
                MiddleName = txtMiddleName.Text,
                LastName = txtLastName.Text,
                Image = bImage,
                SchoolLastAttended = txtSchoolLastAttended.Text,
                GradeLevel = cmbGradeLevel.Text,
                DOB = dtDOB.Value,
                MadrasahEnrolled = chkMadrasah.Checked,
                Card = chkReportCard.Checked,
                GoodMoral = chkGoodMoral.Checked,
                BirthCertificate = chkBirthCertificate.Checked,
                POBAddress = txtPOB_Street.Text,
                POBBarangay = txtPOB_Brgy.Text,
                POBProvince = txtPOB_Province.Text,
                POBTownCity = txtPOB_Town.Text,
                HomeAddress = txtHA_Street.Text,
                HomeProvince = txtHA_Province.Text,
                HomeBarangay = txtHA_Brgy.Text,
                HomeTownCity = txtHA_Town.Text,
                FathersName = txtFather_FullName.Text,
                FathersOccupation = txtFather_Occupation.Text,
                FathersAverageYearlyIncome = double.Parse(txtFather_Income.Text),
                FathersEducation = txtFather_EducAttainment.Text,
                MothersMaidenName = txtMother_FullName.Text,
                MothersEducation = txtMother_EducAttainment.Text,
                MothersOccupation = txtMother_Occupation.Text,
                MothersAverageYearlyIncome = double.Parse(txtMother_Income.Text),
                GuardiansName = txtGuardian_FullName.Text,
                GuardiansOccupation = txtGuardian_Occupation.Text,
                GuardiansAverageYearlyIncome = double.Parse(txtGuardian_Income.Text)
            };



            if (Op.Equals("edit"))
                ret = studentService.UpdateStudent(ref student, ref message);
            else
                ret = studentService.CreateStudent(ref student, ref message);

            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();
        }
Beispiel #3
0
        private void Save()
        {
            string szGender = string.Empty;
            if (cmbGender.Text == "Female") szGender = "F";
            if (cmbGender.Text == "Male") szGender = "M";
            Boolean ret = false;
            string message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);
            var convertDecimal = Convert.ToDecimal(txtFail.Text);
            StudentServiceClient studentService = new StudentServiceClient();
            int schoId= studentService.GetScholarshipDiscountId("none");
            Student student = new Student();

            student.StudentId = txtStudentId.Text;
            student.FirstName = txtFirstName.Text;
            student.MiddleName = txtMiddleName.Text;
            student.LastName = txtLastName.Text;
            student.Average = double.Parse(txtPrevGPA.Text);
            student.Image = bImage;
            student.SchoolLastAttended = txtSchoolLastAttended.Text;
            student.GradeLevel = cmbGradeLevel.SelectedValue.ToString();
            student.DOB = dtDOB.Value;
            student.MadrasahEnrolled = chkMadrasah.Checked;
            student.Card = chkReportCard.Checked;
            student.GoodMoral = chkGoodMoral.Checked;
            student.Gender = szGender;
            student.BirthCertificate = chkBirthCertificate.Checked;
            student.POBAddress = txtPOB_Street.Text;
            student.POBBarangay = txtPOB_Brgy.Text;
            student.POBProvince = txtPOB_Province.Text;
            student.POBTownCity = txtPOB_Town.Text;
            student.HomeAddress = txtHA_Street.Text;
            student.HomeProvince = txtHA_Province.Text;
            student.HomeBarangay = txtHA_Brgy.Text;
            student.HomeTownCity = txtHA_Town.Text;
            student.FathersName = txtFather_FullName.Text;
            student.FathersOccupation = txtFather_Occupation.Text;
            student.FathersAverageYearlyIncome = double.Parse(txtFather_Income.Text);
            student.FathersEducation = txtFather_EducAttainment.Text;
            student.MothersMaidenName = txtMother_FullName.Text;
            student.MothersEducation = txtMother_EducAttainment.Text;
            student.MothersOccupation = txtMother_Occupation.Text;
            student.MothersAverageYearlyIncome = double.Parse(txtMother_Income.Text);
            student.GuardiansName = txtGuardian_FullName.Text;
            student.GuardiansOccupation = txtGuardian_Occupation.Text;
            student.GuardiansAverageYearlyIncome = double.Parse(txtGuardian_Income.Text);
            student.ScholarshipDiscountId = schoId;
            student.UnitsFailedLastYear = convertDecimal;
            student.DateAdmitted = System.DateTime.Now;
            student.Religion = cbReligion.Text;

            if (Op.Equals("edit"))
            {
                ret = studentService.UpdateStudent(ref student, ref message);
                Log("U", "Students", student);

            }
            else
            {
                ret = studentService.CreateStudent(ref student, ref message);
                Log("C", "Students", student);

            }
            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();
        }
Beispiel #4
0
        private void Save()
        {
            string szGender = string.Empty;

            if (cmbGender.Text == "Female")
            {
                szGender = "F";
            }
            if (cmbGender.Text == "Male")
            {
                szGender = "M";
            }
            Boolean ret     = false;
            string  message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null)
            {
                bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);
            }

            StudentServiceClient studentService = new StudentServiceClient();

            Student student = new Student()
            {
                StudentId          = txtStudentId.Text,
                FirstName          = txtFirstName.Text,
                MiddleName         = txtMiddleName.Text,
                LastName           = txtLastName.Text,
                Image              = bImage,
                SchoolLastAttended = txtSchoolLastAttended.Text,
                GradeLevel         = cmbGradeLevel.Text,
                DOB = dtDOB.Value,
                MadrasahEnrolled             = chkMadrasah.Checked,
                Card                         = chkReportCard.Checked,
                GoodMoral                    = chkGoodMoral.Checked,
                BirthCertificate             = chkBirthCertificate.Checked,
                POBAddress                   = txtPOB_Street.Text,
                POBBarangay                  = txtPOB_Brgy.Text,
                POBProvince                  = txtPOB_Province.Text,
                POBTownCity                  = txtPOB_Town.Text,
                HomeAddress                  = txtHA_Street.Text,
                HomeProvince                 = txtHA_Province.Text,
                HomeBarangay                 = txtHA_Brgy.Text,
                HomeTownCity                 = txtHA_Town.Text,
                FathersName                  = txtFather_FullName.Text,
                FathersOccupation            = txtFather_Occupation.Text,
                FathersAverageYearlyIncome   = double.Parse(txtFather_Income.Text),
                FathersEducation             = txtFather_EducAttainment.Text,
                MothersMaidenName            = txtMother_FullName.Text,
                MothersEducation             = txtMother_EducAttainment.Text,
                MothersOccupation            = txtMother_Occupation.Text,
                MothersAverageYearlyIncome   = double.Parse(txtMother_Income.Text),
                GuardiansName                = txtGuardian_FullName.Text,
                GuardiansOccupation          = txtGuardian_Occupation.Text,
                GuardiansAverageYearlyIncome = double.Parse(txtGuardian_Income.Text)
            };



            if (Op.Equals("edit"))
            {
                ret = studentService.UpdateStudent(ref student, ref message);
            }
            else
            {
                ret = studentService.CreateStudent(ref student, ref message);
            }

            if (ret)
            {
                MessageBox.Show("Saved Successfully");
            }
            else
            {
                MessageBox.Show("Error Saving");
            }

            Close();
        }