public ActionResult Edit(int id) { if (!_permissionService.Authorize("ManageFeeCategory")) { return(AccessDeniedView()); } if (id == 0) { throw new ArgumentNullException("id"); } var model = new FeeDetailModel(); var objFeeDetail = _smsService.GetFeeDetailById(id); if (objFeeDetail != null) { model = objFeeDetail.ToModel(); } model.AvailableAcadmicYears = _smsService.GetAllAcadmicYears().Select(x => new SelectListItem() { Text = x.Name.Trim(), Value = x.Id.ToString(), Selected = model.AcadmicYearId > 0 ? model.AcadmicYearId == x.Id : false }).ToList(); model.AvailableEmployees = _smsService.GetAllEmployees().Select(x => new SelectListItem() { Text = x.EmpFName.Trim() + (!string.IsNullOrEmpty(x.EmpMName) ? (" " + x.EmpMName) : "") + (!string.IsNullOrEmpty(x.EmpLName) ? (" " + x.EmpLName) : "") + ("(" + x.Username + ")"), Value = x.Id.ToString(), Selected = model.CashierId > 0 ? model.CashierId == x.Id : false }).ToList(); model.AvailableStudents = _smsService.GetAllStudents().Select(x => new SelectListItem() { Text = x.FName.Trim() + (!string.IsNullOrEmpty(x.MName) ? (" " + x.MName) : "") + (!string.IsNullOrEmpty(x.LName) ? (" " + x.LName) : "") + ("(" + x.UserName + ")"), Value = x.Id.ToString(), Selected = model.StudentId == x.Id }).ToList(); model.AvailableStatuses = (from FeeStatus d in Enum.GetValues(typeof(FeeStatus)) select new SelectListItem { Text = EnumExtensions.GetDescriptionByValue <FeeStatus>(Convert.ToInt32(d)), Value = Convert.ToInt32(d).ToString(), Selected = (Convert.ToInt32(d) == model.StatusId) }).ToList(); model.AvailableFeeCategoryStructures = _smsService.GetAllFeeCategories().Select(x => new SelectListItem() { Text = x.CategoryName.Trim() + " (" + x.ClassDivision.Class.Name + " " + x.ClassDivision.Division.Name + ")", Value = x.Id.ToString(), Selected = model.FeeCategoryStructureId > 0 && model.FeeCategoryStructureId == x.Id }).OrderBy(x => x.Text).ToList(); return(View(model)); }
public ActionResult List() { if (!_permissionService.Authorize("ManageFeeCategory")) { return(AccessDeniedView()); } var model = new FeeDetailModel(); return(View(model)); }
public ActionResult Create() { if (!_permissionService.Authorize("ManageFeeCategory")) { return(AccessDeniedView()); } var model = new FeeDetailModel(); model.AvailableAcadmicYears = _smsService.GetAllAcadmicYears().Select(x => new SelectListItem() { Text = x.Name.Trim(), Value = x.Id.ToString(), Selected = x.IsActive }).ToList(); model.AvailableEmployees = _smsService.GetAllEmployees().Select(x => new SelectListItem() { Text = x.EmpFName.Trim() + (!string.IsNullOrEmpty(x.EmpMName) ? (" " + x.EmpMName) : "") + (!string.IsNullOrEmpty(x.EmpLName) ? (" " + x.EmpLName) : "") + ("(" + x.Username + ")"), Value = x.Id.ToString(), }).ToList(); model.AvailableStudents = _smsService.GetAllStudents().Select(x => new SelectListItem() { Text = x.FName.Trim() + (!string.IsNullOrEmpty(x.MName) ? (" " + x.MName) : "") + (!string.IsNullOrEmpty(x.LName) ? (" " + x.LName) : "") + ("(" + x.UserName + ")"), Value = x.Id.ToString(), }).ToList(); model.AvailableStatuses = (from FeeStatus d in Enum.GetValues(typeof(FeeStatus)) select new SelectListItem { Text = EnumExtensions.GetDescriptionByValue <FeeStatus>(Convert.ToInt32(d)), Value = Convert.ToInt32(d).ToString(), }).ToList(); model.AvailableFeeCategoryStructures = _smsService.GetAllFeeCategories().Select(x => new SelectListItem() { Text = x.CategoryName.Trim() + " (" + x.ClassDivision.Class.Name + " " + x.ClassDivision.Division.Name + ")", Value = x.Id.ToString(), }).OrderBy(x => x.Text).ToList(); return(View(model)); }
public BaseResponse <FeeDetailModel> SaveFeeDetail(FeeDetailModel request) { return(base.Save <DC_FeeDetail, FeeDetailModel>(request, (q) => q.FeeDetailID == request.FeeDetailID)); }
public IHttpActionResult Post(FeeDetailModel baseRequest) { var response = service.SaveFeeDetail(baseRequest); return(Ok(response)); }
public ActionResult Create(FeeDetailModel model, bool continueEditing) { if (!_permissionService.Authorize("ManageFeeCategory")) { return(AccessDeniedView()); } if (ModelState.IsValid) { var objFeeDetail = model.ToEntity(); objFeeDetail.CreatedOn = objFeeDetail.ModifiedOn = DateTime.Now; objFeeDetail.UserId = _userContext.CurrentUser.Id; objFeeDetail.CashierName = _smsService.GetEmployeeById(model.CashierId).EmpFName + "(" + _smsService.GetEmployeeById(model.CashierId).Username + ")"; _smsService.InsertFeeDetail(objFeeDetail); SuccessNotification("Fee Detail created successfully."); if (continueEditing) { return(RedirectToAction("Edit", new { id = objFeeDetail.Id })); } } else { model.AvailableAcadmicYears = _smsService.GetAllAcadmicYears().Select(x => new SelectListItem() { Text = x.Name.Trim(), Value = x.Id.ToString(), Selected = model.AcadmicYearId > 0 ? model.AcadmicYearId == x.Id : false }).ToList(); model.AvailableEmployees = _smsService.GetAllEmployees().Select(x => new SelectListItem() { Text = x.EmpFName.Trim() + (!string.IsNullOrEmpty(x.EmpMName) ? (" " + x.EmpMName) : "") + (!string.IsNullOrEmpty(x.EmpLName) ? (" " + x.EmpLName) : "") + ("(" + x.Username + ")"), Value = x.Id.ToString(), Selected = model.CashierId > 0 ? model.CashierId == x.Id : false }).ToList(); model.AvailableStudents = _smsService.GetAllStudents().Select(x => new SelectListItem() { Text = x.FName.Trim() + (!string.IsNullOrEmpty(x.MName) ? (" " + x.MName) : "") + (!string.IsNullOrEmpty(x.LName) ? (" " + x.LName) : "") + ("(" + x.UserName + ")"), Value = x.Id.ToString(), Selected = model.StudentId == x.Id }).ToList(); model.AvailableStatuses = (from FeeStatus d in Enum.GetValues(typeof(FeeStatus)) select new SelectListItem { Text = EnumExtensions.GetDescriptionByValue <FeeStatus>(Convert.ToInt32(d)), Value = Convert.ToInt32(d).ToString(), Selected = (Convert.ToInt32(d) == model.StatusId) }).ToList(); model.AvailableFeeCategoryStructures = _smsService.GetAllFeeCategories().Select(x => new SelectListItem() { Text = x.CategoryName.Trim() + " (" + x.ClassDivision.Class.Name + " " + x.ClassDivision.Division.Name + ")", Value = x.Id.ToString(), Selected = model.FeeCategoryStructureId > 0 && model.FeeCategoryStructureId == x.Id }).OrderBy(x => x.Text).ToList(); return(View(model)); } return(RedirectToAction("List")); }
public static FeeDetail ToEntity(this FeeDetailModel model, FeeDetail destination) { return(model.MapTo(destination)); }
public static FeeDetail ToEntity(this FeeDetailModel model) { return(model.MapTo <FeeDetailModel, FeeDetail>()); }