Exemplo n.º 1
0
        private RegisterModel InitRegisterModel()
        {
            var listWithSelected = Lists.AllAsp <List <int> >();

            listWithSelected.SelectedValues = new List <int> {
                1, 2
            };

            var enumWithSelected = BsSelectList <NotificationType?> .FromEnum(typeof(NotificationType));

            enumWithSelected.SelectedValues = NotificationType.Monthly;

            var ddlWithSelected = Lists.AllCounties <string>();

            ddlWithSelected.SelectedValues = "ROU";

            var ideListWithSelected = Lists.AllIde <string>();

            ideListWithSelected.SelectedValues = "Visual Studio";

            var langListWithSelected = Lists.AllLanguages <List <string> >();

            langListWithSelected.SelectedValues = new List <string> {
                "C#"
            };

            var from = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 10, 30, 0);
            var to   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.AddDays(12).Day, 20, 00, 0);

            return(new RegisterModel()
            {
                CountriesList = ddlWithSelected,
                NotificationList = enumWithSelected,
                TechnologiesList = Lists.AllTech <List <int> >(),
                TechnologiesCheckboxList = listWithSelected,
                LanguagesList = langListWithSelected,
                IdeList = ideListWithSelected,
                GenderList = Lists.AllGenders <int>().ToSelectList().ToList(),
                Birthday = new BsDateTime(),
                Interval = new BsRange <DateTime>
                {
                    From = new BsRangeItem <DateTime>
                    {
                        ItemValue = DateTime.Now
                    },
                    To = new BsRangeItem <DateTime>
                    {
                        ItemValue = DateTime.Now.AddDays(12)
                    }
                }
            });
        }
Exemplo n.º 2
0
        public ContributorDetailsEditable ReadEditable(int objId, EditComponents componentId)
        {
            var model  = db.Contributors.FirstOrDefault(x => x.Id == objId);
            var result = new ContributorDetailsEditable
            {
                Id = model.Id
            };

            if (componentId == EditComponents.Identity)
            {
                result.Identity = new ContributorIdentityEditableModel
                {
                    FirstName     = model.FirstName,
                    LastName      = model.LastName,
                    Url           = model.Url,
                    CountriesList = Lists.AllCountries <string>(false),
                    Age           = new BsRangeItem <int?>
                    {
                        ItemValue = model.Age,
                        MinValue  = 14,
                        MaxValue  = 100,
                        TextValue = model.Age.HasValue ? model.Age.Value.ToString() : string.Empty
                    }
                };
            }
            else if (componentId == EditComponents.ProjectRelated)
            {
                result.ProjectRelated = new ContributorProjectEditableRelatedModel
                {
                    Contributions = model.Contributions,
                    LanguagesList = Lists.AllLanguages <List <string> >(),
                    StartDate     = new BsDateTime()
                    {
                        DateValue = model.StartDate
                    }
                };
            }

            if (result.Identity != null)
            {
                result.Identity.CountriesList.SelectedValues = model.Country;
            }

            if (result.ProjectRelated != null)
            {
                result.ProjectRelated.LanguagesList.SelectedValues = model.Languages;
                result.ProjectRelated.RoleList.SelectedValues      = model.Role;
            }

            return(result);
        }
Exemplo n.º 3
0
 public ContributorNewModel GetNewForm()
 {
     return(new ContributorNewModel()
     {
         CountriesList = Lists.AllCountries <string>(false),
         LanguagesList = Lists.AllLanguages <List <string> >(),
         Age = new BsRangeItem <int?>
         {
             ItemValue = 21,
             MaxValue = 100,
             MinValue = 14
         }
     });
 }
Exemplo n.º 4
0
        public ContributorSearchModel GetSearchForm(ContributorSearchModel stateModel)
        {
            var model = new ContributorSearchModel();

            model.IsEnabled = new BsSelectList <YesNoValueTypes?>();
            model.IsEnabled.ItemsFromEnum(typeof(YesNoValueTypes));
            model.RoleList = new BsSelectList <ProjectRole?>();
            model.RoleList.ItemsFromEnum(typeof(ProjectRole));
            model.CountriesList = Lists.AllCountries <string>(false);
            model.LanguagesList = Lists.AllLanguages <List <string> >();

            if (stateModel != null)
            {
                if (stateModel.Name != null)
                {
                    model.Name = stateModel.Name;
                }

                if (stateModel.IsEnabled != null && stateModel.IsEnabled.SelectedValues.HasValue)
                {
                    model.IsEnabled.SelectedValues = stateModel.IsEnabled.SelectedValues;
                }
                else
                {
                    model.IsEnabled.SelectedValues = YesNoValueTypes.Both;
                }

                if (stateModel.RoleList != null && stateModel.RoleList.SelectedValues.HasValue)
                {
                    model.RoleList.SelectedValues = stateModel.RoleList.SelectedValues;
                }

                if (stateModel.CountriesList != null && stateModel.CountriesList.SelectedValues != null)
                {
                    model.CountriesList.SelectedValues = stateModel.CountriesList.SelectedValues;
                }

                if (stateModel.LanguagesList != null && stateModel.LanguagesList.SelectedValues != null)
                {
                    model.LanguagesList.SelectedValues = stateModel.LanguagesList.SelectedValues;
                }
            }

            if (model.StartDateRange == null)
            {
                model.StartDateRange = new BsRange <DateTime?>()
                {
                    From = new BsRangeItem <DateTime?>
                    {
                        ItemValue = new DateTime(2013, 8, 1)
                    },
                    To = new BsRangeItem <DateTime?>
                    {
                        ItemValue = DateTime.Now
                    }
                };
            }

            if (model.AgeRange == null)
            {
                model.AgeRange = new BsRange <int?>
                {
                    From = new BsRangeItem <int?>
                    {
                        ItemValue = 14,
                        MinValue  = 10,
                        TextValue = "14",
                        Display   = "Start"
                    },
                    To = new BsRangeItem <int?>
                    {
                        ItemValue = 32,
                        MaxValue  = 100,
                        TextValue = "32",
                        Display   = "End"
                    },
                    TextValue = "18 - 21"
                };
            }

            return(model);
        }
Exemplo n.º 5
0
        private RegisterModel InitRegisterModel()
        {
            var listWithSelected = Lists.AllAsp <List <int> >();

            listWithSelected.SelectedValues = new List <int> {
                1, 2
            };

            var enumWithSelected = BsSelectList <NotificationType?> .FromEnum(typeof(NotificationType));

            enumWithSelected.SelectedValues = NotificationType.Monthly;

            var countries       = Lists.AllCountries <string>();
            var ddlInitialValue = countries.Items.Where(x => x.Value == "RO").FirstOrDefault();

            ddlInitialValue.Selected = true;

            var ddlWithSelected = new BsSelectList <string>()
            {
                Items = new List <BsSelectListItem>
                {
                    ddlInitialValue
                },
                SelectedValues = "ROU"
            };

            var ideListWithSelected = Lists.AllIde <string>();

            ideListWithSelected.SelectedValues = "Visual Studio";

            var langListWithSelected = Lists.AllLanguages <List <string> >();

            langListWithSelected.SelectedValues = new List <string> {
                "C#"
            };

            var from = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 10, 30, 0);
            var to   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.AddDays(12).Day, 20, 00, 0);

            var javascriptMvcFrameworkWithSelected = Lists.AllJavascriptFrameworks <int>();

            javascriptMvcFrameworkWithSelected.SelectedValues = 2;

            var webBrowsers = Lists.AllWebBrowsers <int>();

            return(new RegisterModel()
            {
                CountriesList = ddlWithSelected,
                NotificationList = enumWithSelected,
                TechnologiesList = Lists.AllTech <List <int> >(),
                TechnologiesCheckboxList = listWithSelected,
                LanguagesList = langListWithSelected,
                IdeList = ideListWithSelected,
                GenderList = Lists.AllGenders <int>().ToSelectList().ToList(),
                Birthday = new BsDateTime(),
                Interval = new BsRange <DateTime>
                {
                    From = new BsRangeItem <DateTime>
                    {
                        ItemValue = DateTime.Now
                    },
                    To = new BsRangeItem <DateTime>
                    {
                        ItemValue = DateTime.Now.AddDays(12)
                    }
                },
                JavascriptMvcFramework = javascriptMvcFrameworkWithSelected,
                WebBrowsers = webBrowsers
            });
        }