Beispiel #1
0
        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;
        }