Ejemplo n.º 1
0
        private static void SetJb(XZDM xzdm, Dictionary <string, XZDM> xzdmDic)
        {
            string dm = xzdm.DJZQDM;

            if (Utils.IsStrNull(dm))
            {
                return;
            }
            string[] array = SpliteAddress(xzdm.DJZQDM, xzdmDic);
            int      num   = array.Length;

            for (int i = 0; i < num; i++)
            {
                string text = array[i];
                switch (i)
                {
                case 0:
                    xzdm.Shi = text;
                    break;

                case 1:
                    xzdm.XiangZheng = text;
                    break;

                case 2:
                    xzdm.Cun = text;
                    break;

                case 3:
                    xzdm.Zu    = text;
                    xzdm.CunZu = xzdm.Cun + text;
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private static PropertyNodeItem GetNodeItem(XZDM xzdm)
        {
            PropertyNodeItem item = new PropertyNodeItem();

            if (xzdm.DJZQDM.Length == 14)
            {
                item.DisplayName = xzdm.Zu;
            }
            else if (xzdm.DJZQDM.Length == 12)
            {
                item.DisplayName = xzdm.Cun;
            }
            else if (xzdm.DJZQDM.Length == 9)
            {
                item.DisplayName = xzdm.XiangZheng;
            }
            else if (xzdm.DJZQDM.Length == 6)
            {
                item.DisplayName = xzdm.Shi;
            }

            item.data = xzdm;
            item.Name = xzdm.DJZQDM;
            item.data = xzdm;
            return(item);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到所有权 如果是村代码 只得到集体
        /// </summary>
        /// <param name="xzdm"></param>
        /// <returns></returns>
        public static IList <JTSYQ> GetSelectJTSYQ(XZDM xzdm)
        {
            string bm  = xzdm.DJZQDM;
            string sql = "";

            switch (bm.Length)
            {
            case 6:
                break;

            case 9:
                sql = " BM LIKE  '*" + bm + "*' And BM LIKE '*998'";
                break;

            case 12:
                sql = " BM LIKE  '*" + bm + "*' And BM LIKE '*00'";
                break;

            case 14:
                sql = " BM LIKE  '*" + bm.Insert(12, "JA000") + "*' ";
                break;
            }
            IList <JTSYQ> jtsyqs     = JTSYQCustom.GetMapJTSYQ(sql);
            IList <JTSYQ> jtsyqGroup = JTSYQCustom.GroupByZu(jtsyqs);

            if (Utils.CheckListExists(jtsyqGroup))
            {
                foreach (JTSYQ jtsyq in jtsyqGroup)
                {
                    jtsyq.XZDM = xzdm;
                }
            }
            return(jtsyqGroup);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到所有本村所有集体所有权
        /// </summary>
        /// <param name="xzdm">村</param>
        /// <returns></returns>
        public static IList <JTSYQ> GetCunZuAllJTSYQ(XZDM xzdm)
        {
            string bm  = xzdm.DJZQDM;
            string sql = " BM LIKE  '*" + bm + "*'";

            IList <JTSYQ> jtsyqs = JTSYQCustom.GetMapJTSYQ(sql);

            JTSYQCustom.OrderByBM(jtsyqs);


            IList <JTSYQ> jtsyqGroup = JTSYQCustom.GroupByZu(jtsyqs);

            return(jtsyqGroup);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 行政代码排序
        /// </summary>
        /// <param name="xzdms"></param>
        private static void OrderByBM(IList <XZDM> xzdms)
        {
            int len = xzdms.Count;


            for (int i = 0; i < len - 1; i++) /* 外循环为排序趟数,len个数进行len-1趟 */
            {
                for (int j = 0; j < len - 1 - i; j++)
                {     /* 内循环为每趟比较的次数,第i趟比较len-i次 */
                    if (xzdms[j].DJZQDM.CompareTo(xzdms[j + 1].DJZQDM) > 0)
                    { /* 相邻元素比较,若逆序则交换(升序为左大于右,降序反之) */
                        XZDM temp = xzdms[j];
                        xzdms[j]     = xzdms[j + 1];
                        xzdms[j + 1] = temp;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private static PropertyNodeItem GetNodeItem(XZDM xzdm, int sub)
        {
            string bm = xzdm.DJZQDM;

            if (bm.Length >= sub)
            {
                try
                {
                    XZDM xzdm2 = GetXzdm(bm.Substring(0, sub));

                    return(GetNodeItem(xzdm2));
                }
                catch (Exception e)
                {
                    return(null);
                }
            }
            return(null);
        }
Ejemplo n.º 7
0
        private static PropertyNodeItem GetAllNodeItem(XZDM xzdm)
        {
            PropertyNodeItem root  = GetNodeItem(xzdm, 6);
            PropertyNodeItem root1 = GetNodeItem(xzdm, 9);
            PropertyNodeItem root2 = GetNodeItem(xzdm, 12);
            PropertyNodeItem root3 = GetNodeItem(xzdm, 14);

            if (root3 != null)
            {
                root3.Parent = root2;
            }
            if (root2 != null)
            {
                root2.Parent = root1;
            }
            if (root1 != null)
            {
                root1.Parent = root;
            }

            return(root);
        }
Ejemplo n.º 8
0
        private static string GetAddress(string bm, int sub, Dictionary <string, XZDM> xzdmDic)
        {
            XZDM xzdm = GetXzdm(bm.Substring(0, sub), xzdmDic);

            return(xzdm.DJZDQMC);
        }
Ejemplo n.º 9
0
        public static XZDM GetXzdm(string bm)
        {
            XZDM xzdm  = null;
            bool flag2 = bm.Length >= 14;

            if (flag2)
            {
                if (!XZDMDic.TryGetValue(bm.Substring(0, 14), out xzdm))
                {
                    if (!XZDMDic.TryGetValue(bm.Substring(0, 12), out xzdm))
                    {
                        if (!XZDMDic.TryGetValue(bm.Substring(0, 9), out xzdm))
                        {
                            if (!XZDMDic.TryGetValue(bm.Substring(0, 6), out xzdm))
                            {
                            }
                        }
                    }
                }
            }
            else
            {
                bool flag3 = bm.Length >= 12;
                if (flag3)
                {
                    if (!XZDMDic.TryGetValue(bm.Substring(0, 12), out xzdm))
                    {
                        if (!XZDMDic.TryGetValue(bm.Substring(0, 9), out xzdm))
                        {
                            if (!XZDMDic.TryGetValue(bm.Substring(0, 6), out xzdm))
                            {
                            }
                        }
                    }
                }
                else
                {
                    bool flag4 = bm.Length >= 9;
                    if (flag4)
                    {
                        if (!XZDMDic.TryGetValue(bm.Substring(0, 9), out xzdm))
                        {
                            if (!XZDMDic.TryGetValue(bm.Substring(0, 6), out xzdm))
                            {
                            }
                        }
                    }
                    else
                    {
                        bool flag5 = bm.Length >= 6;
                        if (flag5)
                        {
                            XZDMDic.TryGetValue(bm.Substring(0, 6), out xzdm);
                        }
                    }
                }
            }
            bool flag6 = xzdm == null;

            if (flag6)
            {
                throw new Exception("行政代码表没有这个编码:" + bm);
            }
            return(xzdm);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 只适用于只有一个根节点
        /// </summary>
        /// <param name="xzdms"></param>
        /// <returns></returns>

        /* public static IList<PropertyNodeItem> XZDMToItem(IList<XZDM> xzdms)
         * {
         *   OrderByBM(xzdms);
         *   List<PropertyNodeItem> list = new List<PropertyNodeItem>();
         *   if (xzdms.Count == 0)
         *   {
         *       return list;
         *   }
         *
         *   XZDM xzdm1 = xzdms[0];
         *   PropertyNodeItem item1 = GetNodeItem(xzdm1,6);
         *   list.Add(item1);
         *   Dictionary<string, PropertyNodeItem> dic = new Dictionary<string, PropertyNodeItem>();
         *   dic.Add(item1.Name, item1);
         *    PropertyNodeItem parent;
         *   for (int a = 0; a < xzdms.Count; a++)
         *   {
         *       XZDM xzdm = xzdms[a];
         *       string bm = xzdm.DJZQDM;
         *       PropertyNodeItem child = GetNodeItem(xzdm);
         *       if (bm.Length == 14)
         *       {
         *
         *           if (dic.TryGetValue(bm.Substring(0, 12), out parent))
         *           {
         *
         *               if(!dic.ContainsKey(bm))
         *               {
         *                   parent.AddChild(child);
         *                   dic.Add(bm, child);
         *               }
         *
         *           }
         *       }
         *       else
         *       if (bm.Length == 12)
         *       {
         *           if (dic.TryGetValue(bm.Substring(0, 9), out parent))
         *           {
         *
         *               if (!dic.ContainsKey(bm))
         *               {
         *                   parent.AddChild(child);
         *                   dic.Add(bm, child);
         *               }
         *           }
         *       }
         *       else
         *        if (bm.Length == 9)
         *       {
         *          if (dic.TryGetValue(bm.Substring(0, 6), out parent))
         *           {
         *
         *               if (!dic.ContainsKey(bm))
         *               {
         *                   parent.AddChild(child);
         *                   dic.Add(bm, child);
         *               }
         *           }
         *
         *       }
         *       else if (bm.Length == 6)
         *       {
         *           if (dic.TryGetValue(bm.Substring(0, 6), out parent))
         *           {
         *
         *
         *               if (!dic.ContainsKey(bm))
         *               {
         *                   parent.AddChild(child);
         *                   dic.Add(bm, child);
         *               }
         *           }
         *       }
         *   }
         *   return list;
         * }*/

        /// <summary>
        /// 只适用于只有一个根节点
        /// </summary>
        /// <param name="xzdms"></param>
        /// <returns></returns>
        public static IList <PropertyNodeItem> XZDMToItem(IList <XZDM> xzdms)
        {
            OrderByBM(xzdms);
            List <PropertyNodeItem> list = new List <PropertyNodeItem>();

            if (xzdms.Count == 0)
            {
                return(list);
            }

            XZDM             xzdm1 = xzdms[0];
            PropertyNodeItem item1 = GetNodeItem(xzdm1, 6);

            list.Add(item1);
            Dictionary <string, PropertyNodeItem> dic = new Dictionary <string, PropertyNodeItem>();

            dic.Add(item1.Name, item1);
            PropertyNodeItem parent;

            for (int a = 0; a < xzdms.Count; a++)
            {
                XZDM             xzdm  = xzdms[a];
                string           bm    = xzdm.DJZQDM;
                PropertyNodeItem child = GetNodeItem(xzdm);
                if (bm.Length == 14)
                {
                    if (dic.TryGetValue(bm.Substring(0, 12), out parent))
                    {
                        if (!dic.ContainsKey(bm))
                        {
                            parent.AddChild(child);
                            dic.Add(bm, child);
                        }
                    }
                }
                else
                if (bm.Length == 12)
                {
                    if (dic.TryGetValue(bm.Substring(0, 9), out parent))
                    {
                        if (!dic.ContainsKey(bm))
                        {
                            parent.AddChild(child);
                            dic.Add(bm, child);
                        }
                    }
                }
                else
                if (bm.Length == 9)
                {
                    if (dic.TryGetValue(bm.Substring(0, 6), out parent))
                    {
                        if (!dic.ContainsKey(bm))
                        {
                            parent.AddChild(child);
                            dic.Add(bm, child);
                        }
                    }
                }
                else if (bm.Length == 6)
                {
                    if (dic.TryGetValue(bm.Substring(0, 6), out parent))
                    {
                        if (!dic.ContainsKey(bm))
                        {
                            parent.AddChild(child);
                            dic.Add(bm, child);
                        }
                    }
                }
            }
            return(list);
        }