public JsonResult LoadDDLCityData(DDLCityDBModel _dbModel)
        {
            objList = new AdminList();
            List <DDLCityDBModel> _dbModelList = new List <DDLCityDBModel>();

            _dbModelList = objList.LoadDDLCityData(_dbModel);
            return(this.Json(_dbModelList, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public List <DDLCityDBModel> LoadDDLCityData(DDLCityDBModel _dbModel)
        {
            List <DDLCityDBModel> _modelList = new List <DDLCityDBModel>();
            SqlConnection         conn       = new SqlConnection(DBConnection.GetConnection());

            conn.Open();
            SqlCommand     dAd = new SqlCommand("SP_SET_TBL_ADMIN", conn);
            SqlDataAdapter sda = new SqlDataAdapter(dAd);

            dAd.CommandType = CommandType.StoredProcedure;
            dAd.Parameters.AddWithValue("@CountryID", _dbModel.CountryID);
            dAd.Parameters.AddWithValue("@QryOption", 7);
            DataTable dt = new DataTable();

            try
            {
                sda.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    _modelList = (from DataRow row in dt.Rows
                                  select new DDLCityDBModel
                    {
                        Code = row["Code"].ToString(),
                        Value = row["Value"].ToString(),
                    }).ToList();
                }
                return(_modelList);
            }
            catch (Exception ex)
            {
                //UtilityOptions.ErrorLog(ex.ToString(), MethodBase.GetCurrentMethod().Name);
                throw ex;
            }
            finally
            {
                dt.Dispose();
                dAd.Dispose();
                conn.Close();
                conn.Dispose();
            }
        }