public IActionResult Index() { try { string CurrentActiveUserId = HttpContext.Session.GetString("session_CurrentActiveUserId"); string CurrentActiveActorId = HttpContext.Session.GetString("session_currentActiveActorTab"); //[NOTE: 11=admin] if (!string.IsNullOrEmpty(CurrentActiveUserId) && (CurrentActiveActorId == "-1" || CurrentActiveActorId == "10" || CurrentActiveActorId == "11" || CurrentActiveActorId == "12" || CurrentActiveActorId == "13" || CurrentActiveActorId == "14")) { var p = _oeUsersServ.GetUserByID(Convert.ToInt64(HttpContext.Session.GetString("session_CurrentActiveUserId")), he.WebRootPath); var temp = new IndexUsersVM_Users() { Id = p.Users.Id, GenderId = p.Users.GenderId, IP300X200 = p.Users.IP300X200 }; var model = new IndexUsersVM() { users = temp }; return(View("Index/Index", model)); } else { return(RedirectToAction("Login", "Home", new { area = "" })); } } catch (Exception) { return(RedirectToAction("Login", "Home", new { area = "" })); } }
public async Task <IActionResult> SearchPaymentDetailById2() { try { var p = _oeUsersServ.GetUserByID(Convert.ToInt64(HttpContext.Session.GetString("session_CurrentActiveUserId")), he.WebRootPath); if (p != null) { var result = new SearchPaymentDetailById() { //StudentId = StudentId, RegistrationId = p.Users.RegistrationNo }; var searchPaymentById = await Task.Run(() => _StudentPaymentsServ.SearchPaymentDetailById2(result)); var list = new List <IndexPaymentDetailByIdVM_StudentPayments>(); ViewBag.ddlClasses = _classesServ.dropdown_Class(); ViewBag.ddlGenders = _GendersServ.Dropdown_Genders(); if (searchPaymentById._StudentPayments == null) { ViewBag.Message = "Need to insert all pre required items- Such as: Fee Types, Fee Structure"; var model = new IndexPaymentDetailByIdVM() { ClassId = searchPaymentById.ClassId, _StudentPayments = null, StudentId = 0, RegistrationId = p.Users.RegistrationNo, StudentSearchName = searchPaymentById.StudentSearchName }; return(View("SearchPaymentDetailById", model)); } else { foreach (var item in searchPaymentById._StudentPayments.ToList()) { var temp = new IndexPaymentDetailByIdVM_StudentPayments() { Id = item.Id, ClassId = item.ClassId, FeeYearDate = item.FeeYearDate, ClassName = item.ClassName, PaymentDate = item.PaymentDate, StudentId = item.StudentId, StudentName = item.StudentName, FeeTypeId = item.FeeTypeId, TermNo = item.TermNo, TermName = item.TermName, FeeType = item.FeeType, Amount = item.FeeAmount, Discount = item.Discount, Fine = item.Fine, PaidAmount = item.PaidAmount, Remarks = item.Remarks }; list.Add(temp); } ; var model = new IndexPaymentDetailByIdVM() { TotalFine = searchPaymentById.TotalFine, TotalPaid = searchPaymentById.TotalPaid, TotalHavetoPay = searchPaymentById.TotalHavetoPay, ClassId = searchPaymentById.ClassId, _StudentPayments = list, //StudentId = StudentId, RegistrationId = p.Users.RegistrationNo, StudentSearchName = searchPaymentById.StudentSearchName }; return(View("SearchPaymentDetailById2", model)); } } else { var model = new IndexPaymentDetailByIdVM() { TotalFine = 0, TotalPaid = 0, TotalHavetoPay = 0, ClassId = 0, _StudentPayments = null, //StudentId = StudentId, RegistrationId = "", StudentSearchName = "" }; return(View("SearchPaymentDetailById2", model)); } } catch { return(BadRequest()); } }