public static int GetAddressID(string ParentName, string AddressName) { int aid = 0; if (!string.IsNullOrEmpty(AddressName)) { Bll_Region BRegion = new Bll_Region(); DataSet ds = BRegion.GetList(0, " RegionName='" + AddressName + "' ", " RegionPath asc "); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { int Grade = int.Parse(ds.Tables[0].Rows[i]["RegionGrade"].ToString()); if (Grade > 1) { if (ds.Tables[0].Rows[i]["RegionPath"] != null && ds.Tables[0].Rows[i]["RegionPath"].ToString().Length > 1) { string path = ds.Tables[0].Rows[i]["RegionPath"].ToString().Substring(1, ds.Tables[0].Rows[i]["RegionPath"].ToString().Length - 2);; string[] array = path.Split(','); Mod_Region MRegion = BRegion.GetModel(int.Parse(array[Grade - 2])); if (MRegion != null && MRegion.RegionName == ParentName) { aid = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()); } } } else { aid = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()); } } } } return(aid); }
public static string GetAddressName(int id) { string txtstr = ""; Bll_Region BRegion = new Bll_Region(); Mod_Region dto = BRegion.GetModel(id); if (dto != null) { txtstr = dto.RegionName; } return(txtstr); }
public static string SetAddressToRegion(string Region) { string txtstr = "0,0,0"; if (!string.IsNullOrEmpty(Region)) { Bll_Region BRegion = new Bll_Region(); DataSet ds = BRegion.GetList(" RegionName='" + Region + "' "); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { int RegionID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); Mod_Region dto = BRegion.GetModel(RegionID); if (dto != null) { txtstr = dto.RegionPath.Substring(1, dto.RegionPath.Length - 2); } } } return(txtstr); }