public ActionResult Filter(CountryMasterFilter objFilter, string submit) { try { if (submit.ToLower() == "filter") { objFilter.PageNumber = 1; //objFilter.Sort = ""; TempData["CountryFilter"] = objFilter; } else { TempData["CountryFilter"] = null; objFilter = new CountryMasterFilter(); } return(RedirectToAction("Index", new { pageNumber = objFilter.PageNumber })); } catch (Exception ex) { throw; } finally { } }
public ActionResult Index(CountryMasterFilter objFilter, int?pageNumber) { CountryMasterListVM empVM = null; try { objCountryBL = new CountryBL(); if (TempData["CountryFilter"] != null) { objFilter = (CountryMasterFilter)TempData["CountryFilter"]; objFilter.CountryID = 0; if (pageNumber != null) { if (pageNumber != 0) { objFilter.PageNumber = pageNumber ?? objFilter.PageNumber; } TempData.Keep("CountryFilter"); } } empVM = GetCountryListVM(objFilter); return(View("Index", empVM)); } catch (Exception ex) { throw; } finally { empVM = null; objCountryBL = null; } }
private CountryMasterListVM GetCountryListVM(CountryMasterFilter objFilter) { //Thread.Sleep(1000); //CountryMasterListVM userListVM = null; CommonBL objCommonBL = null; try { objCountryBL = new CountryBL(); objListVM = new CountryMasterListVM(); objCommonBL = new CommonBL(); objFilter.PagingRoute = new PagingRoute() { Action = "Index", Controller = "Country" }; objListVM.lstCountryMaster = objCountryBL.GetData(objFilter); objListVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 }); objListVM.QueryBO = objListVM.objFilter = objFilter; return(objListVM); } catch (Exception ex) { throw; } finally { objListVM = null; } }
public ActionResult Action(CountryMasterFilter objFilter, string submit) { CommonBL objCommonBL = null; CountryMaster objCountry = null; try { objDetailsVM = new CountryDetailsVM(); if (submit.ToLower() == "edit") { objCommonBL = new CommonBL(); TempData["CountryFilter"] = objFilter; objCountryBL = new CountryBL(); objDetailsVM = new CountryDetailsVM(); objDetailsVM.CntMstr = objCountryBL.GetData(new CountryMasterFilter() { CountryID = objFilter.CountryID }).FirstOrDefault(); // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 }); return(View("Details", objDetailsVM)); } else if (submit.ToLower() == "delete") { objCountryBL = new CountryBL(); objListVM = new CountryMasterListVM(); objCountry = new CountryMaster(objFilter.CountryID); objCountry.ModifiedBy = 1; objCountry.Remark = "Deleted"; objResponse = objCountryBL.SaveCountry(objCountry, "D"); objFilter.CountryID = 0; objListVM = GetCountryListVM(objFilter); objListVM.Toast = WebCommon.SetToast(objResponse); return(View("Index", objListVM)); } } catch (Exception ex) { throw; } finally { objCountryBL = null; objDetailsVM = null; objListVM = null; objCommonBL = null; } return(null); }
public void SetCountryFilter(CountryMasterFilter objFilter, bool prevFilter) { if (!prevFilter) { objFilter.Filter = ""; } if (objFilter.CountryID > 0) { objFilter.Filter += " and CM.CountryID ='" + objFilter.CountryID + "'"; } if (!string.IsNullOrEmpty(objFilter.CountryName)) { objFilter.Filter += " and ( CM.CountryName like '%" + objFilter.CountryName + "%')"; } if (objFilter.Status != 0) { objFilter.Filter += " and CM.Status ='" + objFilter.Status + "'"; } }
public List <CountryMaster> GetData(CountryMasterFilter objFilter, bool prevFilter = false) { CountryDAL objCntDAL = null; try { objCntDAL = new CountryDAL(); SetCountryFilter(objFilter, prevFilter); return(objCntDAL.Get(objFilter)); } catch (Exception ex) { throw; } finally { objCntDAL = null; } }