protected void LoadCity() { DataTable CityDataTable = null; try { CityDataTable = CityBLL.GetCityByCountry(uoDropDownListCountryPerRegion.SelectedValue, uoTextBoxCity.Text, uoDropDownListLetters.SelectedValue); uoDropDownListCity.Items.Clear(); ListItem item = new ListItem("--Select City--", "0"); uoDropDownListCity.Items.Add(item); uoDropDownListCity.DataSource = CityDataTable; uoDropDownListCity.DataTextField = "colCityNameVarchar"; uoDropDownListCity.DataValueField = "colCityIDInt"; uoDropDownListCity.DataBind(); } catch (Exception ex) { throw ex; } finally { if (CityDataTable != null) { CityDataTable.Dispose(); } } }
public bool BLLIsExistCityName(CityBLL ct) { bool flag = false; flag = cityDALObj.DALIsExistCityName(ct); return(flag); }
public int DALInsertCity(CityBLL ct) { using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"])) { try { SqlParameter[] par = new SqlParameter[4]; par[0] = new SqlParameter("@cityName", ct.cityName); par[1] = new SqlParameter("@distId", ct.distId); par[2] = new SqlParameter("@stateId", ct.stateId); par[3] = new SqlParameter("@Status", 11); par[3].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "spCityInsert", par); status = (int)par[3].Value; } catch (SqlException ex) { throw ex; } finally { con.Close(); } } return(status); }
public bool DALIsExistCityName(CityBLL ct) { bool flag = false; string row = ""; using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"])) { try { SqlParameter[] par = new SqlParameter[2]; par[0] = new SqlParameter("@cityName", ct.cityName); par[1] = new SqlParameter("@Status", 100); par[1].Direction = ParameterDirection.Output; row = Convert.ToString(SqlHelper.ExecuteScalar(con, CommandType.StoredProcedure, "spCityNameIsExist", par)); } catch (SqlException ex) { throw ex; } finally { con.Close(); } if (row != "") { flag = true; } return(flag); } }
public ActionResult ViewCity(int id = 0, int pid = 0) { CustomMethods.ValidateRoles("City"); if (!Convert.ToBoolean(Session["Add"]) && !Convert.ToBoolean(Session["Edit"])) { return(View("ErrorPage", "Error")); } CityModel city = new CityModel(); int take = 10; int skip = take * pid; city.PageID = pid; city.Current = pid + 1; ViewBag.c = city.PageID; if (id != 0) { var objcity = new CityBLL { }.GetSubCityById(id); if (objcity != null) { city.CityId = objcity.CityId; city.CityName = objcity.CityName; city.StateName = objcity.StateName; city.IsActive = Convert.ToBoolean(objcity.IsActive); } } return(View(city)); }
public ActionResult GetAllMetadata(string id) { CityBLL m_BLL = new CityBLL(); IQueryable <City> rows = m_BLL.GetAllMetadata(id); if (rows.Any()) {//是否可以省 return(Json(new treegrid { rows = rows.Select(s => new { Cit_Id = s.Cit_Id , Name = s.Name , State = s.State , CreateTime = s.CreateTime , CreatePerson = s.CreatePerson , UpdateTime = s.UpdateTime , UpdatePerson = s.UpdatePerson , Vertion = s.Vertion , Remark = s.Remark , Id = s.Id } ).OrderBy(o => o.Id) })); } return(Content("[]")); }
public AddReserveForm() { InitializeComponent(); _city = new City(); _cityBLL = new CityBLL(); _town = new Town(); _townBLL = new TownBLL(); _clinic = new Clinic(); _clinicBLL = new ClinicBLL(); _hospital = new Hospital(); _hospitalBLL = new HospitalBLL(); _policlinic = new Policlinic(); _policlinicBLL = new PolicilinicBLL(); _doctor = new Doctor(); _doctorBLL = new DoctorBLL(); _reserve = new Reserve(); _reserveBLL = new ReverseBLL(); _user = new User(); _userBLL = new UserBLL(); }
/// <summary> /// Date Created: 29/07/2011 /// Created By: Gabriel Oquialda /// (description) Loads vendor city to dropdownlist /// =============================================== /// Date Modified: 24/01/2012 /// Modified By: Josephine Gad /// (description) Replace CityListbyCountry with GetCityByCountry /// </summary> private void vendorCityLoad(int vendorCountryId) { DataTable dt = null; try { //dt = CityBLL.CityListbyCountry(vendorCountryId); dt = CityBLL.GetCityByCountry(vendorCountryId.ToString(), uoTextBoxCityName.Text.Trim(), "0"); if (dt.Rows.Count > 0) { uoDropDownListCity.DataSource = dt; uoDropDownListCity.DataTextField = "colCityNameVarchar"; uoDropDownListCity.DataValueField = "colCityIDInt"; uoDropDownListCity.DataBind(); uoDropDownListCity.Items.Insert(0, new ListItem("--Select City--", "0")); } else { uoDropDownListCity.DataBind(); uoDropDownListCity.Items.Insert(0, new ListItem("--Select City--", "0")); } } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } }
public ActionResult AddEditCity(int id = 0, int pid = 0) { CustomMethods.ValidateRoles("City"); if (!Convert.ToBoolean(Session["IsAdd"]) && !Convert.ToBoolean(Session["IsEdit"])) { return(View("ErrorPage", "Error")); } CityModel CityModel = new CityModel(); int take = 10; int skip = take * pid; CityModel.PageID = pid; CityModel.Current = pid + 1; ViewBag.c = CityModel.PageID; if (id != 0) { var objcity = new CityBLL { }.GetSubCityById(id); if (objcity != null) { CityModel.CityId = objcity.CityId; CityModel.CityName = objcity.CityName; CityModel.StateId = objcity.StateId; CityModel.IsActive = Convert.ToBoolean(objcity.IsActive); } } CustomMethods.BindStateList(CityModel); return(View(CityModel)); }
/// <summary> /// Date Created: 29/07/2011 /// Created By: Gabriel Oquialda /// (description) Loads vendor city to dropdownlist /// ---------------------------------------------------- /// Date Modified: 05/Aug/2013 /// Created By: Josephine Gad /// (description) Change CityListbyCountry to CityBLL.GetCityByCountry /// Add Session, Add default value /// </summary> private void vendorCityLoad(Int16 iLoad, string vendorCountryId) { DataTable dt = null; try { if (iLoad == 0) { List <CityList> listCity = new List <CityList>(); uoDropDownListCity.Items.Clear(); if (Session["CityList"] != null) { listCity = ((List <CityList>)Session["CityList"]); uoDropDownListCity.DataSource = listCity; uoDropDownListCity.DataTextField = "CityName"; uoDropDownListCity.DataValueField = "CityId"; } uoDropDownListCity.Items.Insert(0, (new ListItem("--Select City--", "0"))); uoDropDownListCity.DataBind(); } else { //dt = CityBLL.CityListbyCountry(vendorCountryId); dt = CityBLL.GetCityByCountry(vendorCountryId, uoTextBoxCity.Text.Trim(), uoTextBoxCity.Text); uoDropDownListCity.Items.Clear(); uoDropDownListCity.Items.Insert(0, new ListItem("--Select a City--", "")); if (dt.Rows.Count > 0) { uoDropDownListCity.DataSource = dt; uoDropDownListCity.DataTextField = "colCityNameVarchar"; uoDropDownListCity.DataValueField = "colCityIDInt"; uoDropDownListCity.DataBind(); if (dt.Rows.Count == 1) { if (uoDropDownListCity.Items.FindByValue(GlobalCode.Field2String(dt.Rows[0]["colCityIDInt"])) != null) { uoDropDownListCity.SelectedValue = GlobalCode.Field2String(dt.Rows[0]["colCityIDInt"]); } } } else { uoDropDownListCity.DataBind(); } } } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } }
static public List <City> GetAllBind() { DataTable dt = CityBLL.GetAll(); List <City> Cities = GenericConvertDataTableToList.ConvertDataTable <City>(dt); return(Cities); }
/// <summary> /// Date Created: 28/09/2011 /// Created By: Josephine Gad /// (description) Get city by country id /// --------------------------------------------------------------------------- /// </summary> private void BindCity() { DataTable CityDataTable = null; try { CityDataTable = CityBLL.GetCityByCountry(uoDropDownListCountry.SelectedValue, uoTextBoxCityName.Text, "0"); uoDropDownListCity.Items.Clear(); ListItem item = new ListItem("--Select City--", "0"); uoDropDownListCity.Items.Add(item); uoDropDownListCity.DataSource = CityDataTable; uoDropDownListCity.DataTextField = "colCityNameVarchar"; uoDropDownListCity.DataValueField = "colCityIDInt"; uoDropDownListCity.DataBind(); if (GlobalCode.Field2String(Session["City"]) != "") { if (uoDropDownListCity.Items.FindByValue(GlobalCode.Field2String(Session["City"])) != null) { uoDropDownListCity.SelectedValue = GlobalCode.Field2String(Session["City"]); } } } catch (Exception ex) { throw ex; } finally { if (CityDataTable != null) { CityDataTable.Dispose(); } } }
public CityForm() { _cityService = new CityBLL(); InitializeComponent(); countryBll = new CountryBLL(); countries = countryBll.GetAll(); cmbCountryId.DataSource = countries; }
public JsonResult ChangeCityStatus(int id) { bool Result = false; bool changestatus = new CityBLL { }.ChangeStatus(id); if (changestatus) { Result = true; } return(Json(Result)); }
/// <summary> /// 增加城市 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void AddCityButton_Click(object sender, EventArgs e) { var loggingSessionInfo = Default.GetBSLoggingSession(m_customerID, m_userID); CityBLL cityBll = new CityBLL(loggingSessionInfo); CityEntity city = new CityEntity(); city.CityID = Guid.NewGuid(); city.CityName = CityName.Text; city.LocalStaffCount = Convert.ToInt32(LocalStaffCount.Text); city.CustomerID = m_customerID; city.CreateTime = DateTime.Now; cityBll.Create(city); }
public void LoadCity() { CityBLL city = new CityBLL(); DataTable dtCity = new DataTable(); dtCity = city.Load_CityState(int.Parse(ddlState.SelectedValue)); ddlCity.DataSource = dtCity; ddlCity.DataTextField = "Name"; ddlCity.DataValueField = "ID_City"; ddlCity.DataBind(); ddlCity.Items.Insert(0, new ListItem("-----Select City-----", "0")); }
public ActionResult City(int pid = 0, int cid = 0) { int take = 10; int skip = take * pid; CityModel model = new CityModel(); model.PageID = pid; model.Current = pid + 1; ViewBag.pid = pid; IEnumerable <CityModel> Courses = new List <CityModel>(); CustomMethods.ValidateRoles("City"); var Citieslist = new CityBLL { }.GetAllCities(skip, take); if (cid != 0) { var sortedlist = new CityBLL { }.GetAllCities(skip, take, cid); double count = Convert.ToDouble(sortedlist.Count); var res = count / take; model.Pagecount = (int)Math.Ceiling(res); model.CityList = sortedlist.Select(x => new CityModel { CityId = x.CityId, CityName = x.CityName, StateId = x.StateId, IsActive = Convert.ToBoolean(x.IsActive) }).ToList(); } else { if (Citieslist != null) { double count = Convert.ToDouble(new CityBLL { }.GetPageCount()); var res = count / take; model.Pagecount = (int)Math.Ceiling(res); model.CityList = Citieslist.Select(x => new CityModel { CityId = x.CityId, CityName = x.CityName, StateId = x.StateId, IsActive = Convert.ToBoolean(x.IsActive) }).ToList(); } } return(View(model)); }
public CityForm(City city) { _cityService = new CityBLL(); InitializeComponent(); countryBll = new CountryBLL(); countries = countryBll.GetAll(); cmbCountryId.DataSource = countries; this.city = city; PopulateForm(); }
public static void BindCityList <T>(T model) { try { var cities = new CityBLL { }.GetAllCities(); if (cities != null) { model.GetType().GetProperty("CityList").SetValue(model, cities.Select(x => new SelectListItem { Value = x.CityId.ToString(), Text = x.CityName })); } } catch (Exception) { throw; } }
/// <summary> /// 获取字段,首选默认,MyTexts做为value值 /// </summary> /// <returns></returns> public static SelectList GetSysField(string table, string colum) { if (string.IsNullOrWhiteSpace(table) || string.IsNullOrWhiteSpace(colum)) { List <SelectList> sl = new List <SelectList>(); return(new SelectList(sl)); } // var account = AccountModel.GetCurrentAccount(); var vertion = AccountModel.GetVersion(); if (colum == "GoldTempId") { GoldTempBLL gold = new GoldTempBLL(); return(new SelectList(gold.GetByVertion(vertion), "Id", "Name")); } else if (colum == "Style") { InsuranceBLL ins = new InsuranceBLL(); return(new SelectList(ins.GetByVertion(vertion), "Id", "Name")); } else if (colum == "CityId") { CityBLL city = new CityBLL(); return(new SelectList(city.GetByVertion(vertion), "Name", "Name")); } else if (colum == "PoliceAccountNatureId") { PoliceAccountNatureBLL police = new PoliceAccountNatureBLL(); return(new SelectList(police.GetByVertion(vertion), "Name", "Name")); } else if (colum == "RuleId") { RuleBLL rule = new RuleBLL(); return(new SelectList(rule.GetByVertion(vertion), "Id", "Name")); } ISysFieldHander baseDDL = new SysFieldHander(); return(new SelectList(baseDDL.GetSysField(table, colum), "MyTexts", "MyTexts")); }
public DataTable DALCitySelectedSearch(CityBLL ct) { using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"])) { try { SqlParameter[] par = new SqlParameter[1]; par[0] = new SqlParameter("@cityName", ct.cityName); ds = SqlHelper.ExecuteDataset(con, CommandType.StoredProcedure, "spCitySelectSearch", par); } catch (SqlException ex) { throw ex; } finally { con.Close(); } } return(ds.Tables[0]); }
/// <summary> /// 获取树形页面的数据 /// </summary> /// <returns></returns> public ActionResult GetTree() { List <SystemTree> listSystemTree = new List <SystemTree>(); IBLL.ICityBLL db = new CityBLL(); //CityTreeNodeCollection tree = new CityTreeNodeCollection(); //var trees = db.GetAll().OrderBy(o => o.Id); //if (trees != null) //{ // string parentId = Request["parentid"];//父节点编号 // if (string.IsNullOrWhiteSpace(parentId)) // { // tree.Bind(trees, null, ref listSystemTree); // } // else // { // tree.Bind(trees, parentId, ref listSystemTree); // } //} return(Json(listSystemTree, JsonRequestBehavior.AllowGet)); }
//public int delete(CityBLL ct) //{ // conn.Open(); // int row; // try // { // using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"])) // { // SqlParameter[] par = new SqlParameter[2]; // par[0] = new SqlParameter("@Id", ct.CityID); // par[1] = new SqlParameter("@Status", 11); // par[1].Direction = ParameterDirection.Output; // row = SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "deleteCity", par); // } // return row; // } // catch (SqlException ex) // { // throw ex; // } // finally // { // conn.Close(); // } //} public DataTable DALCitySelectedByDId(CityBLL ct, int i) { List <CityBLL> ctList = new List <CityBLL>(); using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"])) { try { SqlParameter[] par = new SqlParameter[1]; par[0] = new SqlParameter("@distId", i); ds = SqlHelper.ExecuteDataset(con, CommandType.StoredProcedure, "spCitySelectedByDistId", par); } catch (SqlException ex) { throw ex; } finally { con.Close(); } } return(ds.Tables[0]); }
static public City GetById(int id, Role user_role) { City city = null; Type type = typeof(CityBLL); MethodInfo method = type.GetMethod("GetById"); RoleAttribute attribute = method.GetCustomAttribute <RoleAttribute>(); Role function_role = attribute.Role; if (user_role == function_role) { DataRow dr = CityBLL.GetById(id); if (dr != null) { city = new City(); //foreach (DataColumn c in dr.Table.Columns) //{ // var x = c.ColumnName; //} city.ID = dr.Field <int>("ID"); city.City_Name = dr.Field <string>("City_Name"); } } return(city); }
static public int Add(string country_name) { return(CityBLL.Add(country_name)); }
public ActionResult AddEditCity(CityModel model) { int result = 0; CityBLL CityBLL = new CityBLL(); try { if (model.CityId == 0) { if (!Convert.ToBoolean(Session["Add"])) { return(View("ErrorPage")); } } else { if (!Convert.ToBoolean(Session["Edit"])) { return(View("ErrorPage")); } } if (ModelState.IsValid) { if (model.CityId == 0) { var checkDuplicate = objdb.Cities.Where(x => x.CityName == model.CityName).FirstOrDefault(); if (checkDuplicate == null) { int res = new CityBLL { }.AddEditCity(new CityModel { CityName = model.CityName, StateId = model.StateId, IsActive = model.IsActive, CreatedBy = Convert.ToInt32(Session["UserId"]), }); if (res != 0) { Session["Success"] = "Successfully Added The Record"; return(RedirectToAction("City")); } } Session["Error"] = "Record Already Exists"; return(RedirectToAction("City")); } else { if (model.CityId == 0) { Session["Error"] = "Record Already Exists"; return(RedirectToAction("AddEditCity")); } else { model.UpdatedBy = Convert.ToInt32(Session["UserId"]); result = CityBLL.AddEditCity(model); if (result != 0) { Session["Success"] = "Successfully Updated The Record"; return(RedirectToAction("City")); } } } } CustomMethods.BindStateList(model); return(View(model)); } catch (Exception) { Session["Error"] = "An Error has occured"; CustomMethods.BindCountryList(model); return(View(model)); throw; } }
static public int Update(int id, string name) { return(CityBLL.Update(id, name)); }
static public int Delete(int id) { return(CityBLL.Delete(id)); }
public CityApiController(CityBLL bll) { m_BLL = bll; }
/// <summary> /// Date Created: 07/09/2011 /// Created By: Gabriel Oquialda /// (description) Select city list by vendor and country id /// </summary> private void cityListByCountry(int vendorCountryId) { DataTable dt = null; try { dt = CityBLL.GetCityByCountry(uoDropDownListCountry.SelectedValue, uoTextBoxFilterCity.Text.Trim(), "0"); ListItem item = new ListItem("--SELECT CITY--", "0"); uoDropDownListCity.Items.Clear(); uoDropDownListCity.Items.Add(item); if (dt.Rows.Count > 0) { uoDropDownListCity.DataTextField = "colCityNameVarchar"; uoDropDownListCity.DataValueField = "colCityIDInt"; uoDropDownListCity.DataSource = dt; } uoDropDownListCity.DataBind(); if (dt.Rows.Count == 1) { uoDropDownListCity.SelectedIndex = 1; } } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } //DataTable dt = null; //try //{ // int countryID = 0; // if (uoDropDownListCountry.SelectedValue != "0") // { // countryID = Convert.ToInt32(uoDropDownListCountry.SelectedValue); // } // uoDropDownListCity.Items.Clear(); // dt = VendorMaintenanceBLL.cityListByCountry(countryID); // if (dt.Rows.Count > 0) // { // uoDropDownListCity.DataSource = dt; // uoDropDownListCity.DataTextField = "colCityNameVarchar"; // uoDropDownListCity.DataValueField = "colCityIDInt"; // uoDropDownListCity.DataBind(); // } // else // { // uoDropDownListCity.DataBind(); // } // uoDropDownListCity.Items.Insert(0, (new ListItem("--Select City--", "0"))); // if (dt.Rows.Count == 1) // { // uoDropDownListCity.SelectedIndex = 1; // } //} //catch (Exception ex) //{ // throw ex; //} //finally //{ // if (dt != null) // { // dt.Dispose(); // } //} }