public StudentListAndPaymentTypeInfo GetStudentListAndPaymentTypeInfoForPaymentList() { StudentListAndPaymentTypeInfo paymentDetailEntity = new StudentListAndPaymentTypeInfo(); List <StudentEntity> studentList = new StudentBusiness().Get_Student().Result.Where(o => o.IsStudent == true).ToList(); List <PaymentEntity> paymentEntityList = new PaymentBusiness().Get_PaymentForCurrentMonth().Result; foreach (PaymentEntity paymentEntity in paymentEntityList) { if (paymentEntity.StudentId != null) { int studentId = paymentEntity.StudentId.Value; StudentEntity first = studentList.FirstOrDefault(o => o.Id == studentId); if (first != null) { studentList.FirstOrDefault(o => o.Id == studentId).PaymentList.Add(paymentEntity); } } } paymentDetailEntity.StudentList = studentList; paymentDetailEntity.PaymentTypeList = new PaymentTypeBusiness().Get_PaymentType(new SearchEntity() { IsActive = true, IsDeleted = false }).Result; return(paymentDetailEntity); }
public StudentListAndPaymentTypeInfo GetStudentListAndPaymentTypeInfoForPaymentDetail(string decryptStudentId, string year) { StudentListAndPaymentTypeInfo info = new StudentListAndPaymentTypeInfo { PaymentTypeList = GetPaymentAllPaymentType() }; string id = Cipher.Decrypt(decryptStudentId); int idInt = GeneralFunctions.GetData <int>(id); if (idInt > 0) { StudentEntity studentEntity = new StudentBusiness().Get_Student().Result.FirstOrDefault(o => o.Id == idInt); if (studentEntity != null) { DataResultArgs <List <PaymentEntity> > paymentListResult = new PaymentBusiness().Get_Payment(idInt, year); if (!paymentListResult.HasError) { if (paymentListResult.Result.Any()) { studentEntity.PaymentList = paymentListResult.Result; } } info.StudentList.Add(studentEntity); } } return(info); }