Esempio n. 1
0
        public ActionResult XuLyXoaDanhSach(List <string> danhSachId)
        {
            var model = new CommonOutput();

            try
            {
                var input = new CommonInput.XoaDanhSachInput2();
                input.Ids = danhSachId;
                var output = XuLyAPI.ApiJsonPost(APIUrl.ChucVu.XoaDanhSach, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua      = 1;
                    model.ThongBao    = ConstantValues.Message.ThanhCong;
                    model.TongSoLuong = output.DuLieu.ToString();
                }
                else
                {
                    model.KetQua   = 0;
                    model.ThongBao = ConstantValues.Message.ThatBai;
                }
            }
            catch (Exception)
            {
            }
            return(Json(model));
        }
Esempio n. 2
0
        public ActionResult XuLyXoaDanhSach(List <string> danhSachId)
        {
            TempData["returnUrl"] = Url.Action("Index", "Huyen", new { Areas = "DiaChi" });
            //var kiemTra = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuangCao, QuyenHan.Ma.Xoa);
            //if(kiemTra.KetQua < 0) return Json(kiemTra);
            var model = new CommonOutput();

            try
            {
                var input = new CommonInput.XoaDanhSachInput2();
                input.Ids = danhSachId;
                var output = XuLyAPI.ApiJsonPost2(APIUrl.Huyen.XoaDanhSach, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua      = 1;
                    model.ThongBao    = ConstantValues.Message.ThanhCong;
                    model.TongSoLuong = output.DuLieu.ToString();
                }
                else
                {
                    model.KetQua   = 0;
                    model.ThongBao = ConstantValues.Message.ThatBai;
                }
            }
            catch (Exception)
            {
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
            }
            return(Json(model));
        }
        public ActionResult XuLyXoaDanhSach(List <string> danhSachId)
        {
            var model = new CommonOutput();

            TempData["returnUrl"] = Url.Action("Index", "NguoiDung", new { Areas = "NguoiDung" });
            //if (Session["UserInfo"] == null) return Redirect(ChucNang.DuongDan.DangNhap);
            if (!XuLyPhanQuyen.KiemTraQuyen(ChucNang.Ma.QuanLyTaiKhoan, QuyenHan.Ma.Xoa))
            {
                model.KetQua      = 0;
                model.ThongBao    = ConstantValues.Message.KhongCoQuyen;
                model.TongSoLuong = "";
                return(Json(model));
            }

            try
            {
                var input = new CommonInput.XoaDanhSachInput2();
                input.Ids = danhSachId;
                var output = XuLyAPI.ApiJsonPost(APIUrl.NguoiDung.XoaDanhSach, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua      = 1;
                    model.ThongBao    = ConstantValues.Message.ThanhCong;
                    model.TongSoLuong = output.DuLieu.ToString();
                }
                else
                {
                    model.KetQua   = 0;
                    model.ThongBao = ConstantValues.Message.ThatBai;
                }
            }
            catch (Exception)
            {
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
            }
            return(Json(model));
        }