Esempio n. 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;
        }
Esempio n. 2
0
        private void frmStudentRegister_Load(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();

            RegisterStudent =registrationService.StudentInfoWithRank(StudentId,GradeLevel,Gender);
            SY = GlobalClass.currentsy;

            Discounts = new List<ScholarshipDiscount>(registrationService.GetScholarshipDiscounts());
            txtSY.Text = SY;
            txtPrevGradeLevel.Text = RegisterStudent.GradeLevel;
            txtStudentId.Text = RegisterStudent.StudentId;
            txtName.Text = RegisterStudent.LastName + "," + RegisterStudent.FirstName + " " + RegisterStudent.MiddleName;
            txtGpa.Text = RegisterStudent.Average.ToString();
            txtFailed.Text = RegisterStudent.UnitsFailedLastYear.ToString();
            txtranking.Text = RegisterStudent.ranking.ToString();
            decimal cri = 3.50M;

              if (RegisterStudent.UnitsFailedLastYear.CompareTo(0.0M) == 0)
            {
                chkRetain.Checked = false;
                chkPromote.Checked = true;
                chkIrreg.Checked = false;
                Promote();
                EnrolMe.Stat = "a";
            }
               else if (RegisterStudent.UnitsFailedLastYear.CompareTo(cri) > 0)
            {
                chkRetain.Checked = true;
                chkPromote.Checked = false;
                chkIrreg.Checked = false;
                EnrolMe.Stat = "c";
                GradeLevel = RegisterStudent.GradeLevel;
            }
            else if (RegisterStudent.UnitsFailedLastYear.CompareTo(cri) <= 0) {
                chkRetain.Checked = false ;
                chkPromote.Checked = false;
                chkIrreg.Checked = true;
                Promote();
                EnrolMe.Stat = "b";
            }

            cmbScholarship.DataSource = Discounts;
            cmbScholarship.ValueMember = "ScholarshipDiscountId";
            cmbScholarship.DisplayMember = "Scholarship";
            cmbScholarship.SelectedValue = RegisterStudent.ScholarshipDiscountId;
        }