Exemple #1
0
        public ActionResult Index(int?stateId)
        {
            BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null;

            if (stateId.HasValue)
            {
                var state = _componentState.Get(stateId.Value);

                if (state != null)
                {
                    bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>();
                }
            }

            if (bsGridSettings == null)
            {
                bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>()
                {
                    PageSize = 5,
                    Page     = 1
                };
            }

            bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search);

            var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings);

            var model = new ContributorsViewModel
            {
                Grid    = gridModel,
                Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> >
                {
                    Search = bsGridSettings.Search,
                    New    = _gridRepository.GetNewForm(),
                    Order  = _gridRepository.GetOrderForm(true)
                }
            };

            var options = new Dictionary <string, object>
            {
                { "pagerUrl", Url.Action("Pager") },
                { "getRowsUrl", Url.Action("GetRows") },
                { "enableDisableUrl", Url.Action("EnableDisable") },
                { "exportExcelUrl", Url.Action("ExportExcel") },
                { "updateUrl", Url.Action("Update") },
                { "deleteUrl", Url.Action("Delete") },
                { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() }
            };

            RequireJsOptions.Add("index", options);

            return(View(model));
        }
Exemple #2
0
        //
        // GET: /Demo/UserGroup/
        public ActionResult Index()
        {
            var model = new GroupEditorModel()
            {
                Contributors = new ContributorsInheritExample
                {
                    Grid = repo.ToBsGridViewModel(new BsGridRepositorySettings <ContributorSearchModel>
                    {
                        Page     = 1,
                        PageSize = 5
                    }),
                    Search = repo.GetSearchForm(null),
                    Order  = new ContributorsOrderModel()
                },

                Contributors3 = new BsEditorTabModel <ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                {
                    Grid = repo.ToBsGridViewModel(new BsGridRepositorySettings <ContributorSearchModel>
                    {
                        Page     = 1,
                        PageSize = 5
                    }),
                    Search = repo.GetSearchForm(null),
                    New    = repo.GetNewForm()
                },

                Group1 = new BsEditorGroupModel <ContributorsGroupRowModel, ContributorsRowFormModel>
                {
                    Items = new List <ContributorsGroupRowModel>()
                    {
                        new ContributorsGroupRowModel
                        {
                            Id    = 4,
                            Name  = "Marius C.",
                            TabId = YesNoValueTypes.Yes,
                            Form  = new ContributorsRowFormModel()
                            {
                                Name = "Marius C."
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id    = 1,
                            Name  = "Stefan P.",
                            TabId = YesNoValueTypes.Yes,
                            Form  = new ContributorsRowFormModel()
                            {
                                Name = "Stefan P."
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id    = 2,
                            Name  = "Ciprian P.",
                            TabId = YesNoValueTypes.Yes,
                            Form  = new ContributorsRowFormModel()
                            {
                                Name = "Ciprian P."
                            }
                        }
                    },
                    Form = new ContributorsRowFormModel()
                },

                Group2 = new BsEditorGroupModel <ContributorsGroupRowModel>
                {
                    Items = new List <ContributorsGroupRowModel>()
                    {
                        new ContributorsGroupRowModel
                        {
                            Id    = 4,
                            Name  = "Marius C.",
                            TabId = YesNoValueTypes.Yes
                        }
                    }
                },
                Form = new GroupFormModel()
            };

            var viewModel = new GroupEditorViewModel
            {
                Editor2 = model
            };

            var options = new
            {
                getTabUrl         = Url.Action("GetTab"),
                save              = Url.Action("Save"),
                advancedSearchUrl = Url.Action("Search"),
                addUrl            = Url.Action("New")
            };

            RequireJsOptions.Add("index", options);

            return(View(viewModel));
        }
        public ActionResult Index()
        {
            var model = new GroupEditorModel()
            {
                Developers = new BsEditorTabModel <ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                {
                    Grid = repo.ToBsGridViewModel(new BsGridRepositorySettings <ContributorSearchModel>
                    {
                        Page     = 1,
                        PageSize = 10,
                        Search   = new ContributorSearchModel
                        {
                            RolesFilter = new List <ProjectRole>()
                            {
                                ProjectRole.Developer, ProjectRole.TeamLeader
                            }
                        }
                    }),
                    Search = repo.GetSearchForm(null),
                    New    = repo.GetNewForm()
                },

                Testers = new ContributorsInheritExample
                {
                    Grid = repo.ToBsGridViewModel(new BsGridRepositorySettings <ContributorSearchModel>
                    {
                        Page     = 1,
                        PageSize = 10,
                        Search   = new ContributorSearchModel
                        {
                            RolesFilter = new List <ProjectRole>()
                            {
                                ProjectRole.Tester
                            }
                        }
                    }),
                    Search = repo.GetSearchForm(null)
                },

                BFormsProject = new BsEditorGroupModel <ContributorsGroupRowModel, ContributorsRowFormModel>
                {
                    Items = new List <ContributorsGroupRowModel>()
                    {
                        new ContributorsGroupRowModel
                        {
                            Id            = 1,
                            Name          = "Stefan P.",
                            TabId         = ContributorType.Developer,
                            Contributions = "concept, api design, razor helpers, documentation, c# bug fixing, testing",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "concept, api design, razor helpers, documentation, c# bug fixing, testing"
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 6,
                            Name          = "Oana M.",
                            TabId         = ContributorType.Developer,
                            Contributions = "UI & UX, css master",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "UI & UX, css master"
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 3,
                            Name          = "Cezar C.",
                            TabId         = ContributorType.Developer,
                            Contributions = "documentation, razor helpers",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "documentation, razor helpers"
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 4,
                            Name          = "Marius C.",
                            TabId         = ContributorType.Developer,
                            Contributions = "js framework, datetime picker, automated tests for js",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "js framework, datetime picker, automated tests for js"
                            }
                        }
                    },
                    Form = new ContributorsRowFormModel()
                },

                RequireJsProject = new BsEditorGroupModel <ContributorsGroupRowModel>
                {
                    Items = new List <ContributorsGroupRowModel>()
                    {
                        new ContributorsGroupRowModel
                        {
                            Id            = 1,
                            Name          = "Stefan P.",
                            Contributions = "concept, api design, razor helpers, documentation, c# bug fixing, testing",
                            TabId         = ContributorType.Developer
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 3,
                            Name          = "Cezar C.",
                            Contributions = "documentation, razor helpers",
                            TabId         = ContributorType.Developer
                        }
                    }
                },
                Form = new GroupFormModel()
            };

            var viewModel = new GroupEditorViewModel
            {
                Editor = model
            };

            var options = new
            {
                getTabUrl         = Url.Action("GetTab"),
                save              = Url.Action("Save"),
                advancedSearchUrl = Url.Action("Search"),
                addUrl            = Url.Action("New"),
                contributorType   = RequireJsHtmlHelpers.ToJsonDictionary <ContributorType>(),
                projectRole       = RequireJsHtmlHelpers.ToJsonDictionary <ProjectRole>()
            };

            RequireJsOptions.Add("index", options);

            return(View(viewModel));
        }
        public ActionResult Index(int?stateId)
        {
            BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null;

            //HttpContext.Items["RequestTheme"] = BsTheme.Black;

            if (stateId.HasValue)
            {
                var state = _componentState.Get(stateId.Value);

                if (state != null)
                {
                    bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>();
                }
            }


            bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>()
            {
                PageSize = 5,
                Page     = 1,
                //GoTo = BsDirectionType.First
            };

            bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search);

            bsGridSettings.OrderableColumns = new List <BsColumnOrder> {
                new BsColumnOrder
                {
                    Name = "Name",
                    Type = BsOrderType.Descending
                }
            };

            var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings, x => x.Id);

            var model = new ContributorsViewModel
            {
                Grid    = gridModel,
                Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> >
                {
                    Search = bsGridSettings.Search,
                    New    = _gridRepository.GetNewForm(),
                    Order  = _gridRepository.GetOrderForm(true)
                }
            };

            var options = new Dictionary <string, object>
            {
                { "pagerUrl", Url.Action("Pager") },
                { "getRowsUrl", Url.Action("GetRows") },
                { "enableDisableUrl", Url.Action("EnableDisable") },
                { "exportExcelUrl", Url.Action("ExportExcel") },
                { "updateUrl", Url.Action("Update") },
                { "deleteUrl", Url.Action("Delete") },
                { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() },
                { "countUrl", Url.Action("Count") }
            };

            RequireJsOptions.Add("index", options);

            return(View(model));
        }