// GET: MapIOT
        public ActionResult Index()
        {
            BSUserInfor ui = (BSUserInfor)Session["BSUserInfor"];
            ListHuyenXaNguoiDungModel HuyenND = new ListHuyenXaNguoiDungModel()
            {
                Genre = "Huyện",
                ListHuyenXaNguoiDungs = new List <ListHuyenXaNguoiDung>()
            };
            ListHuyenXaNguoiDungModel XaNguoiDung = new ListHuyenXaNguoiDungModel()
            {
                Genre = "Xã",
                ListHuyenXaNguoiDungs = new List <ListHuyenXaNguoiDung>()
            };

            if (ui != null && ui.UserInfo != null)
            {
                if (ui != null)
                {
                    foreach (DictionaryEntry s in ui.UserInfo.ToChucKVHC)
                    {
                        if (s.Value.GetType() == typeof(SSOHcHuyen))
                        {
                            var sHuyen = (SSOHcHuyen)s.Value;
                            ListHuyenXaNguoiDung HuyenXaNguoiDungModel = new ListHuyenXaNguoiDung()
                            {
                                Id       = sHuyen.HUYENID,
                                Code     = sHuyen.MAHUYEN,
                                NameKVHC = sHuyen.TENKVHC,
                                Name     = sHuyen.TENKVHC.Replace(sHuyen.PHANLOAI, "").Trim(),
                                MaKVHC   = sHuyen.MAKVHC,
                            };
                            HuyenND.ListHuyenXaNguoiDungs.Add(HuyenXaNguoiDungModel);
                        }
                        else if (s.Value.GetType() == typeof(SSOHcXa))
                        {
                            var sXa = (SSOHcXa)s.Value;
                            ListHuyenXaNguoiDung HuyenXaNguoiDungModel = new ListHuyenXaNguoiDung()
                            {
                                Id       = sXa.ID,
                                Code     = sXa.MAXA,
                                NameKVHC = sXa.TENKVHC,
                                Name     = sXa.TENKVHC.Replace((sXa.PHANLOAI != null ? sXa.PHANLOAI : "$"), "").Replace("Thị Xã", "").Replace("Phường", "").Replace("Thị Trấn", "").Trim(),
                                MaKVHC   = sXa.MAKVHC
                            };
                            XaNguoiDung.ListHuyenXaNguoiDungs.Add(HuyenXaNguoiDungModel);
                        }
                    }
                }
            }
            if (HuyenND.ListHuyenXaNguoiDungs.Count > 0)
            {
                HuyenND.ListHuyenXaNguoiDungs = HuyenND.ListHuyenXaNguoiDungs.OrderBy(x => x.Name).ToList();
                ViewBag.HuyenNguoiDung        = HuyenND;
            }
            else
            {
                XaNguoiDung.ListHuyenXaNguoiDungs = XaNguoiDung.ListHuyenXaNguoiDungs.OrderBy(x => x.Name).ToList();
                ViewBag.HuyenNguoiDung            = XaNguoiDung;
            }
            ViewBag.BanDoXaID = CurXa == null ? "" : CurXa.MAXA;
            return(View());
        }
        public ActionResult Index()
        {
            //BSUserInfor ui = (BSUserInfor)Session["BSUserInfor"];
            //ListHuyenXaNguoiDungModel HuyenND = new ListHuyenXaNguoiDungModel()
            //{
            //    Genre = "Huyện",
            //    ListHuyenXaNguoiDungs = new List<ListHuyenXaNguoiDung>()
            //};
            ListHuyenXaNguoiDungModel XaNguoiDung = new ListHuyenXaNguoiDungModel()
            {
                Genre = "Xã",
                ListHuyenXaNguoiDungs = new List <ListHuyenXaNguoiDung>()
            };

            //if (ui != null && ui.UserInfo != null)
            //{
            //    if (ui != null)
            //    {
            //        foreach (DictionaryEntry s in ui.UserInfo.ToChucKVHC)
            //        {
            //            if (s.Value.GetType() == typeof(SSOHcHuyen))
            //            {
            //                var sHuyen = (SSOHcHuyen)s.Value;
            //                ListHuyenXaNguoiDung HuyenXaNguoiDungModel = new ListHuyenXaNguoiDung()
            //                {
            //                    Id = sHuyen.HUYENID,
            //                    Code = sHuyen.MAHUYEN,
            //                    NameKVHC = sHuyen.TENKVHC,
            //                    Name = sHuyen.TENKVHC.Replace(sHuyen.PHANLOAI, "").Trim(),
            //                    MaKVHC = sHuyen.MAKVHC,
            //                };
            //                HuyenND.ListHuyenXaNguoiDungs.Add(HuyenXaNguoiDungModel);

            //            }
            //            else if (s.Value.GetType() == typeof(SSOHcXa))
            //            {
            //                var sXa = (SSOHcXa)s.Value;
            //                ListHuyenXaNguoiDung HuyenXaNguoiDungModel = new ListHuyenXaNguoiDung()
            //                {
            //                    Id = sXa.ID,
            //                    Code = sXa.MAXA,
            //                    NameKVHC = sXa.TENKVHC,
            //                    Name = sXa.TENKVHC.Replace((sXa.PHANLOAI != null ? sXa.PHANLOAI : "$"), "").Replace("Thị Xã", "").Replace("Phường", "").Replace("Thị Trấn", "").Trim(),
            //                    MaKVHC = sXa.MAKVHC
            //                };
            //                XaNguoiDung.ListHuyenXaNguoiDungs.Add(HuyenXaNguoiDungModel);
            //            }
            //        }
            //    }
            //}
            //if (HuyenND.ListHuyenXaNguoiDungs.Count > 0)
            //{
            //    HuyenND.ListHuyenXaNguoiDungs = HuyenND.ListHuyenXaNguoiDungs.OrderBy(x => x.Name).ToList();
            //    ViewBag.HuyenNguoiDung = HuyenND;
            //}
            //else
            //{
            XaNguoiDung.ListHuyenXaNguoiDungs = XaNguoiDung.ListHuyenXaNguoiDungs.OrderBy(x => x.Name).ToList();
            ViewBag.HuyenNguoiDung            = XaNguoiDung;
            //}
            ViewBag.BanDoXaID = "20272";
            return(View());
        }