Ejemplo n.º 1
0
        public string RenderTab(BsEditorRepositorySettings <ContributorType> settings, out int count)
        {
            var html = string.Empty;

            count = 0;

            GroupEditorModel model = new GroupEditorModel();

            if (settings.Search == null)
            {
                settings.Search = new ContributorSearchModel();
            }

            switch (settings.TabId)
            {
            case ContributorType.Developer:

                ((ContributorSearchModel)settings.Search).RolesFilter = new List <ProjectRole>()
                {
                    ProjectRole.Developer, ProjectRole.TeamLeader
                };

                var gridDevelopers = repo.ToBsGridViewModel(settings.ToGridRepositorySettings <ContributorSearchModel>(), out count);

                model.Developers = new BsEditorTabModel <ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                {
                    Grid = gridDevelopers
                };

                break;

            case ContributorType.Tester:

                ((ContributorSearchModel)settings.Search).RolesFilter = new List <ProjectRole>()
                {
                    ProjectRole.Tester
                };

                var gridTesters = repo.ToBsGridViewModel(settings.ToGridRepositorySettings <ContributorSearchModel>(), out count);

                model.Testers = new ContributorsInheritExample
                {
                    Grid = gridTesters
                };
                break;
            }

            var viewModel = new GroupEditorViewModel()
            {
                Editor = model
            };

            html = this.BsRenderPartialView("_Editors", viewModel);

            return(html);
        }
Ejemplo n.º 2
0
        public BsJsonResult Search(ContributorSearchModel model, ContributorType tabId)
        {
            var settings = new BsEditorRepositorySettings <ContributorType>
            {
                Search = model,
                TabId  = tabId
            };

            var count = 0;

            var html = this.RenderTab(settings, out count);

            return(new BsJsonResult(new
            {
                Count = count,
                Html = html
            }));
        }
Ejemplo n.º 3
0
        public BsJsonResult GetTab(BsEditorRepositorySettings<ContributorType> settings)
        {
            var msg = string.Empty;
            var status = BsResponseStatus.Success;
            var html = string.Empty;
            var count = 0;

            try
            {
                html = RenderTab(settings, out count);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                status = BsResponseStatus.ServerError;
            }

            return new BsJsonResult(new
            {
                Count = count,
                Html = html
            }, status, msg);
        }
Ejemplo n.º 4
0
        public BsJsonResult GetTab(BsEditorRepositorySettings <YesNoValueTypes> settings)
        {
            var msg    = string.Empty;
            var status = BsResponseStatus.Success;
            var html   = string.Empty;
            var count  = 0;

            try
            {
                html = RenderTab(settings, out count);
            }
            catch (Exception ex)
            {
                msg    = ex.Message;
                status = BsResponseStatus.ServerError;
            }

            return(new BsJsonResult(new
            {
                Count = count,
                Html = html
            }, status, msg));
        }
Ejemplo n.º 5
0
        public BsJsonResult Search(ContributorSearchModel model, ContributorType tabId)
        {
            var settings = new BsEditorRepositorySettings<ContributorType>
            {
                Search = model,
                TabId = tabId
            };

            var count = 0;

            var html = this.RenderTab(settings, out count);

            return new BsJsonResult(new
            {
                Count = count,
                Html = html
            });
        }
Ejemplo n.º 6
0
        public string RenderTab(BsEditorRepositorySettings<ContributorType> settings, out int count)
        {
            var html = string.Empty;
            count = 0;

            GroupEditorModel model = new GroupEditorModel();

            if (settings.Search == null)
            {
                settings.Search = new ContributorSearchModel();
            }

            switch (settings.TabId)
            {
                case ContributorType.Developer:

                    ((ContributorSearchModel)settings.Search).RolesFilter = new List<ProjectRole>() { ProjectRole.Developer, ProjectRole.TeamLeader };

                    var gridDevelopers = repo.ToBsGridViewModel(settings.ToGridRepositorySettings<ContributorSearchModel>(), out count);

                    model.Developers = new BsEditorTabModel<ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                    {
                        Grid = gridDevelopers
                    };

                    break;

                case ContributorType.Tester:

                    ((ContributorSearchModel)settings.Search).RolesFilter = new List<ProjectRole>() { ProjectRole.Tester };

                    var gridTesters = repo.ToBsGridViewModel(settings.ToGridRepositorySettings<ContributorSearchModel>(), out count);

                    model.Testers = new ContributorsInheritExample
                    {
                        Grid = gridTesters
                    };
                    break;
            }

            var viewModel = new GroupEditorViewModel()
            {
                Editor = model
            };

            html = this.BsRenderPartialView("_Editors", viewModel);

            return html;
        }