public ActionResult XuLyDocDanhSachHuyenXaAp(string Loai, string Id)
        {
            var model        = new CommonOutput();
            var quyenTruyCap = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuanLyTaiKhoan, QuyenHan.Ma.Xoa);

            if (quyenTruyCap != null && quyenTruyCap.KetQua < 1)
            {
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.KhongCoQuyen;
                model.DuLieu   = null;
                return(Json(model));
            }
            try
            {
                var input = new CommonHuyen.HuyenInput.DocDanhSachTheoIdTinh();
                var ds    = XuLyTinhHuyenXa.DocDanhSachCacCap(Loai, Id);
                if (ds != null)
                {
                    model.KetQua   = 1;
                    model.ThongBao = ConstantValues.Message.ThanhCong;
                    model.DuLieu   = ds;
                }
            }
            catch (Exception ex)
            {
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
                model.DuLieu   = null;
            }
            return(Json(model));
        }
        public ActionResult DangNhapTheoIdNguoiDung(string IdNguoiDung)
        {
            //TempData["returnUrl"] = Url.Action("Index", "NguoiDung");
            if (Session["UserToken"] == null)
            {
                return(Json(false));
            }
            var quyenTruyCap = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuanLyTaiKhoan, QuyenHan.Ma.Xoa);

            if (quyenTruyCap == null || quyenTruyCap.KetQua < 0)
            {
                return(Json(false));
            }
            try
            {
                //Đọc thông tin tài khoản
                var input = new DangNhapTheoIdNguoiDungInput();
                input.IdNguoiDung = IdNguoiDung;
                var output = XuLyAPI.ApiJsonPost(APIUrl.NguoiDung.DangNhapTheoIdNguoiDung, input) as CommonOutput;
                Session.Clear();

                // Thành công
                var userLogin = JsonConvert.DeserializeObject <CommonNguoiDung.NguoiDungOutput.DangNhapTaiKhoan>(output.DuLieu.ToString());
                Session["UserToken"] = new CommonInput.UserToken {
                    TokenApi = userLogin.TokenApi, TokenNguoiDung = userLogin.TokenNguoiDung
                };
                Session["UserInfo"]     = userLogin;
                Session["MaDonVi"]      = userLogin.MaDonVi;
                Session["TenNguoiDung"] = userLogin.Ten;
                var input2     = new CommonTinh.TinhInput.DocThongTin();
                var outputTinh = XuLyAPI.ApiJsonPost(APIUrl.Tinh.DocThongTin, input2) as CommonOutput;
                if (outputTinh != null /*&& output.KetQua == 1*/)
                {
                    Session["Tinh"] = JsonConvert.DeserializeObject <CommonTinh.TinhOutput.ThongTinTinh>(outputTinh.DuLieu.ToString());
                }
                else
                {
                    Session["Tinh"] = null;
                }
                return(Json(true));
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.Message;
                return(Json(false));
            }
        }
        public ActionResult XuLyLuu(CommonNguoiDung.NguoiDungInput.ThongTin input)
        {
            TempData["returnUrl"] = Url.Action("Index", "NguoiDung", new { Areas = "NguoiDung" });
            var kiemTra = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuanLyTaiKhoan, !string.IsNullOrEmpty(input.Id) ? QuyenHan.Ma.Them : QuyenHan.Ma.Sua);

            ViewBag.KetQua = kiemTra.KetQua;
            if (kiemTra.KetQua < 0)
            {
                return(PartialView("_ThemCapNhatPartial", new CommonNguoiDung.NguoiDungOutput.ThongTin()));
            }

            var model = new CommonOutput();

            try
            {
                var url = !string.IsNullOrEmpty(input.Id) ? APIUrl.NguoiDung.Sua : APIUrl.NguoiDung.Them;
                input.IdTinh = "5a2a4172e08157ab8aa47d26";//Mặc định là tỉnh Cà Mau
                if (!string.IsNullOrEmpty(input.MatKhau))
                {
                    input.MatKhau = Utility.MD5(input.MatKhau);
                }
                var output = XuLyAPI.ApiJsonPost(url, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua   = 1;
                    model.ThongBao = ConstantValues.Message.ThanhCong;
                    ViewBag.KetQua = 1;
                    return(PartialView("_ThemCapNhatPartial", new CommonNguoiDung.NguoiDungOutput.ThongTin()));
                }
                else
                {
                    ViewBag.KetQua = 0;
                    return(PartialView("_ThemCapNhatPartial", new CommonNguoiDung.NguoiDungOutput.ThongTin()));
                }
            }
            catch (Exception ex)
            {
                ViewBag.KetQua = 0;
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
                return(PartialView("_ThemCapNhatPartial", new CommonNguoiDung.NguoiDungOutput.ThongTin()));
            }
        }
        public ActionResult XuLyXoaDanhSach(List <string> danhSachId)
        {
            TempData["returnUrl"] = Url.Action("Index", "QuangCao", new { Areas = "QuangCao" });
            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.QuangCao.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));
        }
Beispiel #5
0
        public ActionResult XuLyLuu(CommonMenu.MenuInput.ThongTin input)
        {
            TempData["returnUrl"] = Url.Action("Index", "Menu", new { Areas = "Admin" });
            var kiemTra = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuangCao, QuyenHan.Ma.Them);

            ViewBag.KetQua = kiemTra.KetQua;
            if (kiemTra.KetQua < 0)
            {
                return(PartialView("_PartialThemCapNhat", new CommonMenu.MenuOutput.ThongTin()));
            }

            var danhsach = DocDanhSach("", 0, 0);
            var data     = new MenuModel.MenuOutput.ThemCapNhatMenu();

            data.DanhSachMenu = danhsach.DanhSach;
            var thongtin = new MenuModel.MenuOutput.ThongTin();
            var outputDanhMucChucNang = DocDanhMucChucNang();

            if (outputDanhMucChucNang != null)
            {
                data.DanhMucChucNang = outputDanhMucChucNang.DanhSach;
            }


            var model  = new CommonOutput();
            var input2 = new CommonMenu.MenuOutput.ThongTin();

            try
            {
                input2.Id          = input.Id;
                input2.Ten         = input.Ten;
                input2.Ma          = input.Ma;
                input2.Icon        = input.Icon;
                input2.IdMenuCha   = input.IdMenuCha;
                input2.LienKet     = input.LienKet;
                input2.Nhom        = input.Nhom;
                input2.Loai        = input.Loai;
                input2.ViTri       = input.ViTri;
                input2.KichHoat    = input.KichHoat;
                input2.MoTa        = input.MoTa;
                input2.BieuTuong   = input.BieuTuong;
                input2.KieuHienThi = input.KieuHienThi;
                var url    = !string.IsNullOrEmpty(input.Id) ? APIUrl.Menu.CapNhat : APIUrl.Menu.Them;
                var output = XuLyAPI.ApiJsonPost(url, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua   = 1;
                    model.ThongBao = Message.ThanhCong;
                    ViewBag.KetQua = 1;

                    return(PartialView("_PartialThemCapNhat", data));
                }
                else
                {
                    ViewBag.KetQua    = 0;
                    data.ThongTinMenu = input2;
                    return(PartialView("_PartialThemCapNhat", data));
                }
            }
            catch (Exception ex)
            {
                ViewBag.KetQua = 0;
                model.KetQua   = 0;
                model.ThongBao = Message.ThatBai;
                return(PartialView("_PartialThemCapNhat", input2));
            }
        }
Beispiel #6
0
        public ActionResult XuLyLuu(CommonQuangCao.QuangCaoInput.ThongTinQuangCao input)
        {
            TempData["returnUrl"] = Url.Action("Index", "QuangCao", new { Areas = "QuangCao" });
            var kiemTra = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuangCao, QuyenHan.Ma.Them);

            ViewBag.KetQua = kiemTra.KetQua;
            if (kiemTra.KetQua < 0)
            {
                return(PartialView("_ThemCapNhatPartial", new CommonQuangCao.QuangCaoOutput.ThongTinQuangCao()));
            }

            var model  = new CommonOutput();
            var input2 = new CommonQuangCao.QuangCaoOutput.ThongTinQuangCao();

            ViewBag.DanhSachViTri = StaticList.ViTriQuangCaos();
            var danhSachNenTang = StaticList.NenTangs();

            ViewBag.DanhSachNenTang    = danhSachNenTang;
            ViewBag.DanhSachThuocTrang = StaticList.ThuocTrangs().Where(n => n.MaNenTang == danhSachNenTang.FirstOrDefault().Value.ToString()).ToList();
            try
            {
                input2.Id           = input.Id;
                input2.IdDonVi      = input.IdDonVi;
                input2.MaNenTang    = input.MaNenTang;
                input2.MaLoai       = input.MaLoai;
                input2.TieuDe       = input.TieuDe;
                input2.MoTa         = input.MoTa;
                input2.NoiDung      = input.NoiDung;
                input2.ThuTuHienThi = input.ThuTuHienThi;
                input2.KichHoat     = input.KichHoat;
                input2.UuTien       = input.UuTien;
                input2.HinhDaiDien  = input.HinhDaiDien;
                input2.DuongDan     = input.DuongDan;
                input2.ChuoiTuNgay  = input.TuNgay;
                input2.ChuoiDenNgay = input.DenNgay;
                //input2.SoLuotClick = input.SoLuotClick;
                //input2.SoLuotHienThi = input.SoLuotHienThi;

                var url    = !string.IsNullOrEmpty(input.Id) ? APIUrl.QuangCao.Sua : APIUrl.QuangCao.Them;
                var output = XuLyAPI.ApiJsonPost(url, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua   = 1;
                    model.ThongBao = ConstantValues.Message.ThanhCong;
                    ViewBag.KetQua = 1;
                    return(PartialView("_ThemCapNhatPartial", new CommonQuangCao.QuangCaoOutput.ThongTinQuangCao()));
                }
                else
                {
                    ViewBag.KetQua = 0;
                    return(PartialView("_ThemCapNhatPartial", input2));
                }
            }
            catch (Exception)
            {
                ViewBag.KetQua = 0;
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
                return(PartialView("_ThemCapNhatPartial", input2));
            }
        }