private void frmControlSubjects_Load(object sender, EventArgs e) { RegistrationServiceClient registrationService = new RegistrationServiceClient(); string message = String.Empty; ControlStudent = registrationService.GetStudent(controlStudentId,ref message); StudentEnrollment enrStudent = new StudentEnrollment(); SY = GlobalClass.currentsy; enrStudent = registrationService.GetStudentEnrolled(controlStudentId,SY); EnrolMe.StudentSY = controlStudentId + SY; int prev =Int32.Parse(SY.Substring(0,4)); prev--; int sy = Int32.Parse(SY.Substring(5, 4)); sy--; string prevSY = prev.ToString() + "-" + sy.ToString(); string prevRecord = controlStudentId + prevSY; FailedSubjects = new List<StudentSubject>(registrationService.GetFailedSubjects(prevRecord)); StudentSubs = new List<StudentSubject>(registrationService.GetStudentSubjects(EnrolMe.StudentSY)); Schedules = new List<StudentSchedule>(registrationService.GetSubjectSchedules(SY)); if (StudentSubs.Count > 0) { ExistingSchedule = new List<StudentSchedule>(registrationService.GetStudentExistingSchedule(StudentSubs.ToArray(), SY)); } if (ExistingSchedule.Count > 0) { foreach (StudentSchedule ss in ExistingSchedule) { int index = Schedules.FindIndex(item => item.SubjectAssignments == ss.SubjectAssignments); Schedules.RemoveAt(index); //StudentSubject s = new StudentSubject() //{ // StudentSY = controlStudentId + SY, // SubjectCode = ss.SubjectCode, // SubjectAssignments = ss.SubjectAssignments, // StudentEnrSubCode = controlStudentId + SY + ss.SubjectCode, // LockFirst = false, // LockSecond = false, // LockThird = false, // LockFourth = false, // FirstPeriodicRating = 0.00, // SecondPeriodicRating = 0.00, // ThirdPeriodicRating = 0.00, // FourthPeriodicRating = 0.00 //}; //subjects.Add(s); } } gvAllSchedules.DataSource = Schedules; gvFail.DataSource = FailedSubjects; if (ControlStudent.UnitsFailedLastYear == 0 && StudentSubs.Count == 0) { int sectionCode = (int)enrStudent.GradeSectionCode; Schedule = new List<StudentSchedule>(registrationService.GetSubjectsOfSection(sectionCode, SY)); foreach (StudentSchedule sch in Schedule) { StudentSubject ss = new StudentSubject() { StudentSY = controlStudentId + SY, SubjectCode = sch.SubjectCode, SubjectAssignments = sch.SubjectAssignments, StudentEnrSubCode = controlStudentId + SY + sch.SubjectCode, LockFirst = false, LockSecond = false, LockThird = false, LockFourth = false, FirstPeriodicRating = 0.00, SecondPeriodicRating = 0.00, ThirdPeriodicRating = 0.00, FourthPeriodicRating = 0.00 }; subjects.Add(ss); } ControlSchedule = Schedule; GlobalClass.gvDatasource = 1; gvSchedule.DataSource = ControlSchedule; gvSchedule.ReadOnly = false; } else if (StudentSubs.Count > 0) { GlobalClass.gvDatasource = 2; ControlSchedule = ExistingSchedule; gvAllSchedules.ReadOnly = false; gvSchedule.ReadOnly = false; // btnSelect.Enabled = true; gvSchedule.DataSource = ControlSchedule; } else if (ControlStudent.UnitsFailedLastYear > 0) { GlobalClass.gvDatasource = 3; gvAllSchedules.ReadOnly = false; gvSchedule.ReadOnly = false; } txtSection.Text = ControlStudent.Section; txtSY.Text = SY; txtGradeLevel.Text = ControlStudent.GradeLevel; txtStudentId.Text = ControlStudent.StudentId; txtStudentName.Text = ControlStudent.LastName + "," + ControlStudent.FirstName + " " + ControlStudent.MiddleName; txtPrevGPA.Text = ControlStudent.Average.ToString(); txtUnitsFailed.Text = ControlStudent.UnitsFailedLastYear.ToString(); }
private void AssessStudent_Load(object sender, EventArgs e) { RegistrationServiceClient registrationService = new RegistrationServiceClient(); List<Fee> fees = new List<Fee>(); ScholarshipServiceClient scholarshipService = new ScholarshipServiceClient(); List<RegistrationServiceRef.ScholarshipDiscount> scholarships = new List<RegistrationServiceRef.ScholarshipDiscount>(); currentSY = registrationService.GetCurrentSY(); StudentAssessed = registrationService.GetStudentEnrolled(StudentId, currentSY.SY); txtGradeLevel.Text = StudentAssessed.GradeLevel; txtIDnum.Text = StudentAssessed.StudentId; txtName.Text = StudentAssessed.StudentName; txtSY.Text = currentSY.SY; //scholarshipDiscount = scholarshipService.GetAllScholarshipDiscount(StudentAssessed.DiscountId); //scholarshipDiscount = scholarshipService.GetAllScholarships(); fees = new List<Fee>(registrationService.GetStudentFees(StudentAssessed)); gvAssessment.DataSource = fees; fees.ToArray(); scholarships = new List<RegistrationServiceRef.ScholarshipDiscount>(registrationService.GetScholarshipDiscounts()); int scholarshipDiscountId = StudentAssessed.DiscountId; RegistrationServiceRef.ScholarshipDiscount sd = new RegistrationServiceRef.ScholarshipDiscount(); sd = scholarships.Find(v => v.ScholarshipDiscountId == scholarshipDiscountId); amountTuition = (double)fees[0].Amount; enrollment = (double)fees[1].Amount; // Read Only TextBox tuitionFee.ReadOnly = true; discountPercent.ReadOnly = true; totalTuitionFee.ReadOnly = true; enrollmentFee.ReadOnly = true; enrTotalTuitionFee.ReadOnly = true; subTotal.ReadOnly = true; discountbyAmountSubTotal.ReadOnly = true; Total.ReadOnly = true; // Total Tuition Fee tuitionFee.Text = amountTuition.ToString("0.###"); // Percent Discount double perc = 0; double percRound = 0; double percInitial = 0; perc = (double)sd.Discount; if (sd.Discount == null) { discountPercent.Enabled = false; } else { discountPercent.Text = perc.ToString("0.##"); percRound = perc / 100; if (percRound == 1) { percValue = amountTuition; fullPaymentDisc.ReadOnly = true; } else { percInitial = amountTuition * percRound; percValue = amountTuition - percInitial; } } /* Operations */ // Operation for Percent Discount if not null if (fullPaymentDisc != null) { finalPercentDisc = amountTuition - percValue - fullPaymentDiscount; } else { finalPercentDisc = amountTuition - percValue; } // Total Tuition Fee totalTuitionFee.Text = finalPercentDisc.ToString("0.##"); // Enrollment Fee enrollmentFee.Text = enrollment.ToString(); // Total Tuition Fee enrTotalTuitionFee.Text = finalPercentDisc.ToString("0.##"); // Sub Total subTotalValue = enrollment + finalPercentDisc; subTotal.Text = subTotalValue.ToString("0.##"); // Sub Total discountbyAmountSubTotal.Text = subTotalValue.ToString("0.##"); // Discount by Amount double discByAmout = 0; //discByAmout = discountByAmount // Para ma assess og ma save sa db //var assessments = registrationService.AssessMe(StudentAssessed); //gvAssessment.DataSource = assessments; }