public ActionResult AutoGetCityList(string query) { CityEntity _cityEntity = new CityEntity(); _cityEntity.CityDBEntity = new List<CityDBEntity>(); CityDBEntity cityDBEntity = new CityDBEntity(); cityDBEntity.Name_CN = query; //cityDBEntity.Name_CN = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Name_CN"].ToString())) ? null : ViewState["Name_CN"].ToString(); //cityDBEntity.OnlineStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OnlineStatus"].ToString())) ? null : ViewState["OnlineStatus"].ToString(); //cityDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString(); //cityDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString(); _cityEntity.CityDBEntity.Add(cityDBEntity); DataSet dsResult = CityInfoBP.CommonSelect(_cityEntity).QueryResult; query = query.Replace(" ", ""); if (query.Length > 1) { int op = query.LastIndexOf(","); query = query.Substring(op + 1); } ArrayList alCity = new ArrayList(); for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++ ) { alCity.Add(dsResult.Tables[0].Rows[i][0].ToString().Trim()); } //var list = JsonConvert.SerializeObject(dsResult.Tables[0], new DataTableConverter()); //var users = (from u in dsResult.Tables[0].Rows // where u.EmailAddress.Contains(query) // orderby u.EmailAddress // optional // select u.EmailAddress).Distinct().ToArray(); return Json(alCity, JsonRequestBehavior.AllowGet); }
public string AjxGetCityList(string citynm, string startdt, string enddt, string online) { //ViewBag CityEntity _cityEntity = new CityEntity(); _cityEntity.CityDBEntity = new List<CityDBEntity>(); CityDBEntity cityDBEntity = new CityDBEntity(); //cityDBEntity.Name_CN = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Name_CN"].ToString())) ? null : ViewState["Name_CN"].ToString(); //cityDBEntity.OnlineStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OnlineStatus"].ToString())) ? null : ViewState["OnlineStatus"].ToString(); //cityDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString(); //cityDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString(); _cityEntity.CityDBEntity.Add(cityDBEntity); System.Data.DataSet dsResult = CityInfoBP.Select(_cityEntity).QueryResult; using(var sw = new StringWriter()) { ViewData.Model = dsResult; var viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, "../Partial/_cityListInfo"); var viewContent = new ViewContext(ControllerContext, viewResult.View, ViewData, TempData, sw); viewResult.View.Render(viewContent, sw); return sw.GetStringBuilder().ToString(); } }
// // GET: /City/ public ActionResult Index() { ViewBag.Message = "Your City page."; //_cityEntity.LogMessages = new HotelVp.Common.Logger.LogMessage(); //_cityEntity.LogMessages.Userid = UserSession.Current.UserAccount; //_cityEntity.LogMessages.Username = UserSession.Current.UserDspName; //_cityEntity.LogMessages.IpAddress = UserSession.Current.UserIP; CityEntity _cityEntity = new CityEntity(); _cityEntity.CityDBEntity = new List<CityDBEntity>(); CityDBEntity cityDBEntity = new CityDBEntity(); //cityDBEntity.Name_CN = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Name_CN"].ToString())) ? null : ViewState["Name_CN"].ToString(); //cityDBEntity.OnlineStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OnlineStatus"].ToString())) ? null : ViewState["OnlineStatus"].ToString(); //cityDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString(); //cityDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString(); _cityEntity.CityDBEntity.Add(cityDBEntity); ViewBag.CityList = CityInfoBP.Select(_cityEntity).QueryResult; return View(); }
public string GetCityList(string citynm, string startdt, string enddt, string online) { //ViewBag //System.Threading.Thread.Sleep(5000); CityEntity _cityEntity = new CityEntity(); _cityEntity.CityDBEntity = new List<CityDBEntity>(); CityDBEntity cityDBEntity = new CityDBEntity(); //cityDBEntity.Name_CN = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Name_CN"].ToString())) ? null : ViewState["Name_CN"].ToString(); //cityDBEntity.OnlineStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OnlineStatus"].ToString())) ? null : ViewState["OnlineStatus"].ToString(); //cityDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString(); //cityDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString(); _cityEntity.CityDBEntity.Add(cityDBEntity); System.Data.DataSet dsResult = CityInfoBP.Select(_cityEntity).QueryResult; var list = JsonConvert.SerializeObject(dsResult.Tables[0], new DataTableConverter()); return list; }