Пример #1
0
        public AuthPage()
        {
            InitializeComponent();
            userController.AddAdmin();
            Login.Focus();

            string I  = "Русский";
            string II = "Engish";

            SwtichLang.Items.Add(new Item(1, I));
            SwtichLang.Items.Add(new Item(2, II));

            SwtichLang.SelectedIndex = Settings.Default.LangIndex;
        }
Пример #2
0
        public void InitDB()
        {
            if (userController.Get().Count == 0)
            {
                userController.AddAdmin();
                categoryController.Add(new Category()
                {
                    Name = "Техника безопасности"
                });
                categoryController.Add(new Category()
                {
                    Name = "Техника пожарной безопасности"
                });

                Category category = categoryController.Get()[0];

                for (int k = 0; k < 3; k++)
                {
                    List <Question> questions = new List <Question>();

                    for (int i = 0; i < 10; i++)
                    {
                        List <Answer> answers = new List <Answer>();
                        for (int j = 0; j < 3; j++)
                        {
                            if (j == 0)
                            {
                                answers.Add(new Answer()
                                {
                                    Text      = string.Format("{0} {1}", j, RandomString(23)),
                                    IsTrue    = true,
                                    IsDeleted = false
                                });
                            }
                            else
                            {
                                answers.Add(new Answer()
                                {
                                    Text      = string.Format("{0} {1}", j, RandomString(23)),
                                    IsTrue    = false,
                                    IsDeleted = false
                                });
                            }
                        }
                        questions.Add(new Question()
                        {
                            Text      = string.Format("{0} {1} ", i, RandomString(34)),
                            Answer    = answers,
                            IsDeleted = false,
                            Foto      = ConvertPicture.BitmapImageToByteArray(new BitmapImage(new Uri(@"C:\Users\Alex\source\repos\Survey\Survey\Pictures\Hamster.jpg", UriKind.Relative)))
                        });
                    }

                    surveyController.Add(new Survey.Model.Survey()
                    {
                        Name       = string.Format("{0} {1}", k, RandomString(25)),
                        CategoryId = category.Id,
                        Time       = 1,
                        Question   = questions
                    });
                }
            }
        }