Exemplo n.º 1
0
        public ActionResult AjaxHandler(JQueryDataTableParam param)
        {
            BusinessLayer <Equipment>        bl    = new BusinessLayer <Equipment>(new CapaNavDocDal());
            BusinessLayer <MaintenanceData>  mbl   = new BusinessLayer <MaintenanceData>(new CapaNavDocDal());
            BusinessLayer <ActivityField>    afbl  = new BusinessLayer <ActivityField>(new CapaNavDocDal());
            List <EquipmentDetailsViewModel> model = new List <EquipmentDetailsViewModel>(bl.GetList().Select(e => (EquipmentDetailsViewModel)e.ToModel(new EquipmentDetailsViewModel())));

            model = TableDataAdapter.Search(model, param);
            model = TableDataAdapter.SortList(model, param);
            model = TableDataAdapter.PageList(model, param);

            string[][] data = model.Select(m => new[] { m.Id.ToString(), m.PartNumber, m.Manufacturer, m.Name, m.Type,
                                                        m.Ata.ToString(),
                                                        m.ActivityFieldId.ToInt32() == 0 ? "" : afbl.Get(m.ActivityFieldId.ToInt32()).Description,
                                                        m.MechanicsGroup,
                                                        m.MaintenanceDataId.ToInt32() == 0 ? "" : mbl.Get(m.MaintenanceDataId.ToInt32()).Name,
                                                        m.MonitoringDate, m.MaintenanceDataId }).ToArray();

            return(Json(new
            {
                param.sEcho,
                iTotalRecords = model.Count,
                iTotalDisplayRecords = param.iDisplayLength,
                aaData = data
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult AjaxHandler(JQueryDataTableParam param)
        {
            BusinessLayer <User>        bl    = new BusinessLayer <User>(new CapaNavDocDal());
            List <UserDetailsViewModel> model = new List <UserDetailsViewModel>(bl.GetList().Select(u => (UserDetailsViewModel)u.ToModel(new UserDetailsViewModel())));

            model = TableDataAdapter.Search(model, param);
            model = TableDataAdapter.SortList(model, param);
            model = TableDataAdapter.PageList(model, param);

            string[][] data = model.Select(m => new[] { m.Id.ToString(), m.FirstName, m.LastName, m.UserName, m.Password }).ToArray();
            return(Json(new
            {
                param.sEcho,
                iTotalRecords = model.Count,
                iTotalDisplayRecords = param.iDisplayLength,
                aaData = data
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxHandler(JQueryDataTableParam param)
        {
            BusinessLayer <MaintenanceData>        bl    = new BusinessLayer <MaintenanceData>(new CapaNavDocDal());
            List <MaintenanceDataDetailsViewModel> model = new List <MaintenanceDataDetailsViewModel>(bl.GetList().Select(d => (MaintenanceDataDetailsViewModel)d.ToModel(new MaintenanceDataDetailsViewModel())));

            model = TableDataAdapter.Search(model, param);
            model = TableDataAdapter.SortList(model, param);
            model = TableDataAdapter.PageList(model, param);

            string[][] data = model.Select(m => new[] { m.Id, m.Type, m.Sender, m.DocumentReference, m.DocumentPartNumber, m.Review, m.Date, m.Name, m.OnCertificate, m.MonitoringDate, bl.Get(m.Id.ToInt32()).Document == null ? null : "" }).ToArray();
            return(Json(new
            {
                param.sEcho,
                iTotalRecords = model.Count,
                iTotalDisplayRecords = param.iDisplayLength,
                aaData = data
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxHandler(JQueryDataTableParam param)
        {
            BusinessLayer <ActivityField>        bl    = new BusinessLayer <ActivityField>(new CapaNavDocDal());
            List <ActivityFieldDetailsViewModel> model = new List <ActivityFieldDetailsViewModel>(bl.GetList().Select(a => (ActivityFieldDetailsViewModel)a.ToModel(new ActivityFieldDetailsViewModel())));

            model = TableDataAdapter.Search(model, param);
            model = TableDataAdapter.SortList(model, param);
            model = TableDataAdapter.PageList(model, param);

            string[][] data = model.Select(m => new[] { m.Id.ToString(), m.Description }).ToArray();
            return(Json(new
            {
                param.sEcho,
                iTotalRecords = model.Count,
                iTotalDisplayRecords = param.iDisplayLength,
                aaData = data
            }, JsonRequestBehavior.AllowGet));
        }