예제 #1
0
        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));
        }
예제 #2
0
 public ActionResult Index()
 {
     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.Xem))
     {
         return(Redirect(ChucNang.DuongDan.BangDieuKhien));
     }
     ViewBag.DanhSachDonVi     = DocDanhSachDonVi();
     ViewBag.DanhSachVaiTro    = DocDanhSachVaiTro();
     ViewBag.DanhSachTrangThai = StaticList.TrangThaiKichHoats();
     return(View());
 }
예제 #3
0
        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));
            }
        }
예제 #4
0
        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()));
            }
        }
예제 #5
0
        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));
        }
예제 #6
0
        public ActionResult ThongTinThemCapNhat(string Id)
        {
            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.Them))
            {
                return(Redirect(ChucNang.DuongDan.BangDieuKhien));
            }
            var duLieuOutput = new CommonNguoiDung.NguoiDungOutput.ThongTin();

            try
            {
                ViewBag.DanhSachVaiTro    = DocDanhSachVaiTro();
                ViewBag.DanhSachDonVi     = DocDanhSachDonVi();
                ViewBag.DanhSachPhanQuyen = DocDanhSachPhanQuyen();
                ViewBag.DanhSachHuyen     = XuLyTinhHuyenXa.DocDanhSachCacCap("Huyen");
                if (!string.IsNullOrEmpty(Id))
                {
                    var input = new CommonInput.DocThongTinInput {
                        Id = Id
                    };
                    var output = XuLyAPI.ApiJsonPost(APIUrl.NguoiDung.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 <CommonNguoiDung.NguoiDungOutput.ThongTin>(output.DuLieu.ToString());
                }
            }
            catch (Exception)
            {
            }
            return(PartialView("_ThemCapNhatPartial", duLieuOutput));
        }
예제 #7
0
        //[Route("")]
        //[Route("xem-danh-sach/{id}")]
        public ActionResult Index()
        {
            TempData["returnUrl"] = Url.Action("Index", "QuangCao", new { Areas = "QuangCao" });
            if (Session["UserInfo"] == null)
            {
                return(Redirect(ChucNang.DuongDan.DangNhap));
            }
            if (!XuLyPhanQuyen.KiemTraQuyen(ChucNang.Ma.QuangCao, QuyenHan.Ma.Xem))
            {
                return(Redirect(ChucNang.DuongDan.BangDieuKhien));
            }

            try
            {
                string tuKhoa = "";
                int    trang  = 1;
                if (!string.IsNullOrEmpty(Request.QueryString["Tukhoa"]))
                {
                    tuKhoa = Request.QueryString["Tukhoa"];
                }
                if (!string.IsNullOrEmpty(Request.QueryString["Trang"]))
                {
                    trang = int.Parse(Request.QueryString["Trang"]);
                }
                var danhSachThamSo = new
                {
                    Tukhoa = tuKhoa
                };
                //ViewBag.DanhSachThamSo = Utility.ConvertOjectToGETParam(danhSachThamSo);
                var DanhSachNenTang = StaticList.NenTangs();
                ViewBag.DanhSachNenTangTimKiem = DanhSachNenTang;
                ViewBag.DanhSachLoaiTimKiem    = DocDanhSachLoai();
                //var danhSach = DocDanhSach();
                return(View());
            }
            catch (Exception ex)
            {
                TempData["Error"] = ConstantValues.Message.LoiDuLieu;
                return(View());
            }
        }
예제 #8
0
        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));
        }
예제 #9
0
        public ActionResult Index()
        {
            TempData["returnUrl"] = Url.Action("Index", "Manage", new { Areas = "PhongBan" });
            if (Session["UserToken"] == null)
            {
                return(Redirect(ChucNang.DuongDan.DangNhap));
            }
            if (!XuLyPhanQuyen.KiemTraQuyen(ChucNang.Ma.DanhMucPhongBan, QuyenHan.Ma.Xem))
            {
                return(Redirect(ChucNang.DuongDan.BangDieuKhien));
            }
            try
            {
                ViewBag.Active = "PhongBan";

                string tuKhoa = "";
                int    trang  = 1;
                if (!string.IsNullOrEmpty(Request.QueryString["tukhoa"]))
                {
                    tuKhoa = Request.QueryString["tukhoa"];
                }
                if (!string.IsNullOrEmpty(Request.QueryString["trang"]))
                {
                    trang = int.Parse(Request.QueryString["trang"]);
                }
                var danhSachThamSo = new
                {
                    tukhoa = tuKhoa
                };
                ViewBag.DanhSachThamSo = Utility.ConvertOjectToGETParam(danhSachThamSo);
                var danhSach = DocDanhSach();
                return(View(danhSach));
            }
            catch (Exception ex)
            {
                TempData["Error"] = ConstantValues.Message.LoiDuLieu;
                return(View());
            }
        }
예제 #10
0
        //[Route("trang-chu")]
        public ActionResult Index()
        {
            TempData["returnUrl"] = Url.Action("Index", "Menu", new { Areas = "Admin" });
            if (Session["UserInfo"] == null)
            {
                return(Redirect(ChucNang.DuongDan.DangNhap));
            }
            if (!XuLyPhanQuyen.KiemTraQuyen(ChucNang.Ma.Menu, QuyenHan.Ma.Xem))
            {
                return(Redirect(ChucNang.DuongDan.BangDieuKhien));
            }

            try
            {
                string tuKhoa = "";
                int    nhom   = 0;
                int    loai   = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["tukhoa"]))
                {
                    tuKhoa = Request.QueryString["tukhoa"];
                }
                if (!string.IsNullOrEmpty(Request.QueryString["nhom"]))
                {
                    nhom = int.Parse(Request.QueryString["nhom"]);
                }
                if (!string.IsNullOrEmpty(Request.QueryString["loai"]))
                {
                    loai = int.Parse(Request.QueryString["loai"]);
                }
                var danhSach = DocDanhSach(tuKhoa, nhom, loai);
                return(View(danhSach));
            }
            catch (Exception ex)
            {
                TempData["Error"] = Message.LoiDuLieu;
                return(View());
            }
        }
예제 #11
0
        public ActionResult XemDanhSach(string tukhoa = "", int nhom = 0, int loai = 0)
        {
            var danhSachThamSo = new { tukhoa = tukhoa };

            ViewBag.DanhSachThamSo = Utility.ConvertOjectToGETParam(danhSachThamSo);
            TempData["returnUrl"]  = Url.Action("Index", "Menu", new { Areas = "Admin" });
            //if (Session["UserInfo"] == null) return Redirect(ChucNang.DuongDan.DangNhap);
            if (!XuLyPhanQuyen.KiemTraQuyen(ChucNang.Ma.Menu, QuyenHan.Ma.Xem))
            {
                return(Redirect(ChucNang.DuongDan.BangDieuKhien));
            }

            try
            {
                var danhSach = DocDanhSach(tukhoa, nhom, loai);
                return(PartialView("_PartialDanhSach", danhSach));
            }
            catch (Exception ex)
            {
                //Ghi log
                TempData["Error"] = Message.LoiDuLieu;
                return(PartialView("_PartialDanhSach"));
            }
        }
예제 #12
0
        public ActionResult XemDanhSach(string TuKhoa = "", string MaNenTang = "", string MaLoai = "", int?Trang = 1)
        {
            var danhSachThamSo = new { TuKhoa = TuKhoa, MaNenTang = MaNenTang, MaLoai = MaLoai };

            ViewBag.DanhSachThamSo = Utility.ConvertOjectToGETParam(danhSachThamSo);
            TempData["returnUrl"]  = Url.Action("Index", "QuangCao", new { Areas = "QuangCao" });
            //if (Session["UserInfo"] == null) return Redirect(ChucNang.DuongDan.DangNhap);
            if (!XuLyPhanQuyen.KiemTraQuyen(ChucNang.Ma.QuangCao, QuyenHan.Ma.Xem))
            {
                return(Redirect(ChucNang.DuongDan.BangDieuKhien));
            }

            try
            {
                var danhSach = DocDanhSach(TuKhoa, MaNenTang, MaLoai, Trang);
                return(PartialView("_DanhSachPartial", danhSach));
            }
            catch (Exception ex)
            {
                //Ghi log
                TempData["Error"] = ConstantValues.Message.LoiDuLieu;
                return(PartialView("_DanhSachPartial"));
            }
        }
예제 #13
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));
            }
        }
예제 #14
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));
            }
        }