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(); }