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 })); }
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)); }
public ActionResult StudentLedger() { StudentLedgerBAL studentLedgerBAL = new StudentLedgerBAL(); IQueryable <Entities.StudentLedger> entities = studentLedgerBAL.GetAll(); FeeHeadBAL feeHeadBAL = new FeeHeadBAL(); IQueryable <Entities.FeeHead> feeHeads = feeHeadBAL.GetAll(); List <StudentLedgerVM> studentLedgerVMs = new List <StudentLedgerVM>(); foreach (Entities.StudentLedger entity in entities) { StudentLedgerVM studentLedgerVM = new StudentLedgerVM(); studentLedgerVM.StudentLedgerId = entity.StudentLedgerId; studentLedgerVM.StudentId = entity.StudentId; StudentBAL studentObject = new StudentBAL(); Entities.Student student = studentObject.FindBy(s => s.StudentId == entity.StudentId).FirstOrDefault(); if (student != null) { studentLedgerVM.StudentFullNameWithTitle = string.Concat(student.Title, " ", student.FirstName, " ", student.MiddleName, " ", student.LastName).Trim(); } studentLedgerVM.TransactionDate = entity.TransactionDate; studentLedgerVM.FeeHeadId = entity.FeeHeadId; studentLedgerVM.FeeHeadName = feeHeads.Where(fh => fh.FeeHeadId == entity.FeeHeadId).FirstOrDefault().FeeHeadName; studentLedgerVM.Cr = entity.Cr; studentLedgerVM.Dr = entity.Dr; studentLedgerVM.HeadBalance = entity.HeadBalance; studentLedgerVM.Balance = entity.Balance; studentLedgerVM.ReceiptNo = entity.ReceiptNo; studentLedgerVM.BankName = entity.BankName; studentLedgerVM.ChequeNumber = entity.ChequeNumber; studentLedgerVM.Status = entity.Status; studentLedgerVM.Remark = entity.Remark; //studentLedgerVM.CreatedBy = Convert.ToInt32(dr["CreatedBy"]); //studentLedgerVM.CreatedDate = Convert.ToDateTime(dr["CreatedDate"]); //studentLedgerVM.ModifiedBy = Convert.ToInt32(dr["ModifiedBy"]); //studentLedgerVM.ModifiedDate = Convert.ToDateTime(dr["ModifiedDate"]); studentLedgerVMs.Add(studentLedgerVM); } return(View(new GridModel <StudentLedgerVM> { Data = studentLedgerVMs })); }