public ActionResult GenerateReportFees(int id)
        {
            DBSmartSchoolWebPortalEntities111 db = new DBSmartSchoolWebPortalEntities111();
            var student = db.Students.Where(x => x.Id == id).First();
            var fees    = db.StudentFees.Where(x => x.StudentId == id).ToList();
            List <StudentFeeViewModel> PassList = new List <StudentFeeViewModel>();

            foreach (var i in fees)
            {
                StudentFeeViewModel sf = new StudentFeeViewModel();
                sf.Amount = Convert.ToInt32(i.Amount);
                sf.Date   = Convert.ToDateTime(i.Date);
                sf.Status = i.Status;
                sf.Id     = i.Id;
                PassList.Add(sf);
            }

            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "CrystalReportFees.rpt"));
            rd.SetDataSource(PassList);
            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();
            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return(File(stream, "application/pdf", "FeesList.pdf"));
            }
            catch
            {
                throw;
            }
        }
        // StudentFeeViewModel feeModel = new StudentFeeViewModel();
        //
        // GET: /StudentFees/
        // [DynamicAuthorize]
        //  public ActionResult Index(string name = "NURSERY 1", string term = "1")
        public ActionResult Index(string theFeeTypes, string term)
        {
            //List<Level> theLevels = work.LevelRepository.Get().ToList();
            //List<SelectListItem> theItem = new List<SelectListItem>();


            List <SchoolFeesType> theFeeType     = work.SchoolFeesTypeRepository.Get().ToList();
            List <SelectListItem> theItemFeeType = new List <SelectListItem>();

            foreach (var t in theFeeType)
            {
                theItemFeeType.Add(new SelectListItem()
                {
                    Text = t.SchoolFeesKind, Value = t.SchoolFeesKind
                });
            }
            ViewData["theFeeType"] = theFeeType;


            var fees = work.StudentFeesRepository.Get();

            //select s;
            if (String.IsNullOrEmpty(theFeeTypes) && String.IsNullOrEmpty(term))
            {
                //SchoolFeesType sft =  work.SchoolFeesTypeRepository.Get(a => a.SchoolFeesKind == "theFeeTypes").First();
                fees = fees.Where(s => s.SchoolFeesTypeID == 0);
            }

            if (!String.IsNullOrEmpty(theFeeTypes))
            {
                SchoolFeesType sft = work.SchoolFeesTypeRepository.Get(a => a.SchoolFeesKind == "theFeeTypes").First();
                fees = fees.Where(s => s.SchoolFeesTypeID == sft.SchoolFeesTypeID);
            }
            if (!String.IsNullOrEmpty(term))
            {
                fees = fees.Where(s => s.Term == term);
            }

            var viewModel = new StudentFeeViewModel();

            //  List<StudentFees>  theFees =  work.StudentFeesRepository.Get(a=>a.Level.Equals(name)).OrderBy(a=>a.Level).ToList();

            //if (name != "")
            //{
            // viewModel.Level = name;
            viewModel.StudentFees = fees.ToList();
            // }

            //foreach(var fee in theFees)
            //{
            //    viewModel.
            //}
            return(View(viewModel));
        }
Exemple #3
0
        public ActionResult SAnnualStatus()
        {
            DBSmartSchoolWebPortalEntities111 db = new DBSmartSchoolWebPortalEntities111();
            var fees = db.StudentFees.Where(x => x.StudentId == LoginClass.LoginId).ToList();
            List <StudentFeeViewModel> PassList = new List <StudentFeeViewModel>();

            foreach (var i in fees)
            {
                StudentFeeViewModel sf = new StudentFeeViewModel();
                sf.Amount = Convert.ToInt32(i.Amount);
                sf.Date   = Convert.ToDateTime(i.Date);
                sf.Status = i.Status;
                sf.Id     = i.Id;
                PassList.Add(sf);
            }

            return(View(PassList));
        }
        public ActionResult AddFee(StudentFeeViewModel collection)
        {
            DBSmartSchoolWebPortalEntities111 db = new DBSmartSchoolWebPortalEntities111();
            var        student = db.Students.Where(x => x.RegisterationNumber == collection.StudentId).First();
            StudentFee fee     = new StudentFee();

            fee.StudentId = student.Id;
            fee.Amount    = collection.Amount;
            fee.Date      = collection.Date;
            fee.Status    = "UnPaid";

            db.StudentFees.Add(fee);
            db.SaveChanges();

            string message = "Student fee Added!";

            return(RedirectToAction("Account", "Management", new { Message = message }));
        }
        public ActionResult ViewFees(int id)
        {
            DBSmartSchoolWebPortalEntities111 db = new DBSmartSchoolWebPortalEntities111();
            var student = db.Students.Where(x => x.Id == id).First();
            var fees    = db.StudentFees.Where(x => x.StudentId == id).ToList();
            List <StudentFeeViewModel> PassList = new List <StudentFeeViewModel>();

            foreach (var i in fees)
            {
                StudentFeeViewModel sf = new StudentFeeViewModel();
                sf.Amount = Convert.ToInt32(i.Amount);
                sf.Date   = Convert.ToDateTime(i.Date);
                sf.Status = i.Status;
                sf.Id     = i.Id;
                PassList.Add(sf);
            }
            ViewBag.Name = student.Name;
            return(View(PassList));
        }