public ActionResult DisplayInfo(string t, string p) { IdxInfoSearchModels infoList = new IdxInfoSearchModels(); if (!StringUtils.IsEmpty(t)) { infoList.infoTypeCode = StringUtils.base64Decode(t); } int pageIndex = 0; if (Int32.TryParse(p, out pageIndex)) { infoList.pageIndex = pageIndex; } else { infoList.pageIndex = 0; } MstInfoTypeDAO infoTypeDAO = new MstInfoTypeDAO(this.mapper); IList<MstInfoTypeModels> infoTypeModelsList = infoTypeDAO.GeInfoType(infoList.infoTypeCode, null); if (infoTypeModelsList == null || infoTypeModelsList.Count == 0) { infoList.errorMessage = Resource.MsgErrNoDataFound; return View(infoList); } infoList.infoTypeName = infoTypeModelsList[0].infoTypeName; IdxInfoDAO infoDAO = new IdxInfoDAO(this.mapper); infoList = infoDAO.searchIdxInfo(infoList); return View(infoList); }
public IdxInfoSearchModels searchIdxInfo(IdxInfoSearchModels model) { Dictionary<string, object> param = new Dictionary<string, object>(); param.Add("infoStatus", Constants.Status.Active); if (!StringUtils.IsEmpty(model.infoCode)) { param.Add("infoCode", model.infoCode); } if (!StringUtils.IsEmpty(model.infoTypeCode)) { param.Add("infoTypeCode", model.infoTypeCode); } if (!StringUtils.IsEmpty(model.infoCodeLike)) { param.Add("infoCodeLike", model.infoCodeLike); } if (!StringUtils.IsEmpty(model.fromPostedDate)) { param.Add("fromPostedDate", DateTime.ParseExact(model.fromPostedDate, Constants.DateTimeFormat, null)); } if (!StringUtils.IsEmpty(model.toPostedDate)) { param.Add("toPostedDate", DateTime.ParseExact(model.toPostedDate, Constants.DateTimeFormat, null)); } int maxItemPerPage = Constants.MaxItemPerPage; param.Add("max", model.pageIndex * maxItemPerPage); param.Add("offset", (model.pageIndex - 1) * maxItemPerPage + 1); model.infoList = mapper.QueryForList<IdxInfoModels>("Idx.selectIdxInfo", param); model.recordCount = mapper.QueryForObject<int>("Idx.selectCountIdxInfo", param); return model; }
public ActionResult Search(IdxInfoSearchModels infoList) { MstInfoTypeModels allType = new MstInfoTypeModels(); infoList.infoTypeList = this.initTypeList(); infoList.infoTypeList.Insert(0, allType); IdxInfoDAO infoDAO = new IdxInfoDAO(this.mapper); infoList = infoDAO.searchIdxInfo(infoList); return View("Index", infoList); }