Exemplo n.º 1
0
        public ActionResult SanLuongDuKienPaging(int?thang, int?nam, int loai_sldk = 1)
        {
            try
            {
                using (Model1 db = new Model1())
                {
                    RequestPagingModel rpm = new RequestPagingModel();
                    rpm.length         = int.Parse(HttpContext.Request["length"]);
                    rpm.start          = int.Parse(Request["start"]);
                    rpm.searchValue    = HttpContext.Request["search[value]"];
                    rpm.sortColumnName = HttpContext.Request["columns[" + Request["order[0][column]"] + "][name]"];
                    rpm.sortDirection  = Request["order[0][dir]"];
                    rpm.draw           = Request["draw"];

                    PagingModel <SanLuongDuKienViewModel> pm = new PagingModel <SanLuongDuKienViewModel>();
                    var response = SanLuongDuKienDAO.GetSanLuongDuKienPaging(out pm, rpm, loai_sldk, thang, nam);

                    if (!response)
                    {
                        return(Json(new { success = false, message = "Lỗi truy cập cơ sở dữ liệu" }, JsonRequestBehavior.AllowGet));
                        //return Json(null, JsonRequestBehavior.AllowGet);
                    }

                    return(Json(pm, JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public static RequestPagingModel To(RequestPagingJsonModel obj)
        {
            var model = new RequestPagingModel()
            {
                Page  = 1,
                Limit = 20
            };

            if (obj != null)
            {
                model.Page  = obj.page;
                model.Limit = obj.limit;
            }

            return(model);
        }
Exemplo n.º 3
0
        public ActionResult CapNhatDiemDoPaging(int id_tcdd_db, bool allow_history = false)
        {
            try
            {
                using (Model1 db = new Model1())
                {
                    RequestPagingModel rpm = new RequestPagingModel();
                    rpm.length         = int.Parse(HttpContext.Request["length"]);
                    rpm.start          = int.Parse(Request["start"]);
                    rpm.searchValue    = HttpContext.Request["search[value]"];
                    rpm.sortColumnName = HttpContext.Request["columns[" + Request["order[0][column]"] + "][name]"];
                    rpm.sortDirection  = Request["order[0][dir]"];
                    rpm.draw           = Request["draw"];

                    int?tcdd_id = null;
                    if (id_tcdd_db != -1)
                    {
                        tcdd_id = id_tcdd_db;
                    }

                    PagingModel <DiemDoViewModel> pm = new PagingModel <DiemDoViewModel>();
                    var response = DiemDoDAO.GetDiemDoPaging(out pm, rpm, tcdd_id, allow_history);

                    if (!response)
                    {
                        return(Json(new { success = false, message = "Lỗi truy cập cơ sở dữ liệu" }, JsonRequestBehavior.AllowGet));
                        //return Json(null, JsonRequestBehavior.AllowGet);
                    }

                    return(Json(pm, JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(null);
            }
        }