public void Delete(int id) { SysCity entity = this.GetEntity(id); db.Entry(entity).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); }
void _filteredCities_Filter(object sender, FilterEventArgs e) { SysCity c = e.Item as SysCity; if (c != null) { e.Accepted = (this._selectedProvince != null) && this._selectedProvince.ID == c.ProvienceId; } }
public string GetNameById(int id) { string name = ""; SysCity city = GetEntity(id); if (city != null) { name = city.Name; } return(name); }
/// <summary> /// 绑定出发返回城市 /// </summary> /// 条件: /// 1、国际线=广州,上海,成都,杭州+常用出港城市列表 /// 2、国内线=常用出港城市列表 /// 3、周边线=常用出港城市列表+公司所在城市 private void BindCity() { IList <CityBase> list = new List <CityBase>(); switch (travelRangeType) { case (int)AreaType.国际线: list = EyouSoft.BLL.CompanyStructure.CompanyCity.CreateInstance().GetCompanyPortCity(SiteUserInfo.CompanyID) .Where(data => data.CityId != 48 && data.CityId != 292 && data.CityId != 295 && data.CityId != 362).ToList(); /* * 48=广州 * 292=上海 * 295=成都 * 362=杭州 * 改此代码的哥们 恭喜你了 */ IList <SysCity> s = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityList(new int[] { 48, 292, 295, 362 }); foreach (var ls in s) { list.Insert(0, (CityBase)ls); } //list.Distinct(); break; case (int)AreaType.国内长线: list = EyouSoft.BLL.CompanyStructure.CompanyCity.CreateInstance().GetCompanyPortCity(SiteUserInfo.CompanyID); break; default: //周边线 SysCity model = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(SiteUserInfo.CityId); if (model != null) { list.Add((CityBase)model); } break; } if (list != null && list.Count > 0) { //出发城市 rpt_DepartureCity.DataSource = list; rpt_DepartureCity.DataBind(); //返回城市 rpt_BackToCities.DataSource = list; rpt_BackToCities.DataBind(); } }
/// <summary> /// 获取城市名称 /// </summary> /// <param name="cityid"></param> /// <returns></returns> private string GetCityName(int cityid) { SysCity syscity = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(cityid); if (syscity != null) { return(syscity.CityName); } else { return(""); } }
private string BindLeaveCity(int LeaveCity, string CompanyId) { StringBuilder str1 = new StringBuilder(); // 当前公司注册时所在省份的出港城市 StringBuilder str2 = new StringBuilder(); // 固定城市 EyouSoft.IBLL.CompanyStructure.ICompanyCity bll = EyouSoft.BLL.CompanyStructure.CompanyCity.CreateInstance(); var modelcompanyinfo = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(CompanyId); IList <EyouSoft.Model.SystemStructure.CityBase> list = bll.GetCompanyPortCity(CompanyId); if (list != null && list.Count > 0) { string[] defaultcity = EyouSoft.Common.ConfigModel.ConfigClass.GetConfigString("DefaultCity").Split(','); foreach (CityBase modelcity in list) { if (!defaultcity.Contains(modelcity.CityId.ToString())) { if (modelcity.CityId == LeaveCity) { str1.AppendFormat("<label for=\"AddStandardTour_rad{2}{0}\" hideFocus=\"false\"><input type=\"radio\" name=\"AddStandardTour_rad{2}\" id=\"AddStandardTour_rad{2}{0}\" checked value=\"{0}\" />{1}</label>", modelcity.CityId, modelcity.CityName, type); } else { str1.AppendFormat("<label for=\"AddStandardTour_rad{2}{0}\" hideFocus=\"false\"><input type=\"radio\" name=\"AddStandardTour_rad{2}\" id=\"AddStandardTour_rad{2}{0}\" value=\"{0}\" />{1}</label>", modelcity.CityId.ToString(), modelcity.CityName, type); } } } foreach (string str in defaultcity) { SysCity item = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(Utils.GetInt(str)); if (str == LeaveCity.ToString()) { str2.AppendFormat("<label for=\"AddStandardTour_rad{2}{0}\" hideFocus=\"false\"><input type=\"radio\" name=\"AddStandardTour_rad{2}\" id=\"AddStandardTour_rad{2}{0}\" checked value=\"{0}\" />{1}</label>", item.CityId, item.CityName, type); } else { str2.AppendFormat("<label for=\"AddStandardTour_rad{2}{0}\" hideFocus=\"false\"><input type=\"radio\" name=\"AddStandardTour_rad{2}\" id=\"AddStandardTour_rad{2}{0}\" value=\"{0}\" />{1}</label>", item.CityId, item.CityName, type); } } } if (!string.IsNullOrEmpty(str1.ToString())) { return(str1.ToString() + "|" + str2.ToString() + "| <a href=\"javascript:void(0)\" onclick=\"TourModule.OpenDialog('设置常用出港城市','/LineManage/SetLeaveCity.aspx?ReleaseType=AddStandardTour&CompanyId=" + CompanyId + "&type=BackCity&ContainerID=" + ContainerID + "&rnd='+ Math.random(),650,450);return false;\"><span class=\"huise\">更多</span></a>"); } else { return(str2.ToString() + "| <a href=\"javascript:void(0)\" onclick=\"TourModule.OpenDialog('设置常用出港城市','/LineManage/SetLeaveCity.aspx?ReleaseType=AddStandardTour&CompanyId=" + CompanyId + "&type=BackCity&ContainerID=" + ContainerID + "&rnd='+ Math.random(),650,450);return false;\"><span class=\"huise\">更多</span></a>"); } }
private void BindRangeType(IList <int> relation, string ranges, bool isShow) { string result = ""; //所有省份列表 IList <EyouSoft.Model.SystemStructure.SysProvince> list = EyouSoft.BLL.SystemStructure.SysProvince.CreateInstance().GetProvinceList(); bool ishave = false; if (list != null && list.Count > 0) { foreach (EyouSoft.Model.SystemStructure.SysProvince item in list) { ishave = false; if (relation == null) { result += string.Format(str, "ckbProvince", item.ProvinceId.ToString(), item.ProvinceName, "", item.ProvinceName); } else { if (ranges == EyouSoft.Model.AdvStructure.AdvRange.全省.ToString()) { foreach (int rel in relation) { if (rel == item.ProvinceId) { ishave = true; break; } } } if (ishave) { result += string.Format(str, "ckbProvince", item.ProvinceId.ToString(), item.ProvinceName, "checked=checked", ""); } else { result += string.Format(str, "ckbProvince", item.ProvinceId.ToString(), item.ProvinceName, "", ""); } } } } if (ranges == EyouSoft.Model.AdvStructure.AdvRange.全省.ToString() || ranges == "" || ranges == EyouSoft.Model.AdvStructure.AdvRange.全国.ToString()) { if (isShow) { if (ranges == EyouSoft.Model.AdvStructure.AdvRange.全国.ToString()) { MessageBox.ResponseScript(this.Page, "$('#rdoCountry').attr('checked',true);$('#defaultProvince').html('" + result + "');$(\"#defaultProvince\").hide();"); } else if (ranges == EyouSoft.Model.AdvStructure.AdvRange.全省.ToString()) { MessageBox.ResponseScript(this.Page, "$('#rdoProvince').attr('checked',true);$('#defaultProvince').html('" + result + "');$(\"#defaultProvince\").show();"); } } else { MessageBox.ResponseScript(this.Page, "$('#defaultProvince').html('" + result + "');$(\"#defaultProvince\").hide();"); } } else if (ranges == EyouSoft.Model.AdvStructure.AdvRange.城市.ToString()) { string result1 = ""; if (relation != null) { foreach (int i in relation) { string a = string.Empty; SysCity GetSysCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(i); if (GetSysCityModel != null) { a = GetSysCityModel.CityName; } result1 += string.Format(str, "ckSellCity", i.ToString(), a, "checked", a); GetSysCityModel = null; } if (isShow) { MessageBox.ResponseScript(this.Page, "$('#rdoCity').attr('checked',true);$(\"#spanSellCity\").html('" + result1 + "');$(\"#spanSellCity\").show();$(\"#selectCity\").show();$('#defaultProvince').html('" + result + "');$(\"#defaultProvince\").hide();"); } } } }
public void Delete(SysCity entity) { db.Entry(entity).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); }
public void Update(SysCity entity) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void Add(SysCity entity) { db.SysCitys.Add(entity); db.SaveChanges(); }