示例#1
0
        public FeesViewModel GetFeeDetails(int id)
        {
            try
            {
                Fees fees = _context.Fees
                            .Where(x => x.FeeId == id)
                            .Include(x => x.Student)
                            .FirstOrDefault();

                FeesViewModel model = new FeesViewModel
                {
                    FeeID            = fees.FeeId,
                    FeeAmount        = fees.FeeAmount,
                    IsOwing          = fees.IsOwing,
                    AmountPaid       = fees.AmountPaid,
                    AmountOwing      = fees.AmountOwing,
                    StudentID        = fees.StudentId,
                    FullName         = fees.Student.FullName,
                    StudentIndexList = new SelectList(_studentService.GetStudents(), "StudentID", "FullName", fees.FeeId)
                };

                return(model);
            }
            catch (Exception)
            {
                FeesViewModel emptyModel = new FeesViewModel();
                return(emptyModel);
            }
        }
示例#2
0
        private FeesViewModel Format(Course crs)
        {
            var model = new FeesViewModel()
            {
                Accomodation = crs.FeeStructures.Sum(x => x.Accomodation),
                Internet     = crs.FeeStructures.Sum(x => x.Internet),
                Library      = crs.FeeStructures.Sum(x => x.Library),
                Medical      = crs.FeeStructures.Sum(x => x.Medical),
                Project      = crs.FeeStructures.Sum(x => x.Project),
                Trip         = crs.FeeStructures.Sum(x => x.Trip),
                Course       = crs.Name
            };

            switch (_selection)
            {
            case SelectionType.Regular:
                model.Tuition = crs.FeeStructures
                                .Sum(x => x
                                     .PerUnit * crs.Units
                                     .Count(u => u.Level == x.Year && u.Semester == x.Semester));
                break;

            case SelectionType.Parallel:
                model.Tuition = crs.FeeStructures
                                .Sum(x => x
                                     .ParallelPerUnit * crs.Units
                                     .Count(u => u.Level == x.Year && u.Semester == x.Semester));
                break;

            default:
                break;
            }

            return(model);
        }
示例#3
0
        private FeesViewModel ToFormatOne(Course course)
        {
            int sems = course.Years * 2;

            var model = new FeesViewModel()
            {
                Accomodation = BaseFee.Accomodation * sems,
                Internet     = BaseFee.Internet * sems,
                Library      = BaseFee.Library * sems,
                Medical      = BaseFee.Medical * sems,
                Project      = BaseFee.Project,
                Trip         = BaseFee.Trip * 2,
                Course       = course.Name
            };

            switch (_selection)
            {
            case SelectionType.Regular:
                model.Tuition = BaseFee.PerUnit * course.Units.Count;
                break;

            case SelectionType.Parallel:
                model.Tuition = BaseFee.ParallelPerUnit * course.Units.Count;
                break;

            default:
                break;
            }

            return(model);
        }
示例#4
0
        public FeesViewModel Create()
        {
            FeesViewModel model = new FeesViewModel();

            model.StudentIndexList = new SelectList(_studentService.GetStudents(), "StudentID", "FullName");

            return(model);
        }
示例#5
0
 public ActionResult Create(FeesViewModel model)
 {
     try
     {
         bool result = _feesService.AddFees(model);
         if (result)
         {
             return(RedirectToAction(nameof(Index)));
         }
         throw new Exception();
     }
     catch
     {
         ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
         return(View());
     }
 }
        public ActionResult Delete(int id, FeesViewModel model)
        {
            try
            {
                bool result = _feesClear.DeleteFees(id);

                if (result)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                throw new Exception();
            }
            catch
            {
                ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
                return(View());
            }
        }
示例#7
0
        public bool AddFees(FeesViewModel model)
        {
            try
            {
                Fees fees = new Fees
                {
                    FeeId       = model.FeeID,
                    FeeAmount   = model.FeeAmount,
                    IsOwing     = model.IsOwing,
                    AmountPaid  = model.AmountPaid,
                    AmountOwing = model.AmountOwing,
                    StudentId   = model.StudentID
                };

                _context.Fees.Add(fees);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#8
0
        public bool UpdateFees(FeesViewModel model)
        {
            try
            {
                Fees fees = _context.Fees.Where(x => x.FeeId == model.FeeID).FirstOrDefault();
                fees.FeeId       = model.FeeID;
                fees.FeeAmount   = model.FeeAmount;
                fees.IsOwing     = model.IsOwing;
                fees.AmountPaid  = model.AmountPaid;
                fees.AmountOwing = model.AmountOwing;
                fees.StudentId   = model.StudentID;



                _context.Fees.Update(fees);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
		public AppraisalCompanyFeesViewModel()
		{
			Fees = new FeesViewModel();
		}
示例#10
0
		public AppraiserUserFeesViewModel()
		{
			Fees = new FeesViewModel();
		}