public static List <CommonNamThangTuan.NamOutput> Nams() { try { var input = new CommonInput.DocDanhSach(); var output = XuLyAPI.ApiJsonPost(APIUrl.ThongTinNam.DocDanhSach, input) as CommonOutput; if (output.KetQua != 1) { throw new Exception(output.ThongBao); } var danhSachNam = JsonConvert.DeserializeObject <List <CommonNamThangTuan.ThongTinNamOutput> >(output.DuLieu.ToString()); if (danhSachNam != null) { var kq = new List <CommonNamThangTuan.NamOutput>(); foreach (var item in danhSachNam) { var i = new CommonNamThangTuan.NamOutput(); i.Value = item.Nam; i.Text = item.ChuoiNam; i.NamHienTai = item.NamHienTai; kq.Add(i); } kq = kq.OrderByDescending(e => e.Value).ToList(); return(kq); } } catch (Exception) { } return(null); }
public static dynamic DocDanhSachCacCapKT(string Loai = "", string Id = "") { dynamic DanhSach = null; try { var input = new CommonInput.DocDanhSach(); DanhSach = XuLyDocDaanhSachCacCap(Loai, Id, DanhSach, input, false); } catch (Exception) { } return(DanhSach); }
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)); }
public List <LoaiPhanAnhOutput.DocDanhSachOutput> DanhSachLoaiPhanAnh() { try { CommonInput.DocDanhSach input = new CommonInput.DocDanhSach(); var output = new CommonOutput(); output = XuLyAPI.ApiJsonPost2(APIUrl.LoaiHinhPhanAnh.DocDanhSach, input) as CommonOutput; var danhsach = JsonConvert.DeserializeObject <List <LoaiPhanAnhOutput.DocDanhSachOutput> >(JsonConvert.SerializeObject(output.DuLieu)); return(danhsach); } catch (Exception e) { //Ghi log return(null); } }
private List <CommonPhanQuyen.PhanQuyenOutput.ThongTin_ThuGon> DocDanhSach() { var input = new CommonInput.DocDanhSach(); var output = XuLyAPI.ApiJsonPost(APIUrl.PhanQuyen.DocDanhSach, input) as CommonOutput; if (output == null) { throw new Exception(ConstantValues.Message.LoiServer); } if (output.KetQua != 1) { throw new Exception(output.ThongBao); } var duLieuOutput = JsonConvert.DeserializeObject <List <CommonPhanQuyen.PhanQuyenOutput.ThongTin_ThuGon> >(output.DuLieu.ToString()); return(duLieuOutput); }
private CommonThietBiDiDong.Output.SoLuongThietBiDiDong DocSoLuongThietBiDiDong() { try { var input = new CommonInput.DocDanhSach(); var output = XuLyAPI.ApiJsonPost(APIUrl.ThietBiDiDong.DocSoLuongThietBiDiDong, input) as CommonOutput; if (output == null) { throw new Exception(Message.LoiServer); } if (output.KetQua != 1) { throw new Exception(output.ThongBao); } var duLieuOutput = JsonConvert.DeserializeObject <CommonThietBiDiDong.Output.SoLuongThietBiDiDong>(output.DuLieu.ToString()); return(duLieuOutput); } catch (Exception ex) { return(null); } }
private static dynamic XuLyDocDaanhSachCacCap(string Loai, string Id, dynamic DanhSach, CommonInput.DocDanhSach input, bool useToken = true) { var duongDan = useToken ? APIUrl.Tinh.DocThongTin : APIUrl.Tinh.DocThongTinKT; var output = XuLyAPI.ApiJsonPost(duongDan, input, useToken) as CommonOutput; if (output == null) { throw new Exception("Lỗi Server"); } if (output.KetQua != 1) { throw new Exception(output.ThongBao); } if (output.DuLieu != null) { var data = JsonConvert.DeserializeObject <CommonTinh.TinhOutput.ThongTinTinh>(output.DuLieu.ToString()); if (Loai == "Huyen" && Id == "") { DanhSach = data.DanhSachHuyen; } else { foreach (var Huyen in data.DanhSachHuyen) { if (Loai == "Xa" && Id != "" && Id == Huyen.Id)//Id Huyen { DanhSach = Huyen.DanhSachXa; } else { foreach (var Xa in Huyen.DanhSachXa) { if (Loai == "Ap" && Id != "" && Id == Xa.Id)//Id xã { DanhSach = Xa.DanhSachAp; } } } } } } return(DanhSach); }