当前位置: 首页>>代码示例>>C#>>正文


C# GridViewModel类代码示例

本文整理汇总了C#中GridViewModel的典型用法代码示例。如果您正苦于以下问题:C# GridViewModel类的具体用法?C# GridViewModel怎么用?C# GridViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GridViewModel类属于命名空间,在下文中一共展示了GridViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMaterialAreaPage

 // GET: QLMaterialArea
 public ActionResult GetMaterialAreaPage(int? index, int page, int pageSize)
 {
     GridViewModel<MaterialArea> viewModel = new GridViewModel<MaterialArea>();
     int totalItems = dbContext.MaterialAreas.Count();
     if (index != null && index != 0)
     {
         page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
     }
     if (index == 0)
     {
         page = 1;
     }
     IEnumerable<MaterialArea> data = dbContext.MaterialAreas.OrderBy(x => x.Name).Skip((page - 1) * pageSize).Take(pageSize).ToList();
     //foreach (var item in data)
     //{
     //    if (item.MenuItem.MenuItems != null)
     //    {
     //        item.MenuItem.MenuItems = null;
     //    }
     //}
     if (index != null)
     {
         viewModel = new GridViewModel<MaterialArea> { GridData = data, CurrentPage = page, TotalItems = totalItems };
     }
     else
     {
         viewModel = new GridViewModel<MaterialArea> { GridData = data, TotalItems = totalItems };
     }
     return Json(viewModel, JsonRequestBehavior.AllowGet);
 }
开发者ID:hieuly93,项目名称:XoaiProject,代码行数:31,代码来源:QLMaterialAreaController.cs

示例2: Index

 public virtual ActionResult Index()
 {
     IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                              {
                                                  new GridColumnViewModel {Name = Translate(".Model.UserGroup.Name"), Index = "Name"},
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate(".Model.UserGroup.RolesList"),
                                                          Width = 150,
                                                          Sortable = false
                                                      },
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate(".Model.UserGroup.UsersList"),
                                                          Sortable = false
                                                      },
                                                  new GridColumnViewModel
                                                      {
                                                          Width = 10,
                                                          Sortable = false
                                                      },
                                                  new GridColumnViewModel
                                                      {Name = "Id", Sortable = false, Hidden = true}
                                              };
     var model = new GridViewModel
     {
         DataUrl = Url.Action(MVC.Admin.UserGroup.DynamicGridData()),
         DetailsUrl = String.Format("{0}/", Url.Action(MVC.Admin.UserGroup.Edit())),
         DefaultOrderColumn = "Name",
         GridTitle = ".UserGroups",
         Columns = columns
     };
     return View(model);
 }
开发者ID:coreframework,项目名称:Core-Framework,代码行数:34,代码来源:UserGroupController.cs

示例3: GetSubCatagoryPage

 public ActionResult GetSubCatagoryPage(int? index, int page, int pageSize)
 {
     GridViewModel<SubCatagorySolution> viewModel = new GridViewModel<SubCatagorySolution>();
     int totalItems = dbContext.SubCatagorySolutions.Count();
     if (index != null && index != 0)
     {
         page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
     }
     if (index == 0)
     {
         page = 1;
     }
     IEnumerable<SubCatagorySolution> data = dbContext.SubCatagorySolutions.Include(x => x.CatagorySolution).OrderBy(x => x.SubCatagorySolutionName).Skip((page - 1) * pageSize).Take(pageSize).ToList();
     foreach (var item in data)
     {
         if (item.CatagorySolution.SubCatagorySolutions != null)
         {
             item.CatagorySolution.SubCatagorySolutions = null;
         }
     }
     if (index != null)
     {
         viewModel = new GridViewModel<SubCatagorySolution> { GridData = data, CurrentPage = page, TotalItems = totalItems };
     }
     else
     {
         viewModel = new GridViewModel<SubCatagorySolution> { GridData = data, TotalItems = totalItems };
     }
     return Json(viewModel, JsonRequestBehavior.AllowGet);
 }
开发者ID:hieuly93,项目名称:5SVN,代码行数:30,代码来源:QLSubCatagorySolutionController.cs

示例4: Index

 public virtual ActionResult Index()
 {
     IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                              {
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate(".Model.Widget.Title"), Index = "Title"
                                                      },
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate(".Model.Widget.Module"), Sortable = false
                                                      },
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate(".Model.Widget.Status"), Index = "widget.Status"
                                                      },
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate("Actions.Actions"), Sortable = false
                                                      }
                                                      ,
                                                  new GridColumnViewModel
                                                      {
                                                          Name = Translate("Actions.Edit"), Sortable = false
                                                      }
                                              };
     var model = new GridViewModel
     {
         DataUrl = Url.Action(MVC.Admin.Widget.DynamicGridData()),
         DefaultOrderColumn = "Id",
         GridTitle = Translate(".Widgets"),
         Columns = columns
     };
     return View(model);
 }
开发者ID:coreframework,项目名称:Core-Framework,代码行数:35,代码来源:WidgetController.cs

示例5: GetAccountByPage

        // GET: QLNews
        public ActionResult GetAccountByPage(int? index, int page, int pageSize)
        {
            var roleManager = new RoleManager<Microsoft.AspNet.Identity.EntityFramework.IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext()));
            var idAdminRole = roleManager.FindByName("Admin").Id;
            ApplicationUserManager userManager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
            GridViewModel<ApplicationUser> viewModel = new GridViewModel<ApplicationUser>();
            int totalItems = userManager.Users.Where(x => x.Roles.Where(o => o.RoleId == idAdminRole).ToList().Count == 0).Count();
            if (index != null && index != 0)
            {
                page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
            }
            if (index == 0)
            {
                page = 1;
            }
            IEnumerable<ApplicationUser> data = userManager.Users.Where(x => x.Roles.Where(o => o.RoleId == idAdminRole).ToList().Count == 0).OrderBy(x => x.UserName).Skip((page - 1) * pageSize).Take(pageSize).ToList();

            if (index != null)
            {
                viewModel = new GridViewModel<ApplicationUser> { GridData = data, CurrentPage = page, TotalItems = totalItems };
            }
            else
            {
                viewModel = new GridViewModel<ApplicationUser> { GridData = data, TotalItems = totalItems };
            }
            return Json(viewModel, JsonRequestBehavior.AllowGet);
        }
开发者ID:hieuly93,项目名称:XoaiProject,代码行数:28,代码来源:QLAccountController.cs

示例6: OnInitialized

 protected override void OnInitialized()
 {
     GridViewModel = GetViewModel<GridViewModel<ListItemModel>>();
     for (int i = 0; i < 20; i++)
     {
         GridViewModel.ItemsSource.Add(new ListItemModel { IsValid = true });
         GridViewModel.ItemsSource.Add(new ListItemModel { IsValid = false });
     }
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit.Samples,代码行数:9,代码来源:ListDataTemplateViewModel.cs

示例7: FilterTemplatesFor

        public HtmlTag FilterTemplatesFor(GridViewModel model)
        {
            var tag = new HtmlTag("div");
            var containerNameForGrid = model.GridType.ContainerNameForGrid();
            tag.Id("filters_" + containerNameForGrid);
            tag.AddClass("smart-grid-filter");
            tag.Append(new TableTag());

            var metadata = new Dictionary<string, object>{
                {"gridId", "grid_" + model.GridName},
                {"initialCriteria", model.InitialCriteria()}
            };

            tag.MetaData("filters", metadata);

            var properties = model.FilteredProperties;

            var templates = _sources.Distinct().SelectMany(x => x.TagsFor(properties));

            var operators = properties.Select(prop =>
            {
                return new SelectTag(select =>
                {
                    prop.Operators.Each(oper => select.Option(oper.ToString(), oper.Key));
                }).AddClass(prop.Accessor.Name);
            });

            tag.Add("div", div =>
            {
                div.Hide();
                div.AddClass("templates");
                div.Add("div").AddClass("smart-grid-editors").Append(templates);
                div.Add("div").AddClass("smart-grid-operators").Append(operators);

                div.Append(new SelectTag(select =>
                {
                    select.AddClass("smart-grid-properties");
                    properties.Each(prop => select.Option(prop.Header, prop.Accessor.Name));
                }));
            });

            return tag;
        }
开发者ID:DarthFubuMVC,项目名称:FubuFastPack,代码行数:43,代码来源:FilterTagWriter.cs

示例8: GetMenuPage

 // GET: QLMenuItem
 public ActionResult GetMenuPage(int? index, int page, int pageSize)
 {
     GridViewModel<MenuItem> viewModel = new GridViewModel<MenuItem>();
     int totalItems = dbContext.MenuItems.Count();
     if (index != null && index != 0)
     {
         page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
     }
     if (index == 0)
     {
         page = 1;
     }
     IEnumerable<MenuItem> data = dbContext.MenuItems.OrderBy(x => x.Name).Skip((page - 1) * pageSize).Take(pageSize).Include(x => x.ParentMenu).ToList();
     foreach (var item in data)
     {
         if (item.MenuItems != null)
         {
             foreach (var i in item.MenuItems)
             {
                 if (i.ParentMenu != null) {
                 i.ParentMenu.MenuItems = null;
                 }
             }
         }
         if (item.ParentMenu != null)
         {
             item.ParentMenu.MenuItems = null;
             item.ParentMenu.ParentMenu = null;
         }
     }
     if (index != null)
     {
         viewModel = new GridViewModel<MenuItem> { GridData = data, CurrentPage = page, TotalItems = totalItems };
     }
     else
     {
         viewModel = new GridViewModel<MenuItem> { GridData = data, TotalItems = totalItems };
     }
     return Json(viewModel, JsonRequestBehavior.AllowGet);
 }
开发者ID:hieuly93,项目名称:SVN,代码行数:41,代码来源:QLMenuItemController.cs

示例9: GetLinkHeaderPage

 // GET: QLLinkHeader
 public ActionResult GetLinkHeaderPage(int? index, int page, int pageSize)
 {
     GridViewModel<LinkHeader> viewModel = new GridViewModel<LinkHeader>();
     int totalItems = dbContext.LinkHeaders.Count();
     if (index != null && index != 0)
     {
         page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
     }
     if (index == 0)
     {
         page = 1;
     }
     IEnumerable<LinkHeader> data = dbContext.LinkHeaders.Where(x => x.Type == TypeLink.Link).OrderBy(y => y.Id).Skip((page - 1) * pageSize).Take(pageSize).ToList();
     if (index != null)
     {
         viewModel = new GridViewModel<LinkHeader> { GridData = data, CurrentPage = page, TotalItems = totalItems };
     }
     else
     {
         viewModel = new GridViewModel<LinkHeader> { GridData = data, TotalItems = totalItems };
     }
     return Json(viewModel, JsonRequestBehavior.AllowGet);
 }
开发者ID:hieuly93,项目名称:5SVN,代码行数:24,代码来源:QLLinkHeaderController.cs

示例10: GetSlideShowPage

 public ActionResult GetSlideShowPage(int? index, int page, int pageSize)
 {
     GridViewModel<SlideShow> viewModel = new GridViewModel<SlideShow>();
     int totalItems = dbContext.SlideShows.Count();
     if (index != null && index != 0)
     {
         page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
     }
     if (index == 0)
     {
         page = 1;
     }
     IEnumerable<SlideShow> data = dbContext.SlideShows.OrderBy(x => x.Name).Skip((page - 1) * pageSize).Take(pageSize).ToList();
     if (index != null)
     {
         viewModel = new GridViewModel<SlideShow> { GridData = data, CurrentPage = page, TotalItems = totalItems };
     }
     else
     {
         viewModel = new GridViewModel<SlideShow> { GridData = data, TotalItems = totalItems };
     }
     return Json(viewModel, JsonRequestBehavior.AllowGet);
 }
开发者ID:hieuly93,项目名称:5SVN,代码行数:23,代码来源:QLSlideShowController.cs

示例11: GetAllNews

 // GET: QLNews
 public ActionResult GetAllNews(int? index, int page, int pageSize)
 {
     GridViewModel<News> viewModel = new GridViewModel<News>();
     int totalItems = dbContext.Newss.Count();
     if (index != null && index != 0)
     {
         page = (int)Math.Ceiling((decimal)(index + 1) / (decimal)pageSize);
     }
     if (index == 0)
     {
         page = 1;
     }
     IEnumerable<News> data = dbContext.Newss.Include(x => x.CatagoryNews).OrderBy(x => x.Date).Skip((page - 1) * pageSize).Take(pageSize).ToList();
     if (index != null)
     {
         viewModel = new GridViewModel<News> { GridData = data, CurrentPage = page, TotalItems = totalItems};
     }
     else
     {
         viewModel = new GridViewModel<News> { GridData = data, TotalItems = totalItems};
     }
     return Json(viewModel, JsonRequestBehavior.AllowGet);
 }
开发者ID:hieuly93,项目名称:5SVN,代码行数:24,代码来源:QLNewsController.cs

示例12: CreateGridViewModel

 static GridViewModel CreateGridViewModel()
 {
     var viewModel = new GridViewModel();
     viewModel.KeyFieldName = "Id";
     viewModel.Columns.Add("GraphicName");
     viewModel.Columns.Add("GraphicType");
     viewModel.Pager.PageSize = 10;
     return viewModel;
 }
开发者ID:cobianwae,项目名称:Pear,代码行数:9,代码来源:ArtifactController.cs

示例13: CreateGridViewModel

 static GridViewModel CreateGridViewModel()
 {
     var viewModel = new GridViewModel();
     viewModel.KeyFieldName = "Id";
     viewModel.Columns.Add("Name");
     viewModel.Columns.Add("Capacity");
     viewModel.Columns.Add("Type");
     viewModel.Columns.Add("Measurement");
     viewModel.Pager.PageSize = 10;
     return viewModel;
 }
开发者ID:fazar,项目名称:Pear,代码行数:11,代码来源:VesselController.cs

示例14: UserGroups

        public virtual ActionResult UserGroups(long id)
        {
            var role = roleService.Find(id);
            if (role == null)
            {
                throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.CouldNotFoundEntity"));
            }
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = Translate(".Model.Role.UserGroupName"), 
                                                                 Index = "Name",
                                                                 Width = 1100
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = "Id", 
                                                                 Sortable = false, 
                                                                 Hidden = true
                                                             }
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action(MVC.Admin.Role.UserGroupsDynamicGridData()),
                DefaultOrderColumn = "Name",
                GridTitle = Translate(".Model.UserGroups"),
                Columns = columns,
                MultiSelect = true,
                IsRowNotClickable = true,
                SelectedIds = role.UserGroups.Select(t => t.Id),
                Title = String.Format(Translate("Titles.Role_UserGroups"), role.Name)
            };

            return View(model);
        }
开发者ID:coreframework,项目名称:Core-Framework,代码行数:36,代码来源:RoleController.cs

示例15: ItemsSourceShouldBeEmptyWhenVmCreated

 public void ItemsSourceShouldBeEmptyWhenVmCreated()
 {
     var gridViewModel = new GridViewModel<object>();
     gridViewModel.ItemsSource.ShouldBeEmpty();
 }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:5,代码来源:GridViewModelTest.cs


注:本文中的GridViewModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。