/// <summary> /// 根据搜索条件获取企业付款历史 /// </summary> /// <param name="searchParas">搜索条件</param> /// <param name="para">页码信息</param> /// <returns></returns> public JsonResult GetPaymentInfos(Search_RedPacketHistory searchParas, GridParams para) { para.pagenum = para.pagenum + 1;//页0,+1 var list = _redPacketLogic.GetPaymentInfos(searchParas, para); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult GetItems(GridParams g, string search, int?productCategory, int[] products) { g.PageSize = 10; var list = repo.Where(o => o.Description.Contains(search), User.IsInRole("admin")); if (productCategory.HasValue) { list = list.Where(o => o.Products.All(m => m.ProductCategoryId.Equals(productCategory))); } if (products != null) { list = list.Where(o => products.All(m => o.Products.Select(product => product.Id).Contains(m))); } else { int userId = userService.GetUserIdByName(HttpContext.User.Identity.Name) == 0 ? 0 : userService.GetUserIdByName(HttpContext.User.Identity.Name); list = list.Where(o => o.Products.All(m => m.Userid.Equals(userId))); } //by default ordering by id list = list.OrderByDescending(o => o.Id); return(Json(new GridModelBuilder <cm.Promotion>(list.AsQueryable(), g) { // Key = "Id", this is needed for EF to always sort by something, but we already do order by Id Map = o => new { o.Id, o.IsDeleted, o.Description, ProductsCount = o.Products.Count, } }.Build())); }
public ActionResult GridESCategory(GridParams gridParams) { var esCategory = _planningBlueprintService.GetESCategories(new GetESCategoriesRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = esCategory.TotalRecords, iTotalRecords = esCategory.ESCategories.Count, aaData = esCategory.ESCategories.Select(x => new { x.Id, x.IsActive, x.Name, Type = x.Type.ToString() }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 分页获取 /// for user /// </summary> /// <param name="param"></param> /// <returns></returns> public async Task <JsonResultModel <ArticleInfo> > GetPageLsit(GridParams param) { //只查询已发布的 var exp = Expressionable.Create <ArticleInfo>().And(it => it.IsPublished); return(await base.GetPageList(param, exp.ToExpression())); }
public ActionResult GroupRead(GridParams g, string search, int? zoneId) { search = (search ?? "").Trim(); var m = _groupService.GetAll(); m = zoneId.HasValue ? m.Where(i => i.ZoneId == zoneId) : m; var model = m.Select(i => new GroupListModel() { Id = i.Id, UniqueId = i.UniqueId, Name = i.Name, ZoneId = i.ZoneId, ZoneName = i.Zone.Name }); return Json(new GridModelBuilder<GroupListModel>(model, g) { Key = "Id", Map = o => new { o.Id, o.Name, o.UniqueId, o.ZoneId, o.ZoneName } }.Build()); }
public ActionResult Grid(GridParams gridParams) { var outputConfig = _outputConfigService.GetOutputConfigs(new GetOutputConfigsRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = outputConfig.TotalRecords, iTotalRecords = outputConfig.OutputConfigs.Count, aaData = outputConfig.OutputConfigs.Select(x => new { x.Id, x.Name, x.Category, x.Measurement, Formula = x.Formula.ToString(), x.Order, x.Remark, x.IsActive }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Grid(GridParams gridParams) { var operational = _operationDataService.GetOperationalDatas(new GetOperationalDatasRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = operational.TotalRecords, iTotalRecords = operational.OperationalDatas.Count, aaData = operational.OperationalDatas.Select(x => new { x.Id, x.KeyOperation, x.Kpi, Periode = x.Periode.ToString(DateFormat.DateForGrid), x.PeriodeType, x.Remark, x.Scenario, x.Value }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var list = Db.Purchases.Where(o => o.Customer.ToLower().Contains(search) || o.Product.ToLower().Contains(search)); return(Json(new GridModelBuilder <Purchase>(list.OrderByDescending(o => o.Id).AsQueryable(), g).Build())); }
public ActionResult GetItems(GridParams g, string search, int? chef, int[] meals) { g.PageSize = 10; var list = repo.Where(o => o.Name.Contains(search), User.IsInRole("admin")); if (chef.HasValue) list = list.Where(o => o.ChefId == chef.Value); if (meals != null) list = list.Where(o => meals.All(m => o.Meals.Select(meal => meal.Id).Contains(m))); //by default ordering by id list = list.OrderByDescending(o => o.Id); return Json(new GridModelBuilder<Dinner>(list.AsQueryable(), g) { // Key = "Id", this is needed for EF to always sort by something, but we already do order by Id Map = o => new { o.Id, o.IsDeleted, o.Name, CountryName = o.Country.Name, o.Address, MealsCount = o.Meals.Count, ChefName = o.Chef.FirstName + " " + o.Chef.LastName, } }.Build()); }
public ActionResult BuildReportForAllPartnershipsByMonthAndByYearForPartner(GridParams g, int id) { var model = _partnershipService.GetPartnershipRecordsForPartner(id) .GroupBy(o => new {o.Currency, o.Year, o.Month}) .Select(o => new PartnershipArmReportObject() { Year = o.Key.Year, Month = o.Key.Month, CurrencyId = o.Key.Currency.Id, CurrencyName = o.Key.Currency.Symbol, PartnerId = id, Amount = o.Sum((m => m.Amount)) }); return Json( new GridModelBuilder<PartnershipArmReportObject>( model.OrderByDescending(k => k.Year).ThenByDescending(l => l.Month), g) { Map = o => new { o.Year, Month = ((MonthEnums)o.Month).ToString(), o.CurrencyName, o.CurrencyId, o.Amount, } }.Build()); }
public ActionResult BuildReportForAllPartnershipsByMonthAndByYearForPartnerWithDefault(GridParams g, int id) { var defaultCurrency = _currencyService.GetDefault(); var model = _partnershipService.GetPartnershipRecordsForPartner(id) .GroupBy(o => new { o.Year, o.Month}) .Select(o => new PartnershipArmReportObject() { Month = o.Key.Month, Year = o.Key.Year, DenominatedCurrencyName = defaultCurrency.Symbol, PartnerId = id, DenominatedAmount = o.Sum((m => (m.Amount * m.Currency.ConversionRateToDefault))) }); return Json(new GridModelBuilder<PartnershipArmReportObject>( model.OrderByDescending(k => k.Year).ThenByDescending(K => K.Month), g) { Map = o => new { Month = ((MonthEnums)o.Month).ToString(), o.Year, o.DenominatedAmount, o.DenominatedCurrencyName, o.PartnerId, } }.Build()); }
public ActionResult GetItems(GridParams g, string person, string food) { food = (food ?? "").ToLower(); person = (person ?? "").ToLower(); var list = Db.Lunches .Where(o => o.Food.ToLower().Contains(food) && o.Person.ToLower().Contains(person)) .AsQueryable(); return Json(new GridModelBuilder<Lunch>(list, g) { // Key = "Id", // needed when using Entity Framework Map = o => new { o.Id, o.Person, o.Food, o.Location, o.Price, o.Date, CountryName = o.Country.Name, ChefName = o.Chef.FirstName + " " + o.Chef.LastName } }.Build()); }
public ActionResult GetItems(GridParams g, string person, string food, int?country) { food = (food ?? "").ToLower(); person = (person ?? "").ToLower(); var list = Db.Lunches .Where(o => o.Food.ToLower().Contains(food) && o.Person.ToLower().Contains(person)) .AsQueryable(); if (country.HasValue) { list = list.Where(o => o.Country.Id == country); } return(Json(new GridModelBuilder <Lunch>(list, g) { Key = "Id", // needed for Entity Framework | nesting | tree | api Map = o => new { o.Id, o.Person, o.Food, o.Location, o.Price, Date = o.Date.ToShortDateString(), CountryName = o.Country.Name, ChefName = o.Chef.FirstName + " " + o.Chef.LastName } }.Build())); }
public ActionResult Grid(GridParams gridParams) { var menus = _menuService.GetMenusForGrid(new GetMenusRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, SortingDictionary = gridParams.SortingDictionary, Search = gridParams.Search }); var data = new { sEcho = gridParams.Echo + 1, iTotalRecords = menus.Menus.Count, iTotalDisplayRecords = menus.TotalRecords, aaData = menus.Menus }; var list = JsonConvert.SerializeObject(data, Formatting.None, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return(Content(list, "application/json")); }
public ActionResult GetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var list = Db.Purchases.Where(o => o.Customer.ToLower().Contains(search) || o.Product.ToLower().Contains(search)); return Json(new GridModelBuilder<Purchase>(list.OrderByDescending(o => o.Id).AsQueryable(), g).Build()); }
public ActionResult Grid(GridParams gridParams) { var NLS = _nlsService.GetNLSListForGrid(new GetNLSListRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = NLS.TotalRecords, iTotalRecords = NLS.NLSList.Count, aaData = NLS.NLSList.Select(x => new { x.Vessel, CreatedAt = x.CreatedAt.ToString(DateFormat.DateForGrid), x.Remark, x.Id }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult ChapterRead(GridParams g, int? zoneId, int? groupId) { var i = _churchService.GetAll(); i = zoneId.HasValue ? i.Where(j => j.Group.ZoneId == zoneId) : i; i = groupId.HasValue ? i.Where(j => j.GroupId == groupId) : i; var m = i.Select(j => new ChapterListModel { Id = j.Id, UniqueId = j.UniqueId, Name = j.Name, GroupId = j.GroupId, ZoneName = j.Group.Zone.Name, GroupName = j.Group.Name }); return Json(new GridModelBuilder<ChapterListModel>(m, g) { Key = "Id", Map = o => new { o.Id, o.Name, o.UniqueId, o.GroupId, o.GroupName, o.ZoneName } }.Build()); }
public ActionResult GetItems(GridParams g) { return(Json(new GridModelBuilder <Lunch>(Db.Lunches.AsQueryable(), g) { Map = o => new { o.Person, o.Price, o.Food, Date = o.Date.ToString("dd MMMM yyyy"), o.Location, o.Organic, RowClass = o.Price > 90 ? "pinkb" : o.Price < 30 ? "greenb" : string.Empty }, MakeHeader = gr => { var value = AweUtil.GetColumnValue(gr.Column, gr.Items.First()).Single(); var strVal = gr.Column == "Date" ? ((DateTime)value).ToString("dd MMMM yyyy") : gr.Column == "Price" ? value + " GBP" : value.ToString(); return new GroupHeader { Content = gr.Header + " - " + strVal }; } }.Build())); }
public ActionResult AddressesGridGetItems(GridParams g, int restaurantId) { var items = Db.RestaurantAddresses.Where(o => o.RestaurantId == restaurantId).AsQueryable(); var model = new GridModelBuilder <RestaurantAddress>(items, g).Build(); return(Json(model)); }
public ActionResult GetAllMissingTranslations(GridParams g) { var items = Ilanguages.GetAll().AsQueryable(); List <languages> data = new List <languages>(); AdminController admin = new AdminController(); foreach (var column in items) { System.Data.DataTable table = admin.getTable(); for (int i = table.Rows.Count - 1; i >= 0; i--) { // whatever your criteria is if (table.Rows[i][column.LanguageName].ToString() != "") { table.Rows[i].Delete(); } } languages a = new languages(); a.Id = Convert.ToInt32(column.Id); a.LanguageCode = column.LanguageCode; a.LanguageName = column.LanguageName; a.MissingTranslationCount = table.Rows.Count; data.Add(a); } var key = Convert.ToInt32(g.Key); var model = new GridModelBuilder <languages>(data.AsQueryable(), g) { Key = "Id", GetItem = () => data.Single(x => x.Id == key) }.Build(); return(Json(model)); }
public ActionResult MultiColGrid(GridParams g) { g.Paging = false; var items = new List <GridArrayRow>(); for (var i = 1; i < data.Count; i++) { items.Add(new GridArrayRow { Id = data[i][0], Values = data[i].ToArray() }); } // reinit columns at start or when new column has been added if (g.Columns.Length == 0 || g.Columns.Length != data[0].Count - 1) { var columns = new List <Column>(); for (var i = 1; i < data[0].Count; i++) { columns.Add(new Column { Header = data[0][i], Bind = i.ToString(), ClientFormatFunc = "txtVal(" + i + ")", Resizable = true }); } g.Columns = columns.ToArray(); } var model = new GridModelBuilder <GridArrayRow>(items.AsQueryable(), g).Build(); return(Json(model)); }
public ActionResult Grid(GridParams gridParams) { var waves = _waveService.GetWavesForGrid(new GetWavesRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = waves.TotalRecords, iTotalRecords = waves.Waves.Count, aaData = waves.Waves.Select(x => new { x.Id, PeriodeType = x.PeriodeType.ToString(), Date = x.Date.ToString(DateFormat.DateForGrid), x.Value, x.Speed, x.Tide }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetItems(GridParams g, string search, int? productCategory, int[] products) { g.PageSize = 10; var list = repo.Where(o => o.Description.Contains(search), User.IsInRole("admin")); if (productCategory.HasValue) { list = list.Where(o => o.Products.All(m => m.ProductCategoryId.Equals(productCategory))); } if (products != null) { list = list.Where(o => products.All(m => o.Products.Select(product => product.Id).Contains(m))); } else { int userId = userService.GetUserIdByName(HttpContext.User.Identity.Name) == 0 ? 0 : userService.GetUserIdByName(HttpContext.User.Identity.Name); list = list.Where(o => o.Products.All(m => m.Userid.Equals(userId))); } //by default ordering by id list = list.OrderByDescending(o => o.Id); return Json(new GridModelBuilder<cm.Promotion>(list.AsQueryable(), g) { // Key = "Id", this is needed for EF to always sort by something, but we already do order by Id Map = o => new { o.Id, o.IsDeleted, o.Description, ProductsCount = o.Products.Count, } }.Build()); }
public ActionResult GetItems(GridParams g, string search, int?chef, int[] meals) { g.PageSize = 10; var list = repo.Where(o => o.Name.Contains(search), User.IsInRole("admin")); if (chef.HasValue) { list = list.Where(o => o.ChefId == chef.Value); } if (meals != null) { list = list.Where(o => meals.All(m => o.Meals.Select(meal => meal.Id).Contains(m))); } //by default ordering by id list = list.OrderByDescending(o => o.Id); return(Json(new GridModelBuilder <Dinner>(list.AsQueryable(), g) { // Key = "Id", this is needed for EF to always sort by something, but we already do order by Id Map = o => new { o.Id, o.IsDeleted, o.Name, CountryName = o.Country.Name, o.Address, MealsCount = o.Meals.Count, ChefName = o.Chef.FirstName + " " + o.Chef.LastName, } }.Build())); }
/*end1*/ /*begin2*/ public ActionResult LazyTree(GridParams g) { var rootNodes = Db.TreeNodes.Where(o => o.Parent == null); var builder = new GridModelBuilder <TreeNode>(rootNodes.AsQueryable(), g) { Key = "Id", // required for the TreeGrid GetChildren = (node, nodeLevel) => { var children = Db.TreeNodes.Where(o => o.Parent == node).AsQueryable(); // set this node as lazy when it's above level 1 (relative), it has children, and this is not a lazy request already if (nodeLevel > 1 && children.Any() && g.Key == null) { return(Awe.LazyNode); } return(children); }, GetItem = () => // used for lazy loading { var id = Convert.ToInt32(g.Key); return(Db.TreeNodes.FirstOrDefault(o => o.Id == id)); }, Map = o => new { o.Name, o.Id } }; return(Json(builder.Build())); }
public List <UserMaster> Search(UserMasterSearchDto model, ref GridParams gridParams) { var query = from u in _userMasterRepository.Table select u; if (!String.IsNullOrEmpty(model.UserID)) { query = query.Where(t => t.UserID == model.UserID); } if (!String.IsNullOrEmpty(model.EmailAdd)) { query = query.Where(t => t.EmailAdd == model.EmailAdd); } if (model.ReaderType.HasValue) { query = query.Where(t => t.ReaderType == model.ReaderType); } if (model.BranchCode.HasValue) { query = query.Where(t => t.BranchCode == model.BranchCode); } if (model.PasswordExprityDateFrom != Convert.ToDateTime("1900-01-01")) { query = query.Where(t => t.PasswordExprityDate >= model.PasswordExprityDateFrom); } if (model.PasswordExprityDateTo != Convert.ToDateTime("1900-01-01")) { query = query.Where(t => t.PasswordExprityDate < model.PasswordExprityDateTo); } gridParams.TotalCount = query.Count(); return(QueryExtensions.SortAndPage(query, gridParams).ToList()); }
public ActionResult MealsGrid(GridParams g) { return(Json(new GridModelBuilder <Meal>(Db.Meals.AsQueryable(), g) { Key = "Id" }.Build())); }
public ActionResult Grid(GridParams gridParams) { var vessel = _vesselScheduleService.GetVesselSchedulesForGrid(new GetVesselSchedulesRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = vessel.TotalRecords, iTotalRecords = vessel.VesselSchedules.Count, aaData = vessel.VesselSchedules.Select(x => new { x.Vessel, ETA = x.ETA.HasValue ? x.ETA.Value.ToString(DateFormat.DateForGrid) : string.Empty, ETD = x.ETD.HasValue ? x.ETD.Value.ToString(DateFormat.DateForGrid) : string.Empty, x.Buyer, x.Location, x.SalesType, x.Type, x.Cargo, x.IsActive, x.id }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Grid(GridParams gridParams) { var periode = _periodeService.GetPeriodesForGrid(new GetPeriodesRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = periode.TotalRecords, iTotalRecords = periode.Periodes.Count, aaData = periode.Periodes.Select(x => new { x.Id, x.IsActive, Name = x.Name.ToString(), x.Remark }) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
/*begin*/ public ActionResult CategoriesGrid(GridParams g) { return(Json(new GridModelBuilder <Category>(Db.Categories.AsQueryable(), g) { Key = "Id" }.Build())); }
public ActionResult Grid(GridParams gridParams) { var inputDatas = _inputDataService.GetInputData(new GetInputDatasRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, SortingDictionary = gridParams.SortingDictionary, Search = gridParams.Search }); inputDatas.InputDatas.Add(new GetInputDatasResponse.InputData { Name = "Input Data DER", PeriodeType = "Daily" }); IList <GetInputDatasResponse.InputData> inputDatasResponse = inputDatas.InputDatas; var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = inputDatas.TotalRecords + 1, iTotalRecords = inputDatas.InputDatas.Count, aaData = inputDatasResponse }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetItems(GridParams g, string person, string food) { food = (food ?? "").ToLower(); person = (person ?? "").ToLower(); var list = Db.Lunches .Where(o => o.Food.ToLower().Contains(food) && o.Person.ToLower().Contains(person)) .AsQueryable(); return(Json(new GridModelBuilder <Lunch>(list, g) { // Key = "Id", // needed when using Entity Framework Map = o => new { o.Id, o.Person, o.Food, o.Location, o.Price, o.Date, CountryName = o.Country.Name, ChefName = o.Chef.FirstName + " " + o.Chef.LastName } }.Build())); }
public ActionResult GetItems(GridParams g, bool collapsed) { //passing 2 Functions MakeFooter and MakeHeader to customize header and add footer var builder = new GridModelBuilder <Lunch>(Db.Lunches.AsQueryable(), g) { Key = "Id", Map = o => new { o.Id, o.Person, o.Food, Date = o.Date.ToShortDateString(), o.Price, o.Location, ChefName = o.Chef.FirstName + " " + o.Chef.LastName }, MakeFooter = MakeFooter, MakeHeader = gr => { //get first item in the group var first = gr.Items.First(); //get the grouped column value(s) for the first item var val = string.Join(" ", AweUtil.GetColumnValue(gr.Column, first).Select(ToStr)); return(new GroupHeader { Content = string.Format(" {0} : {1} ( Count = {2}, Max Price = {3} )", gr.Header, val, gr.Items.Count(), gr.Items.Max(o => o.Price)), Collapsed = collapsed }); } }; return(Json(builder.Build())); }
/// <summary> /// 获取导入推送中不存在的人员信息 /// </summary> /// <param name="para"></param> /// <returns></returns> public JsonResult GetNotExistPeople(GridParams para) { para.pagenum = para.pagenum + 1; var notExistPeople = _dl.GetNotExistPeople(para); return(Json(notExistPeople, JsonRequestBehavior.AllowGet)); }
private GridModel <variable_vw> BuildGridModel(GridParams g) { // retreive Session info created when selections were made to mpre-map grid Dictionary <string, string> GroupedIds = Session["PreMap_GroupedIds"] as Dictionary <string, string>; var dt = ado.GetVariable_vw(GroupedIds); return(new GridModelBuilder <variable_vw>(dt.AsQueryable(), g) { // same as pre-map setup Key = "nid", //Map = o => new { o.Id, o.Person, o.Food, o.Date, o.Price, o.Location, ChefName = o.Chef.FirstName + " " + o.Chef.LastName }, MakeFooter = MakeFooter, MakeHeader = gr => { //get first item in the group var first = gr.Items.First(); //get the grouped column value(s) for the first item var val = string.Join(" ", AweUtil.GetColumnValue(gr.Column, first).Select(ToStr)); return new GroupHeader { Content = string.Format(" {0} : {1} ( Count = {2}, <input type='checkbox' name='id' value='{3}'/> )", gr.Header, val, gr.Items.Count(), //gr.Items.Max(o => o.delta) null), Collapsed = false }; } }.Build()); }
public ActionResult Grid(GridParams gridParams, string periodeType) { var highlight = _highlightService.GetHighlightsForGrid(new GetHighlightsRequest { Skip = gridParams.DisplayStart, Take = gridParams.DisplayLength, Search = gridParams.Search, SortingDictionary = gridParams.SortingDictionary }); var data = new { sEcho = gridParams.Echo + 1, iTotalDisplayRecords = highlight.TotalRecords, iTotalRecords = highlight.Highlights.Count, aaData = highlight.Highlights.Where(x => x.PeriodeType == (PeriodeType)Enum.Parse(typeof(PeriodeType),periodeType)).Select(x => new { x.Id, Date = x.Date.ToString(DateFormat.DateForGrid), x.IsActive, PeriodeType = x.PeriodeType.ToString(), x.Type, x.Title, x.Message }) }; var jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return jsonResult; }
public ActionResult ScheduleGetItems(GridParams g, int minutesOffset, DateTime?date, SchedulerView?viewType, SchedulerHour?hoursType, int?hourStep, string cmd) { var model = new SchedulerModelBuilder(g) { GetEvents = (startUtc, endUtc) => Db.Meetings.Where(o => o.Start < endUtc && o.End >= startUtc) .Select(o => new SchedulerEvent { AllDay = o.AllDay, Color = o.Color, Id = o.Id, Start = o.Start, End = o.End, Title = o.Title, Notes = o.Notes }), Cmd = cmd, Date = date, HourStep = hourStep, HoursType = hoursType, MinutesOffset = minutesOffset, ViewType = viewType }.Build(); return(Json(model)); }
public IActionResult Listar(GridParams parametros, Enums.Status?status, Enums.Situacao?situacao) { CampoOrdenado campo = parametros.ObterCampoOrdenado(Request); var dadosPaginados = servico.ListarPaginado(parametros.Current, parametros.rowCount, parametros.SearchPhrase, campo.Campo, campo.Ordem, status, situacao); var retorno = Json(new { current = dadosPaginados.Pagina, rowCount = dadosPaginados.QuantidadePorPagina, rows = dadosPaginados.Dados, total = dadosPaginados.Total }); return(retorno); }
/*begin*/ public ActionResult GetItems(GridParams g, string[] selectedColumns, bool? choosingColumns) { //when setting columns from here we don't get the grid defaults, so we have to specify Sortable, Groupable etc. var columns = new[] { new Column { Name = "Id", Width = 70, Order = 1 }, new Column { Name = "Person", Sortable = true, Groupable = true, GroupRemovable = true, Order = 2 }, new Column { Name = "Food", Sortable = true, Groupable = true, GroupRemovable = true, Order = 3 }, new Column { Name = "Location", Sortable = true, Groupable = true, GroupRemovable = true, Order = 4 }, new Column { Name = "Date", Sortable = true, Groupable = true, GroupRemovable = true, Width = 100, Order = 5 }, new Column { Name = "Price", Sortable = true, Groupable = true, GroupRemovable = true, Width = 100, Order = 6 }, }; var baseColumns = new[] { "Id", "Person" }; //first load if (g.Columns.Length == 0) { g.Columns = columns; } if (choosingColumns.HasValue && selectedColumns == null) { selectedColumns = new string[] { }; } if (selectedColumns != null) { //make sure we always have Id and Person columns selectedColumns = selectedColumns.Union(baseColumns).ToArray(); var currectColumns = g.Columns.ToList(); //remove unselected columns currectColumns = currectColumns.Where(o => selectedColumns.Contains(o.Name)).ToList(); //add missing columns var missingColumns = selectedColumns.Except(currectColumns.Select(o => o.Name)).ToArray(); currectColumns.AddRange(columns.Where(o => missingColumns.Contains(o.Name))); g.Columns = currectColumns.ToArray(); } var gridModel = new GridModelBuilder<Lunch>(Db.Lunches.AsQueryable(), g).Build(); // used to populate the checkboxlist gridModel.Tag = new { columns = columns.Select(o => o.Name).Except(baseColumns).ToArray(), selectedColumns = g.Columns.Select(o => o.Name).Except(baseColumns).ToArray() }; return Json(gridModel); }
public ActionResult GridGetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var items = Db.Dinners.Where(o => o.Name.ToLower().Contains(search)).AsQueryable(); return Json(new GridModelBuilder<Dinner>(items, g) { Key = "Id", // needed for api select, update, tree, nesting, EF GetItem = () => Db.Get<Dinner>(Convert.ToInt32(g.Key)), // called by the grid.api.update ( edit popupform success js func ) Map = MapToGridModel }.Build()); }
public ActionResult GridGetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var items = db.ACCT_TAB_JIRKA.Where(o => o.AACCT.ToLower().Contains(search)).AsQueryable(); return Json(new GridModelBuilder<ACCT_TAB_JIRKA>(items, g) { Key = "AACCT", // needed for api select, update, tree, nesting, EF GetItem = () => db.ACCT_TAB_JIRKA.Single(o => o.AACCT == g.Key),// Get<ACCT_TAB_JIRKA>(Convert.ToInt32(g.Key)), // called by the grid.api.update ( edit popupform success js func ) Map = MapToGridModel }.Build()); }
public ActionResult GetItems(GridParams g, string controller, string action) { var items = MySiteMap.Items.ToList(); Func<string, string, bool> equals = (a, b) => a.Equals(b, StringComparison.OrdinalIgnoreCase); var selectedItem = items.SingleOrDefault(o => equals(o.Controller, controller) && equals(o.Action, action)); if (selectedItem != null) { var selectedGroup = items.Where(o => o.GroupId == selectedItem.GroupId).ToList(); // making sure the GroupId for the selected group will be the lowest so the selected group will always be at the top // grid is ordered by GroupId foreach (var menuItem in selectedGroup) { items.Remove(menuItem); items.Add(new SiteMapItem { Action = menuItem.Action, Controller = menuItem.Controller, GroupId = menuItem.GroupId - 1000, GroupTitle = menuItem.GroupTitle, Title = menuItem.Title }); } } //disable paging, an alternative would be to set pagesize to MySiteMap.Items.Count g.Paging = false; return Json(new GridModelBuilder<SiteMapItem>(items.AsQueryable(), g) { MakeHeader = info => { dynamic f = info.Items.First(); // setting a custom persistence key to keep it consistent (doing this because we've changed the GroupId above ^) // without this same group depending on if it is selected or not could be "$GroupId-997" or "$GroupId3" return new GroupHeader { Content = f.GroupTitle, Key = "$" + (f.GroupId < 0 ? f.GroupId + 1000 : f.GroupId) }; }, Map = mi => new { mi.Action, mi.Controller, mi.GroupId, mi.Title, Url = Url.Action(mi.Action, mi.Controller), Selected = equals(mi.Controller, controller) && equals(mi.Action, action) ? "selected" : "" }, }.Build()); }
public ActionResult GetItems(GridParams g) { return Json(new GridModelBuilder<Lunch>(Db.Lunches.AsQueryable(), g) { Map = o => new { o.Person, o.Price, o.Food, Date = o.Date.ToString("dd MMMM yyyy"), o.Location }, MakeHeader = gr => { var value = AweUtil.GetColumnValue(gr.Column, gr.Items.First()).Single(); var strVal = gr.Column == "Date" ? ((DateTime)value).ToString("dd MMMM yyyy") : gr.Column == "Price" ? value + " GBP" : value.ToString(); return new GroupHeader {Content = gr.Header + " - " + strVal}; } }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.Description.StartsWith(parent) , User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<Industry>(data.AsQueryable(), g) { Map = industry => new { industry.Description, Actions = this.RenderView("IndustryGridActions", industry) // view in Shared/IndustryGridActions.cshtml } }.Build()); }
public ActionResult GetItems(GridParams g) { const int PageSize = 10; var items = Db.Lunches.AsQueryable(); if (g.SortNames != null) { IOrderedQueryable<Lunch> orderedItems = null; // doing this for demo purposes // one might use something like Dynamic Linq or generate a sql string etc. for (int i = 0; i < g.SortNames.Length; i++) { var column = g.SortNames[i]; var direction = g.SortDirections[i]; if (i == 0) { if (column == "Person") orderedItems = direction == "asc" ? items.OrderBy(o => o.Person) : items.OrderByDescending(o => o.Person); else if (column == "Food") orderedItems = direction == "asc" ? items.OrderBy(o => o.Food) : items.OrderByDescending(o => o.Food); } else { if (column == "Person") orderedItems = direction == "asc" ? orderedItems.ThenBy(o => o.Person) : orderedItems.ThenByDescending(o => o.Person); else if (column == "Food") orderedItems = direction == "asc" ? orderedItems.ThenBy(o => o.Food) : orderedItems.ThenByDescending(o => o.Food); } } items = orderedItems; } var totalPages = (int)Math.Ceiling((float)items.Count() / PageSize); var page = items.Skip((g.Page - 1) * PageSize).Take(PageSize); return Json(new GridModelBuilder<Lunch>(page.AsQueryable(), g) { PageCount = totalPages }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { int userId = userService.GetUserIdByName(HttpContext.User.Identity.Name) == 0 ? 0 : userService.GetUserIdByName(HttpContext.User.Identity.Name); var data = repo.Where(o => o.Description.StartsWith(parent) && o.UserId.Equals(userId), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<ProductCategory>(data.AsQueryable(), g) { Map = productCategory => new { productCategory.Description, Actions = this.RenderView("ProductCategoryGridActions", productCategory) // view in Shared/ProductCategoryGridActions.cshtml } }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.ApiLogin.StartsWith(parent), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<PaymentGateway>(data.AsQueryable(), g) { Map = pg => new { pg.ApiLogin, pg.TransactionKey, pg.Type, Actions = this.RenderView("PaymentGatewayGridActions", pg) // view in Shared/PaymentGatewayGridActions.cshtml } }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.Comments.StartsWith(parent) && o.IsDeleted==false) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<ConsumerFeedback>(data.AsQueryable(), g) { Map = consumerFeedback => new { consumerFeedback.Consumer.Name, consumerFeedback.Comments, consumerFeedback.DatePosted, Actions = this.RenderView("ConsumerFeedbackGridActions", consumerFeedback) // view in Shared/ConsumerFeedbackGridActions.cshtml } }.Build()); }
public GridModel<Chef> GetItems(GridParams g) { var list = Db.Chefs.AsQueryable(); return new GridModelBuilder<Chef>(list, g) { // Key = "Id", // needed when using Entity Framework Map = o => new { o.Id, o.FirstName, o.LastName, CountryName = o.Country.Name, } }.Build(); }
public ActionResult GridGetItemsForTipo(GridParams g, int tipo_Id) { var items = UnitOfWork.AloSorteoRepository.Get(); if (tipo_Id > 0) { items = items.Where(o => o.tipo_Id == tipo_Id); } return Json(new GridModelBuilder<aloSorteos>(items, g) { Key = "Id", // needed for api select, update, tree, nesting, EF GetItem = () => UnitOfWork.AloSorteoRepository.GetById(int.Parse(g.Key)), // called by the grid.api.update ( edit popupform success js func ) Map = MapToGridModel }.Build()); }
public ActionResult GetItems(GridParams g) { return Json(new GridModelBuilder<Message>(Db.Messages.AsQueryable(), g) { Map = o => new { o.Id, o.From, o.Subject, o.DateReceived, Body = o.Body.Length < 73 ? o.Body : o.Body.Substring(0, 73), o.IsRead, RowClass = o.IsRead ? "" : "notRead" } }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.FirstName.StartsWith(parent) || o.LastName.StartsWith(parent), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<Chef>(data.AsQueryable(), g) { Map = chef => new { chef.FirstName, chef.LastName, Country = chef.Country.Name, Actions = this.RenderView("ChefGridActions", chef) // view in Shared/ChefGridActions.cshtml } }.Build()); }
public ActionResult GridGetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var items = UnitOfWork.AppChofereRepository.Get(); if (!string.IsNullOrWhiteSpace(search)) { items = items.Where(o => o.nombre.ToLower().Contains(search)); } return Json(new GridModelBuilder<appChoferes>(items, g) { Key = "Id", // needed for api select, update, tree, nesting, EF GetItem = () => UnitOfWork.AppChofereRepository.GetById(int.Parse(g.Key)), // called by the grid.api.update ( edit popupform success js func ) Map = MapToGridModel }.Build()); }
public ActionResult GridGetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var items = UnitOfWork.GenActividadeRepository.Get(o => o.ventaTickets); // Only records where "ventaTickets"=1 if (!string.IsNullOrWhiteSpace(search)) { items = items.Where(o => o.desc.ToLower().Contains(search)); } return Json(new GridModelBuilder<genActividades>(items, g) { Key = "id", // needed for api select, update, tree, nesting, EF GetItem = () => UnitOfWork.GenActividadeRepository.GetById(int.Parse(g.Key)), // called by the grid.api.update ( edit popupform success js func ) Map = MapToGridModel }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.BranchName.StartsWith(parent) || o.Address.StartsWith(parent), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<Branch>(data.AsQueryable(), g) { Map = branch => new { branch.BranchName, branch.Address, branch.ZipCode, Country = branch.Country.Name, Actions = this.RenderView("BranchGridActions", branch) // view in Shared/BranchGridActions.cshtml } }.Build()); }
public Grid(GridParams args) { DoLineMaterial(); _lineColor = args.GridColor; _lineColor2 = args.GridColorSmall; _gridBounds = new Rect(0, 0, 1, 1); _gridSpacing = args.GridSize / args.GridSmallSizeMultiplier; _gridSpacing2 = args.GridSize; _gridLineListVertical = new GridLineList(); _gridLineListHorizontal = new GridLineList(); DoUpdate(); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.DocName.StartsWith(parent) || o.MediaType.StartsWith(parent), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<MediaDocument>(data.AsQueryable(), g) { Map = mediaDocument => new { mediaDocument.DocName, mediaDocument.MediaType, mediaDocument.Module, mediaDocument.DateCreated, Actions = this.RenderView("MediaDocumentGridActions", mediaDocument) // view in Shared/MediaDocumentActions.cshtml } }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.Application.ApplicationName.StartsWith(parent), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<Ad>(data.AsQueryable(), g) { Map = ad => new { ad.Application.ApplicationName, ad.WebSiteReference, ad.Banner, ad.Start, ad.End, Actions = this.RenderView("AdGridActions", ad) // view in Shared/AdGridActions.cshtml } }.Build()); }
public ActionResult PartnerRead(GridParams g, string search, int? churchId , int? groupId , int? zoneId) { search = (search ?? "").Trim(); var query = _partnerService.GetAll().Where(i => i.FirstName.Contains(search) || i.LastName.Contains(search)); query = zoneId.HasValue ? _partnerService.Find(i => i.Church.Group.ZoneId == zoneId) : query; query = groupId.HasValue ? _partnerService.Find(i => i.Church.GroupId == groupId) : query; var model = query.Select(i => new PartnerListModel { Id = i.Id, ChurchId = i.ChurchId, ChurchName = i.Church.Name, DateCreated = i.DateCreated, DateOfBirth = i.DateOfBirth, Email = i.Email, FullName = i.LastName + " " + i.FirstName, Gender = i.Gender, Phone = i.Phone, Title = i.Title, UniqueId = i.UniqueId, GroupName = i.Church.Group.Name, ZoneName = i.Church.Group.Zone.Name }); return Json(new GridModelBuilder<PartnerListModel>(model.OrderByDescending(I => I.DateCreated), g) { Key = "Id", Map = o => new { o.Id, o.ChurchId, o.ChurchName, o.DateCreated, o.DateOfBirth, o.Email, o.FullName, o.Gender, o.Phone, o.Title, o.UniqueId, o.GroupName, o.ZoneName, } }.Build()); }
public ActionResult GetItems(GridParams g, string parent) { var data = repo.Where(o => o.FirstName.StartsWith(parent) || o.LastName.StartsWith(parent), User.IsInRole("admin")) .OrderByDescending(o => o.Id); return Json(new GridModelBuilder<Lead>(data.AsQueryable(), g) { Map = lead => new { lead.FirstName, lead.LastName, lead.Address, lead.EmailAddress, lead.Mobile, lead.ReferredBy, lead.DateCreated, Actions = this.RenderView("LeadGridActions", lead) // view in Shared/LeadGridActions.cshtml } }.Build()); }