Example #1
0
        public BsJsonResult Save(GroupEditorModel model)
        {
            var errorMessage = "This is how a server error is displayed in group editor";

            return(new BsJsonResult(new
            {
                Message = errorMessage
            }, BsResponseStatus.ValidationError, "lalalalal"));
        }
Example #2
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);
        }
Example #3
0
        public BsJsonResult New(ContributorNewModel model)
        {
            var status = BsResponseStatus.Success;
            var row    = string.Empty;
            var msg    = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var rowModel = repo.Create(model);

                    var groupEditorModel = new GroupEditorModel
                    {
                        Contributors3 = new BsEditorTabModel <ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                        {
                            Grid = new BsGridModel <ContributorRowModel>
                            {
                                Items = new List <ContributorRowModel>
                                {
                                    rowModel
                                }
                            }
                        }
                    };

                    var viewModel = new GroupEditorViewModel()
                    {
                        Editor2 = groupEditorModel
                    };

                    row = this.BsRenderPartialView("_Editors", viewModel);
                }
                else
                {
                    return(new BsJsonResult(
                               new Dictionary <string, object> {
                        { "Errors", ModelState.GetErrors() }
                    },
                               BsResponseStatus.ValidationError));
                }
            }
            catch (Exception ex)
            {
                msg    = Resource.ServerError;
                status = BsResponseStatus.ServerError;
            }

            return(new BsJsonResult(new
            {
                Row = row
            }, status, msg));
        }
Example #4
0
        public string RenderTab(BsEditorRepositorySettings <YesNoValueTypes> settings, out int count)
        {
            var html = string.Empty;

            count = 0;

            GroupEditorModel model = new GroupEditorModel();

            switch (settings.TabId)
            {
            case YesNoValueTypes.No:

                var grid2 = repo.ToBsGridViewModel(settings.ToBaseGridRepositorySettings(), out count);
                model.Contributors2 = new BsEditorTabModel <ContributorRowModel>
                {
                    Grid = grid2
                };
                break;

            case YesNoValueTypes.Yes:

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

                model.Contributors = new ContributorsInheritExample
                {
                    Grid = grid1
                };
                break;

            case YesNoValueTypes.Both:

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

                model.Contributors3 = new BsEditorTabModel <ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                {
                    Grid = grid3
                };
                break;
            }

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

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

            return(html);
        }
Example #5
0
        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);
        }
Example #6
0
        public BsJsonResult Save(GroupEditorModel model)
        {
            var errorMessage = "This is how a server error is displayed in group editor";

            return new BsJsonResult(new
            {
                Message = errorMessage
            },BsResponseStatus.ValidationError, "Server error");
        }
Example #7
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;
        }
Example #8
0
        public BsJsonResult New(ContributorNewModel model, ContributorType tabId)
        {
            var status = BsResponseStatus.Success;
            var row = string.Empty;
            var msg = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var rowModel = repo.Create(model);

                    var groupEditorModel = new GroupEditorModel
                    {
                        Developers = new BsEditorTabModel<ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                        {
                            Grid = new BsGridModel<ContributorRowModel>
                            {
                                Items = new List<ContributorRowModel>
                                {
                                    rowModel
                                }
                            }
                        }
                    };

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

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

                }
                else
                {
                    return new BsJsonResult(
                        new Dictionary<string, object> { { "Errors", ModelState.GetErrors() } },
                        BsResponseStatus.ValidationError);
                }
            }
            catch (Exception ex)
            {
                msg = Resource.ServerError;
                status = BsResponseStatus.ServerError;
            }

            return new BsJsonResult(new
            {
                Row = row
            }, status, msg);
        }
Example #9
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));
        }
Example #10
0
        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));
        }