示例#1
0
    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);
    }
示例#2
0
    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);
    }
示例#3
0
    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);
    }