Ejemplo n.º 1
0
        public ActionResult ThongTinThemCapNhat(string Id)
        {
            var duLieuOutput = new Models.ThongBaoKhanModel.Input.ThongTin();

            try
            {
                if (!string.IsNullOrEmpty(Id))
                {
                    var input = new CommonInput.DocThongTin {
                        Id = Id
                    };
                    var output = XuLyAPI.ApiJsonPost2(APIUrl.ThongBaoKhan.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 <Models.ThongBaoKhanModel.Input.ThongTin>(output.DuLieu.ToString());
                }
            }
            catch (Exception)
            {
            }
            return(PartialView("_ThemCapNhatPartial", duLieuOutput));
        }
Ejemplo n.º 2
0
        public ActionResult XuLyLuu(Models.ThongBaoKhanModel.Input.ThongTin input)
        {
            TempData["returnUrl"] = Url.Action("Index", "ThoiTietNongVu", new { Areas = "LVKhuyenNong" });
            var kiemTra = Helpers.XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuanLyThongBaoKhan, QuyenHan.Ma.Them);

            ViewBag.KetQua = kiemTra.KetQua;
            //if (kiemTra.KetQua < 0) return PartialView("_ThemCapNhatPartial", new CommonBieuMauInAn.BieuMauInAnOutput.ThongTin());
            //if (Session["UserInfo"] == null) return Redirect(ChucNang.DuongDan.DangNhap);
            var model  = new CommonOutput();
            var input2 = new ThongBaoKhan.Models.ThongBaoKhanModel.Input.ThongTin2();

            try
            {
                input2.Id = input.Id;
                //input2.Ten = input.Ten;
                //input2.TenVietTat = input.TenVietTat;


                //input2.Ma = string.IsNullOrEmpty(input.Ma) ? "" : input.Ma.Replace(" ", "");

                //input2.ThuTu = input.ThuTu;

                //input2.GhiChu = input.GhiChu;
                //var input = new ThoiTietNongVuInput2();
                input2.HinhDaiDien       = input.HinhDaiDien;
                input2.DuongDanThanThien = input.DuongDanThanThien;
                input2.TieuDe            = input.TieuDe;
                input2.NoiDungTomTat     = input.NoiDungTomTat;
                input2.NoiDung           = input.NoiDung;
                input2.TrangThai         = 0;
                if (input.TrangThai)
                {
                    input2.TrangThai = 1;
                }
                input2.DoUuTien = 0;
                if (input.DoUuTien)
                {
                    input2.DoUuTien = 1;
                }
                var url    = !string.IsNullOrEmpty(input.Id) ? APIUrl.ThongBaoKhan.Sua : APIUrl.ThongBaoKhan.Them;
                var output = XuLyAPI.ApiJsonPost(url, input2) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    if (input.DoUuTien)
                    {
                        GuiThongBao(input2, output);
                    }
                    model.KetQua   = 1;
                    model.ThongBao = ConstantValues.Message.ThanhCong;
                    ViewBag.KetQua = 1;
                    return(PartialView("_ThemCapNhatPartial", new Models.ThongBaoKhanModel.Input.ThongTin()));
                }
                else
                {
                    ViewBag.KetQua = 0;
                    return(PartialView("_ThemCapNhatPartial", input));
                }
            }
            catch (Exception ex)
            {
                ViewBag.KetQua = 0;
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
                return(PartialView("_ThemCapNhatPartial", input));
            }
        }