public ActionResult GetGetSupplierData(int id, string name) { var list = ProductDataSource.LatestProducts; var products = list.Where(x => x.Id == id).ToList(); if (!products.Any()) { return(Json(null, JsonRequestBehavior.AllowGet)); } var productsData = new JqGridData { Rows = (products.Select(product => new JqGridRowData { Id = product.Id, RowCells = new List <object> { product.Supplier.CompanyName, product.Supplier.Address, product.Supplier.PostalCode, product.Supplier.City, product.Supplier.Country, product.Supplier.Phone, product.Supplier.HomePage } })).ToList() }; return(Json(productsData, JsonRequestBehavior.AllowGet)); }
public ActionResult GetMyMsg(JqGridRequest jgreq, string condition = "DealStatus = 0", string userid = "") { int total; string conditions = string.Empty; //如果没有指定用户名,则查询当前登录用户的系统消息 string _userid = string.IsNullOrEmpty(userid) ? AuthorizationService.CurrentUserID : userid; if (!string.IsNullOrEmpty(condition)) { conditions = "UserID = '" + _userid + "' AND " + condition; } else { conditions = "UserID = '" + _userid + "' "; } IList <MyMsg> list = this.service.GetGenericService <MyMsg>().Find(jgreq, conditions, out total); JqGridData <MyMsg> data = new JqGridData <MyMsg>() { page = jgreq.PageIndex, records = total, pageSize = jgreq.RecordsCount, rows = list }; return(Json(data)); }
public ActionResult ListLastYearJson(JqGridRequest request) { var movieList = MovieListBL.GetLastYearForListing( ).AsQueryable( ); JqGridData result = GetGridData(request, movieList); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult GetData() { var data = new List<ReturnObject>(); for (int i = 0; i < 10; i++) { data.Add(new ReturnObject() { id = i, invdate = "2007-10-01", name = "test", note = "note", amount = "200.00", tax = "10.00", total = "210.00" } ); } var result = new JqGridData<ReturnObject> { page = 1, records = 10, rows = data, total = 10 }; return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult FindDepartments(string nodeid) { IList <Department> sysfuncs = null; if (string.IsNullOrEmpty(nodeid)) { sysfuncs = this.service.GetGenericService <Department>().All() .Where(d => (String.IsNullOrEmpty(d.ParentID) || d.ParentID == "0")) .ToList(); } else { sysfuncs = this.service.GetGenericService <Department>().All() .Where(d => d.ParentID == nodeid) .ToList(); } if (sysfuncs != null && sysfuncs.Count > 0) { var data = new JqGridData <Department> { rows = sysfuncs }; return(Json(data)); } else { var data = new JqGridData <Dic> { }; return(Json(data)); } }
//ToDo: Add edit delete feature shoule be added. public JsonResult SimpleCrudJsonData(JqGridPost post) { using (var ctx = new AdventureWorksLTEntities()) { //var customer = ctx.Customer.OrderBy(m => m.CustomerID).Skip(postModel.page * postModel.rows).Take(postModel.rows).ToList(); var customer = new PagedList<Customer>(ctx.Customer.OrderBy(m => m.CustomerID), post.page, post.rows); var jqRows = new List<JqGridRow>(); foreach (var item in customer) { jqRows.Add(new JqGridRow { id = item.CustomerID.ToString(), cell = { item.CustomerID, item.FirstName, item.LastName, item.EmailAddress, item.Phone } }); } var json = new JqGridData { page = post.page, records = customer.TotalCount, total = customer.TotalPages, rows = jqRows }; return Json(json, JsonRequestBehavior.AllowGet); } }
public ActionResult GetProducts(JqGridRequest request) { var list = ProductDataSource.LatestProducts; var pageIndex = request.page - 1; var pageSize = request.rows; var totalRecords = list.Count; var totalPages = (int)Math.Ceiling(totalRecords / (float)pageSize); var products = list.AsQueryable() .OrderBy(request.sidx + " " + request.sord) .Skip(pageIndex * pageSize) .Take(pageSize) .ToList(); var productsData = new JqGridData { Total = totalPages, Page = request.page, Records = totalRecords, Rows = (products.Select(product => new JqGridRowData { Id = product.Id, RowCells = new List <object> { product.Id.ToString(CultureInfo.InvariantCulture), product.Name, product.Price.ToString(CultureInfo.InvariantCulture) } })).ToList() }; return(Json(productsData, JsonRequestBehavior.AllowGet)); }
public JsonResult GetData() { var data = new List <ReturnObject>(); for (int i = 0; i < 10; i++) { data.Add(new ReturnObject() { id = i, invdate = "2007-10-01", name = "test", note = "note", amount = "200.00", tax = "10.00", total = "210.00" } ); } var result = new JqGridData <ReturnObject> { page = 1, records = 10, rows = data, total = 10 }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GetRoleDataList(int page = 1, int rows = 20, string keyword = null, string sidx = "", string sord = "asc") { if (string.IsNullOrEmpty(sidx)) { sidx = "Rid"; } var pager = new PageInfo { PageSize = rows, CurrentPageIndex = page > 0 ? page : 1 }; var queryList = new List <IMongoQuery>(); if (!string.IsNullOrWhiteSpace(keyword)) { queryList.Add(Query <sys_role> .Matches(t => t.role_name, new BsonRegularExpression(new Regex(keyword, RegexOptions.IgnoreCase)))); } var where = queryList.Any() ? Query.And(queryList) : null; long totalCount; var rm = new JqGridData { page = pager.CurrentPageIndex, rows = BusinessContext.sys_role.GetList(out totalCount, page, rows, where, sidx, sord), total = (int)(totalCount % pager.PageSize == 0 ? totalCount / pager.PageSize : totalCount / pager.PageSize + 1), records = (int)totalCount }; return(Json(rm, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDataList(int?type, int page = 1, int rows = 20, string sidx = "_id", string sord = "asc", string id = "", string keyword = "", string isApproved = "", string host = "") { sidx = string.IsNullOrWhiteSpace(sidx) ? "_id" : sidx; Session["orderBy"] = sidx; Session["desc"] = sord; Session["id"] = id; Session["keyword"] = keyword; Session["isApproved"] = isApproved; Session["host"] = host; Session["type"] = type; var currentPageIndex = page != 0 ? page : 1; int totalCount; var list = BusinessContext.ServiceList.GetModelList((ServiceTypeEnum?)type, sidx, sord, page, rows, id, keyword, isApproved, host, out totalCount); var rm = new JqGridData { page = currentPageIndex, rows = list, total = totalCount % rows == 0 ? totalCount / rows : totalCount / rows + 1, records = totalCount }; return(Json(rm, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取草稿箱 /// </summary> /// <param name="jgreq"></param> /// <param name="condition"></param> /// <returns></returns> public ActionResult GetMySuitCaseMsg(JqGridRequest jgreq, string condition = "DealStatus = 1") { int total; string conditions = string.Empty; //如果没有指定用户名,则查询当前登录用户的系统消息 string _sender = AuthorizationService.CurrentUserID;//此处改为UserID,以方便处理 xyl 2014-02-28 if (!string.IsNullOrEmpty(condition)) { conditions = "Sender = '" + _sender + "' AND " + condition; } else { conditions = "Sender = '" + _sender + "' "; } IList <SystemMsg> list = this.service.GetGenericService <SystemMsg>().Find(jgreq, conditions, out total); JqGridData <SystemMsg> data = new JqGridData <SystemMsg>() { page = jgreq.PageIndex, records = total, pageSize = jgreq.RecordsCount, rows = list }; return(Json(data)); }
public JsonResult GetFileList(int secondaryId, int page = 1, int rows = 20, string sidx = "", string sord = "asc") { if (string.IsNullOrEmpty(sidx)) { sidx = "Rid"; } var pager = new PageInfo { PageSize = rows, CurrentPageIndex = page > 0 ? page : 1 }; long totalCount; var rm = new JqGridData { page = pager.CurrentPageIndex, rows = BusinessContext.Files.GetList(out totalCount, page, rows, Query <FileEntity> .EQ(t => t.SecondaryId, secondaryId), sidx, sord), total = (int) (totalCount % pager.PageSize == 0 ? totalCount / pager.PageSize : totalCount / pager.PageSize + 1), records = (int)totalCount }; return(Json(rm, JsonRequestBehavior.AllowGet)); }
public ActionResult GetSuperSearchForWriter(JqGridRequest request) { string keyword = GetSearchKeyword( ); var movieList = MovieListBL.SearchSuperblyForWriters(keyword).AsQueryable( ); JqGridData result = GetGridData(request, movieList); return(Json(result, JsonRequestBehavior.AllowGet)); }
/* Setup available columns for the grid */ private static JqGridData<Log> GetGridData() { var gridData = new JqGridData<Log>(); gridData.IdFunction = l => l.Id; gridData.AddColumn("Id", l => l.Id, true); gridData.AddColumn("Message", l => l.Message, true); gridData.AddColumn("Logged", l => l.DateTime, false); return gridData; }
public ActionResult GetAuthFunctionInfoListData(Guid appId, Guid parentId) { JqGridData <AuthFunctionInfoModel> list = new JqGridData <AuthFunctionInfoModel>(); list.PageIndex = 1; list.TotalPages = 1; list.TotalRecords = 10000; list.DataList = this._authManagerService.GetSubAuthFunctionInfoList(appId, parentId); return(Json(list)); }
public virtual JqGridData ConvertIListToJqGridData(int currentPage, int pageSize, int totalRecordCount, IList currentPageData) { JqGridData result = new JqGridData(); result.page = currentPage; result.records = totalRecordCount; result.rows = currentPageData; result.total = (int)Math.Ceiling((double)totalRecordCount / pageSize); return(result); }
/* Setup available columns for the grid */ private static JqGridData <Log> GetGridData() { var gridData = new JqGridData <Log>(); gridData.IdFunction = l => l.Id; gridData.AddColumn("Id", l => l.Id, true); gridData.AddColumn("Message", l => l.Message, true); gridData.AddColumn("Logged", l => l.DateTime, false); return(gridData); }
public ActionResult GetTodayTasks() { var list = this.service.ProduceTask.GetTodayTasks(); var result = new JqGridData <ProduceTask> { records = list.Count, rows = list }; return(Json(result)); }
public ActionResult GetProducts(JqGridRequest request, string hiddenColumns) { var list = ProductDataSource.LatestProducts; var pageIndex = request.page - 1; var pageSize = request.rows; var totalRecords = list.Count; var totalPages = (int)Math.Ceiling(totalRecords / (float)pageSize); var productsQuery = list.AsQueryable(); productsQuery = new JqGridSearch(request, this.Request.Form, DateTimeType.Persian).ApplyFilter(productsQuery); productsQuery = productsQuery.OrderBy(request.sidx + " " + request.sord); if (string.IsNullOrWhiteSpace(request.oper)) { productsQuery = productsQuery .Skip(pageIndex * pageSize) .Take(pageSize); } else if (request.oper == "excel") { productsQuery = productsQuery .Skip(pageIndex * pageSize); } var productsList = productsQuery.ToList(); if (!string.IsNullOrWhiteSpace(request.oper) && request.oper == "excel") { new ProductsPdfReport().CreatePdfReport(productsList, hiddenColumns == null ? new string[] { } : hiddenColumns.Split(',')); } var productsData = new JqGridData { Total = totalPages, Page = request.page, Records = totalRecords, Rows = (productsList.Select(product => new JqGridRowData { Id = product.Id, RowCells = new List <object> { product.Id.ToString(CultureInfo.InvariantCulture), product.Name, product.AddDate.ToPersianDate(), product.Price.ToString(CultureInfo.InvariantCulture) } })).ToArray() }; return(Json(productsData, JsonRequestBehavior.AllowGet)); }
public ActionResult GetComments(JqGridRequest request, int?nodeid, int?parentid, int?n_level) { var list = BlogCommentsDataSource.LatestBlogComments; // در این حالت خاص فعلا در نگارش جای جیکیوگرید صفحه بندی کار نمیکند و فعال نیست و محاسبات ذیل اهمیتی ندارند var pageIndex = request.page - 1; var pageSize = request.rows; var totalRecords = list.Count; var totalPages = (int)Math.Ceiling(totalRecords / (float)pageSize); var productsQuery = list.AsQueryable(); if (nodeid == null) { productsQuery = productsQuery.Where(x => x.ParentId == null); } else { productsQuery = productsQuery.Where(x => x.ParentId == nodeid.Value); } var products = productsQuery.OrderBy(request.sidx + " " + request.sord) .Skip(pageIndex * pageSize) .Take(pageSize) .ToList(); var newLevel = n_level == null ? 0 : n_level.Value + 1; var productsData = new JqGridData { Total = totalPages, Page = request.page, Records = totalRecords, Rows = (products.Select(comment => new JqGridRowData { Id = comment.Id, RowCells = new List <object> { comment.Id, comment.Body, comment.AddDateTime.ToPersianDate(), // اطلاعات خاص نمایش درختی به ترتیب newLevel, comment.ParentId == null ? "" : comment.ParentId.Value.ToString(CultureInfo.InvariantCulture), comment.IsNotExpandable, comment.IsExpanded } })).ToList() }; return(Json(productsData, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取交班时间可调度的任务单 /// </summary> /// <param name="request"></param> /// <param name="condition"></param> /// <returns></returns> public ActionResult GetRangeTimeTasks(JqGridRequest request, string condition) { var list = this.service.ProduceTask.GetRangeTimeTasks(request); JqGridData <ProduceTask> data = new JqGridData <ProduceTask>() { page = request.PageIndex, records = list.Count, pageSize = request.RecordsCount, rows = list }; return(Json(data)); }
/// <summary> /// 获取可分配的筒仓 /// </summary> /// <param name="pid"></param> /// <param name="type"></param> /// <returns></returns> public virtual ActionResult FindAvailableSilo(string pid, int?type) { IList <Silo> queryList = this.service.ProductLine.FindSilo(pid, type); JqGridData <Silo> data = new JqGridData <Silo>() { page = 1, records = queryList.Count, pageSize = queryList.Count, rows = queryList }; return(Json(data)); }
/// <summary> /// 机组筒仓查询 /// </summary> /// <param name="request"></param> /// <param name="condition"></param> /// <returns></returns> public virtual ActionResult FindSilo(string pid) { ProductLine p = this.service.GetGenericService <ProductLine>().Get(pid); IList <SiloProductLine> siloList = p.SiloProductLines; JqGridData <SiloProductLine> data = new JqGridData <SiloProductLine>() { page = 1, records = siloList.Count, pageSize = siloList.Count, rows = siloList }; return(Json(data)); }
public ActionResult GetHotMarkData(string condition) { IList <GPS_HotMark> list = m_ServiceBase.All(condition, "ID", true); JqGridData <GPS_HotMark> data = new JqGridData <GPS_HotMark>() { page = 1, records = list.Count, pageSize = list.Count, rows = list }; return(Json(data)); }
public JsonResult GetTablesInfo() { SqlServerHelper helper = new SqlServerHelper(); IList <DBTableInfo> tables = helper.GetTablesInfo(); JqGridData <DBTableInfo> data = new JqGridData <DBTableInfo>() { page = 1, records = tables.Count, pageSize = tables.Count, rows = tables }; return(Json(data)); }
public JsonResult GetDBFileInfo() { SqlServerHelper helper = new SqlServerHelper(); var tables = helper.GetDBFileInfo(); JqGridData <dynamic> data = new JqGridData <dynamic>() { page = 1, records = tables.Count, pageSize = tables.Count, rows = tables }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public virtual ActionResult Find(JqGridRequest request, string condition) { int total; IList <TEntity> list = m_ServiceBase.Find(request, condition, out total); JqGridData <TEntity> data = new JqGridData <TEntity>() { page = request.PageIndex, records = total, pageSize = request.RecordsCount, rows = list }; return(Json(data)); }
public virtual ActionResult SumByRecord(JqGridRequest request, string condition) { int total; IList <DailyReport> list = this.service.ShippingDocument.GetShipDocList(request, condition, out total); JqGridData <DailyReport> data = new JqGridData <DailyReport>() { page = request.PageIndex, records = total, pageSize = request.RecordsCount, rows = list }; return(Json(data)); }
public ActionResult GetDataList(string LoginName = null, int page = 1, int rows = 20, string sidx = "_id", string sord = "asc") { int CurrentPageIndex = (page != 0 ? (int)page : 1); sidx = string.IsNullOrWhiteSpace(sidx) ? "_id" : sidx; List <UserEntity> list = BusinessContext.User.GetModelList(null, sidx, sord, page, rows); int totalCount = BusinessContext.User.GetCount(null); JqGridData RM = new JqGridData(); RM.page = CurrentPageIndex; RM.rows = list; RM.total = (totalCount % rows == 0 ? totalCount / rows : totalCount / rows + 1); RM.records = totalCount; return(Json(RM, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDataList(int page = 1, int rows = 20, string sidx = "_id", string sord = "asc") { int currentPageIndex = page != 0 ? page : 1; sidx = string.IsNullOrWhiteSpace(sidx) ? "_id" : sidx; var list = BusinessContext.User.GetModelList(null, sidx, sord, page, rows); var totalCount = BusinessContext.User.GetCount(null); var rm = new JqGridData(); rm.page = currentPageIndex; rm.rows = list; rm.total = totalCount % rows == 0 ? totalCount / rows : totalCount / rows + 1; rm.records = totalCount; return(Json(rm, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 查找菜单 /// </summary> /// <param name="nodeid"></param> /// <returns></returns> public ActionResult FindFuncs(string nodeid) { var sysfuncs = this.service.SysFunc.FindFuncs(nodeid); if (sysfuncs != null && sysfuncs.Count > 0) { var data = new JqGridData <SysFunc> { rows = sysfuncs }; return(Json(data)); } else { return(new EmptyResult()); } }
public ActionResult GetFunctionalDataList(string Module_Name = "", string Group_Name = "", string Right_Name = "", int page = 1, int rows = 20, string sidx = "", string sord = "asc") { if (string.IsNullOrEmpty(sidx)) { sidx = "Rid"; } var pager = new PageInfo { PageSize = rows, CurrentPageIndex = page > 0 ? page : 1 }; List <IMongoQuery> queryList = new List <IMongoQuery>(); if (!string.IsNullOrWhiteSpace(Module_Name)) { queryList.Add(Query <FunctionalAuthority> .Matches(t => t.Module_Name, new BsonRegularExpression(new Regex(Module_Name, RegexOptions.IgnoreCase)))); } if (!string.IsNullOrWhiteSpace(Group_Name)) { queryList.Add(Query <FunctionalAuthority> .Matches(t => t.Group_Name, new BsonRegularExpression(new Regex(Group_Name, RegexOptions.IgnoreCase)))); } if (!string.IsNullOrWhiteSpace(Right_Name)) { queryList.Add(Query <FunctionalAuthority> .Matches(t => t.Right_Name, new BsonRegularExpression(new Regex(Right_Name, RegexOptions.IgnoreCase)))); } var where = queryList.Any() ? Query.And(queryList) : null; long totalCount; //string orderBy = "module_id,group_id,right_Id"; var rm = new JqGridData { page = pager.CurrentPageIndex, rows = _bll.GetList(out totalCount, page, rows, where, sidx, sord), total = (int)(totalCount % pager.PageSize == 0 ? totalCount / pager.PageSize : totalCount / pager.PageSize + 1), records = (int)totalCount }; return(Json(rm, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDeviceTypeList(int page = 1, int rows = 20, BasicType search = null, string sidx = null, string sord = "asc") { if (string.IsNullOrEmpty(sidx)) { sidx = "TypeId"; } var pager = new PageInfo { PageSize = rows, CurrentPageIndex = page > 0 ? page : 1 }; List <IMongoQuery> queryList = null; if (search != null) { queryList = new List <IMongoQuery>(); if (search.TypeId.HasValue) { queryList.Add(Query <BasicType> .EQ(t => t.TypeId, search.TypeId)); } if (search.Num.HasValue) { queryList.Add(Query <BasicType> .EQ(t => t.Num, search.Num)); } if (!string.IsNullOrWhiteSpace(search.Name)) { queryList.Add(Query <BasicType> .EQ(t => t.Name, search.Name)); } } var where = queryList != null && queryList.Any() ? Query.And(queryList) : null; long totalCount; var rm = new JqGridData { page = pager.CurrentPageIndex, rows = _bll.GetList(out totalCount, page, rows, where, sidx, sord), total = (int)(totalCount % pager.PageSize == 0 ? totalCount / pager.PageSize : totalCount / pager.PageSize + 1), records = (int)totalCount }; return(Json(rm, JsonRequestBehavior.AllowGet)); }