public void GuiThongBao(Models.ThongBaoKhanModel.Input.ThongTin2 input, CommonOutput output)
        {
            var thongBaoKhan       = JsonConvert.DeserializeObject <Models.ThongBaoKhanModel.Input.ThongTin2>(JsonConvert.SerializeObject(output.DuLieu));
            var inputLoaiThongBao  = new DocDanhSach();
            var outputLoaiThongBao = XuLyAPI.ApiJsonPost(APIUrl.LoaiThongBao.DocDanhSach, inputLoaiThongBao, false) as CommonOutput;

            if (outputLoaiThongBao.KetQua != 1)
            {
                throw new Exception(outputLoaiThongBao.ThongBao);
            }
            List <LoaiThongBaoOutput.DocDanhSach> danhSachLoaiThongBao = new List <LoaiThongBaoOutput.DocDanhSach>();

            danhSachLoaiThongBao = JsonConvert.DeserializeObject <List <LoaiThongBaoOutput.DocDanhSach> >(JsonConvert.SerializeObject(outputLoaiThongBao.DuLieu));
            if (danhSachLoaiThongBao.Any())
            {
                var loaiThongBao = danhSachLoaiThongBao.FirstOrDefault(e => e.Ma.Equals("ThongBaoKhan"));
                if (loaiThongBao != null)
                {
                    if (Session["UserInfo"] != null)
                    {
                        DangNhapOutput userInfo = Session["UserInfo"] as DangNhapOutput;
                        //if (userInfo != null)
                        {
                            var inputGuiTatCa = new ThongBaoInput.GuiTatCa
                            {
                                IdLoaiThongBao = loaiThongBao.Id,
                                //IdNguoiDung = userInfo.IdNguoiDung,
                                //IdTaiKhoan = userInfo.Id,
                                NoiDung    = input.TieuDe,
                                TieuDe     = "Thông tin khẩn cấp",
                                Id         = thongBaoKhan.Id,
                                IdDuLieu   = thongBaoKhan.Id,
                                AnhDaiDien = thongBaoKhan.HinhDaiDien
                            };
                            var outputThongBao = XuLyAPI.ApiJsonPost(APIUrl.ThongBao.GuiThongBaoChoTatCa, inputGuiTatCa, false) as CommonOutput;
                            if (outputThongBao == null)
                            {
                                throw new Exception("Lỗi Server");
                            }
                            if (outputThongBao.KetQua != 1)
                            {
                                throw new Exception(outputThongBao.ThongBao);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
 public DanhSachQuanLyHoNuoiVaBaoCao()
 {
     DanhSachHoNuoi = new DocDanhSach();
     DanhSachBaoCao = new List <AoTheoHoNuoiCacCap>();
 }