コード例 #1
0
        public ActionResult ThongTinThemCapNhat(string Id)
        {
            var duLieuOutput = new CommonPhanQuyen.PhanQuyenOutput.ThongTinPhanQuyen();

            ViewBag.DanhSachChucNangXuLy = DocDanhSachChucNangXuLy();
            ViewBag.DanhSachVaiTro       = DocDanhSachVaiTro();
            ViewBag.DanhSachDonVi        = DocDanhSachDonVi();
            ViewBag.DanhSachNhom         = StaticList.NhomMenus();
            ViewBag.DanhSachViTri        = StaticList.ViTriMenus();
            try
            {
                if (!string.IsNullOrEmpty(Id))
                {
                    var input = new CommonInput.DocThongTinInput {
                        Id = Id
                    };
                    var output = XuLyAPI.ApiJsonPost(APIUrl.PhanQuyen.DocThongTin, input) as CommonOutput;
                    if (output == null)
                    {
                        throw new Exception(ConstantValues.Message.LoiServer);
                    }
                    if (output.KetQua != 1)
                    {
                        throw new Exception(output.ThongBao);
                    }
                    duLieuOutput = JsonConvert.DeserializeObject <CommonPhanQuyen.PhanQuyenOutput.ThongTinPhanQuyen>(output.DuLieu.ToString());
                }
                else
                {
                    var input  = new CommonInput.DocDanhSach();
                    var output = XuLyAPI.ApiJsonPost(APIUrl.Menu.DocDanhSachCoPhanCap, input) as CommonOutput;
                    if (output == null)
                    {
                        throw new Exception(ConstantValues.Message.LoiServer);
                    }
                    if (output.KetQua != 1)
                    {
                        throw new Exception(output.ThongBao);
                    }
                    var dsChucNang = JsonConvert.DeserializeObject <List <CommonPhanQuyen.PhanQuyenOutput.ThongTinPhanQuyen.ThongTinMenu> >(output.DuLieu.ToString());
                    duLieuOutput.DanhSachMenu = dsChucNang;
                }
            }
            catch (Exception)
            {
            }
            return(PartialView("_ThemCapNhatPartial", duLieuOutput));
        }