// GET: City
        public ActionResult Index(CityMasterFilter objFilter, int?pageNumber)
        {
            CityMasterListVM empVM = null;

            try
            {
                objCityBL = new CityBL();
                if (TempData["CityFilter"] != null)
                {
                    objFilter           = (CityMasterFilter)TempData["CityFilter"];
                    objFilter.CountryID = 0;
                    if (pageNumber != null)
                    {
                        if (pageNumber != 0)
                        {
                            objFilter.PageNumber = pageNumber ?? objFilter.PageNumber;
                        }
                        TempData.Keep("CityFilter");
                    }
                }
                empVM = GetCityListVM(objFilter);
                return(View("Index", empVM));
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                empVM     = null;
                objCityBL = null;
            }
        }
        private CityMasterListVM GetCityListVM(CityMasterFilter objFilter)
        {
            //Thread.Sleep(1000);
            //CountryMasterListVM userListVM = null;
            CommonBL objCommonBL = null;

            try
            {
                objCityBL             = new CityBL();
                objListVM             = new CityMasterListVM();
                objCommonBL           = new CommonBL();
                objFilter.PagingRoute = new PagingRoute()
                {
                    Action = "Index", Controller = "State"
                };
                objListVM.lstCityMaster = objCityBL.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(CityMasterFilter objFilter, string submit)
        {
            CommonBL   objCommonBL = null;
            CityMaster objCity     = null;

            try
            {
                objDetailsVM = new CityDetailsVM();
                if (submit.ToLower() == "edit")
                {
                    objCommonBL = new CommonBL();
                    TempData["CountryFilter"] = objFilter;
                    objCityBL             = new CityBL();
                    objDetailsVM          = new CityDetailsVM();
                    objDetailsVM.CityMstr = objCityBL.GetData(new CityMasterFilter()
                    {
                        CityID = objFilter.StateID
                    }).FirstOrDefault();
                    objDetailsVM.CntMst = Chikitsa.DataAccessLayer.StateDAL.GetCountry();
                    // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 });
                    return(View("Details", objDetailsVM));
                }
                else if (submit.ToLower() == "delete")
                {
                    objCityBL           = new CityBL();
                    objListVM           = new CityMasterListVM();
                    objCity             = new CityMaster(objFilter.StateID);
                    objCity.ModifiedBy  = 1;
                    objCity.Remark      = "Deleted";
                    objResponse         = objCityBL.SaveState(objCity, "D");
                    objFilter.CountryID = 0;
                    objListVM           = GetCityListVM(objFilter);
                    objListVM.Toast     = WebCommon.SetToast(objResponse);
                    return(View("Index", objListVM));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objCityBL    = null;
                objDetailsVM = null;
                objListVM    = null;
                objCommonBL  = null;
            }
            return(null);
        }
Exemple #4
0
 public void SetStateFilter(CityMasterFilter objFilter, bool prevFilter)
 {
     if (!prevFilter)
     {
         objFilter.Filter = "";
     }
     if (objFilter.StateID > 0)
     {
         objFilter.Filter += " and CM.CityID ='" + objFilter.CityID + "'";
     }
     if (!string.IsNullOrEmpty(objFilter.CityName))
     {
         objFilter.Filter += " and ( CM.CityName like '%" + objFilter.CityName + "%')";
     }
     if (objFilter.Status != 0)
     {
         objFilter.Filter += " and CM.Status ='" + objFilter.Status + "'";
     }
 }
Exemple #5
0
        public List <CityMaster> GetData(CityMasterFilter objFilter, bool prevFilter = false)
        {
            CityDAL objCityDAL = null;

            try
            {
                objCityDAL = new CityDAL();
                SetStateFilter(objFilter, prevFilter);
                return(objCityDAL.Get(objFilter));
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objCityDAL = null;
            }
        }