Exemplo n.º 1
0
        public ActionResult GetStudentTransactionSub(int StudentId)
        {
            List <StudentTransactionSubVM> studentTransactionSubVMs = new List <StudentTransactionSubVM>();
            StudentLedgerBAL studentLedgerBAL = new StudentLedgerBAL();
            IQueryable <Entities.StudentLedger> studentLedgers = studentLedgerBAL.GetAll().Where(a => a.StudentId == StudentId).OrderBy(a => a.StudentLedgerId);

            if (studentLedgers != null && studentLedgers.Count() > 0)
            {
                IEnumerable <IGrouping <int, Entities.StudentLedger> > studentLedgersGroupByFeeId = studentLedgers.GroupBy(a => a.FeeHeadId);
                if (studentLedgersGroupByFeeId != null && studentLedgersGroupByFeeId.Count() > 0)
                {
                    foreach (IGrouping <int, Entities.StudentLedger> studentLedgersGroupItem in studentLedgersGroupByFeeId)
                    {
                        Entities.StudentLedger  studentLedger           = studentLedgersGroupItem.LastOrDefault();
                        StudentTransactionSubVM studentTransactionSubVM = new StudentTransactionSubVM();
                        studentTransactionSubVM.StudentTransactionSubId = 0;
                        studentTransactionSubVM.FeeHeadId = studentLedgersGroupItem.Key;
                        FeeHeadBAL feeHeadBAL = new FeeHeadBAL();
                        studentTransactionSubVM.FeeHeadName = feeHeadBAL.FindBy(f => f.FeeHeadId == studentLedgersGroupItem.Key).FirstOrDefault().FeeHeadName;
                        studentTransactionSubVM.Cr          = 0;
                        studentTransactionSubVM.Dr          = 0;
                        studentTransactionSubVM.Balance     = studentLedger.HeadBalance;
                        FeeHeadBAL balObject = new FeeHeadBAL();
                        studentTransactionSubVM.Fees = from obj in balObject.GetAll() select new SelectListItem()
                        {
                            Text = obj.FeeHeadName, Value = obj.FeeHeadId.ToString()
                        };
                        studentTransactionSubVMs.Add(studentTransactionSubVM);
                    }
                }
            }
            return(PartialView("_GetStudentTransactionSub", studentTransactionSubVMs));
        }
Exemplo n.º 2
0
        public ActionResult GetStudentTransactionSubDeails(int StudentId)
        {
            List <StudentTransactionSubVM> studentTransactionSubVMs = new List <StudentTransactionSubVM>();
            StudentLedgerBAL studentLedgerBAL = new StudentLedgerBAL();
            IQueryable <Entities.StudentLedger> studentLedgers = studentLedgerBAL.GetAll().Where(a => a.StudentId == StudentId).OrderBy(a => a.StudentLedgerId);

            if (studentLedgers != null && studentLedgers.Count() > 0)
            {
                IEnumerable <IGrouping <int, Entities.StudentLedger> > studentLedgersGroupByFeeId = studentLedgers.GroupBy(a => a.FeeHeadId);
                if (studentLedgersGroupByFeeId != null && studentLedgersGroupByFeeId.Count() > 0)
                {
                    foreach (IGrouping <int, Entities.StudentLedger> studentLedgersGroupItem in studentLedgersGroupByFeeId)
                    {
                        Entities.StudentLedger  studentLedger           = studentLedgersGroupItem.LastOrDefault();
                        StudentTransactionSubVM studentTransactionSubVM = new StudentTransactionSubVM();
                        studentTransactionSubVM.StudentTransactionSubId = 0;
                        studentTransactionSubVM.FeeHeadId = studentLedgersGroupItem.Key;
                        FeeHeadBAL feeHeadBAL = new FeeHeadBAL();
                        studentTransactionSubVM.FeeHeadName = feeHeadBAL.FindBy(f => f.FeeHeadId == studentLedgersGroupItem.Key).FirstOrDefault().FeeHeadName;
                        studentTransactionSubVM.Cr          = 0;
                        studentTransactionSubVM.Dr          = 0;
                        studentTransactionSubVM.Balance     = studentLedger.HeadBalance;
                        studentTransactionSubVMs.Add(studentTransactionSubVM);
                    }
                }
            }
            return(PartialView("_StudentTransactionSub", new GridModel <StudentTransactionSubVM> {
                Data = studentTransactionSubVMs
            }));
        }