Ejemplo n.º 1
0
        private void SelectUser()
        {
            if (listView.SelectedItem == null)
            {
                MessageBox.Show("Спочатку треба обрати елемент у таблиці", "Увага"); return;
            }

            if (listView.SelectedItem is Users)
            {
                Users user = listView.SelectedItem as Users;
                int   id   = 0;
                using (DBWokrSql db = new DBWokrSql(Connection))
                    id = db.GetIdUser(user.Fname, user.Lname);
                WindowStatistic ws = new WindowStatistic(TypeForm.User, Connection, CurrentAdmin, id);
                ws.ShowDialog();
            }
            else
            if (listView.SelectedItem is Ticket)
            {
                Ticket ticket = listView.SelectedItem as Ticket;

                WindowTicket wt = new WindowTicket(Connection, ticket.ID);

                wt.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (DBWokrSql db = new DBWokrSql(Connection))
                {
                    switch (Type_)
                    {
                    case TypeForm.Admin:
                        e.Result = db.GetAdmins();
                        break;

                    case TypeForm.Users:
                        e.Result = db.GetStatisticUsers();
                        break;

                    case TypeForm.User:
                        e.Result = db.GetTickets(Id_user);
                        break;
                    }

                    e.Cancel = false;
                }
            }
            catch (Exception ex)
            {
                e.Cancel = false;
                e.Result = "Не має зв`язку з базою: " + ex.Message;
            }
        }
        private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (DBWokrSql db = new DBWokrSql(Connection))
                {
                    var levels_ = (Dictionary <int, string>)db.GetLevels();
                    var topics_ = (Dictionary <int, string>)db.GetTopics();

                    var qq = new Dictionary <QuestionInfo, IEnumerable <AnswerInfo> >();

                    foreach (var item in db.GetIDQuestions(0, 0))
                    {
                        var question_ = db.GetQuestion(item);

                        var answers_ = db.GetAnswers(item);

                        qq.Add(question_, answers_);
                    }

                    e.Cancel = false;
                    e.Result = new { lev = levels_, topi = topics_, q = qq };
                }
            }
            catch (Exception ex)
            {
                e.Cancel = false;
                e.Result = "Не має зв`язку з базою: " + ex.Message;
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            using (DBWokrSql db = new DBWokrSql(Connection))

                db.DisableQuestion(currentQuestions.Keys.ElementAt(currentQuest).ID);

            SearchQuestion();
        }
Ejemplo n.º 5
0
        private void buttonOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int idLevel, idUser = 0;

                if (String.IsNullOrWhiteSpace(txSname.Text))
                {
                    MessageBox.Show("Спочатку треба вказати ім'я"); return;
                }

                if (String.IsNullOrWhiteSpace(txFname.Text))
                {
                    MessageBox.Show("Треба вказати прізвище"); return;
                }

                if (comboBoxLevel.SelectedValue == null || String.IsNullOrWhiteSpace(comboBoxLevel.SelectedValue.ToString()))
                {
                    MessageBox.Show("Треба вказати рівень білета"); return;
                }

                if (String.IsNullOrWhiteSpace(txNumber.Text))
                {
                    MessageBox.Show("Спочатку треба вказати табельний номер (тільки цифри)"); return;
                }

                if (!int.TryParse(txNumber.Text, out idUser))
                {
                    MessageBox.Show("Табельний номер - це тільки цифри"); return;
                }

                using (DBWokrSql db = new DBWokrSql(ConnectionString))
                {
                    idLevel = db.GetIDLevel(comboBoxLevel.SelectedValue.ToString());
                    idUser  = db.AddUser(idUser, txFname.Text, txSname.Text);
                }

                WindowTicket wticket = new WindowTicket(ConnectionString,
                                                        idLevel, idUser,
                                                        (bool)radioButtonOffline.IsChecked ? NameFile : ""
                                                        );
                if (!(bool)radioButtonOffline.IsChecked)
                {
                    wticket.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("buttonOk_Click " + ex.Message);
            }
            this.Close();
        }
Ejemplo n.º 6
0
 private void BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     try
     {
         string connetcString = e.Argument.ToString();
         using (var db = new DBWokrSql(connetcString))
             e.Cancel = true;
     }
     catch (Exception ex)
     {
         e.Result = (object)"Не має зв`язку!\n" + ex.Message;
     }
 }
Ejemplo n.º 7
0
        private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                var rez = CastType(e.Argument, new { dateFrom = new DateTime(), dateTo = new DateTime(), rezTest = new RezultTest() });

                using (DBWokrSql db = new DBWokrSql(Connection))
                    e.Result = db.GetProtocol(rez.dateFrom, rez.dateTo, rez.rezTest);
            }
            catch (Exception ex)
            {
                e.Result = "Не має зв`язку з базою: " + ex.Message;
            }
        }
        private void buttonOk_Click(object sender, RoutedEventArgs e)
        {
            using (DBWokrSql db = new DBWokrSql(Connection))
                try
                {
                    switch (TYPE_)
                    {
                    case AuthType.Enter:

                        int id = db.GetIDAdmin(textBoxLogin.Text, textBoxPassword.Text);

                        Login = textBoxLogin.Text;

                        if (id > 0)
                        {
                            this.DialogResult = true;
                        }
                        else
                        {
                            this.DialogResult = false;
                        }
                        break;

                    case AuthType.Add:

                        if (db.AddAdmin(textBoxLogin.Text, textBoxPassword.Text, Father_) < 0)
                        {
                            MessageBox.Show("Користувач з таким ім'ям вже існує, спробуйте ще.", "Увага"); return;
                        }

                        MessageBox.Show(string.Format("Користувач {0} з паролем {1} доданий.", textBoxLogin.Text, textBoxPassword.Text), "");

                        break;

                    case AuthType.Update:

                        int idAdmin = db.GetIDAdmin(original.Login);

                        db.UpdateAdmin(idAdmin, textBoxLogin.Text, textBoxPassword.Text);

                        MessageBox.Show(string.Format("Логін {0} змінений на {1}\n Пароль {2} змінений на {3}", original.Login.PadRight(10), textBoxLogin.Text.PadRight(10), original.Password.PadRight(10), textBoxPassword.Text.PadRight(10)), "");

                        break;
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.Message, "Увага"); }

            this.Close();
        }
Ejemplo n.º 9
0
        private void buttonRemove_Click(object sender, RoutedEventArgs e)
        {
            if (listView.SelectedItem == null)
            {
                MessageBox.Show("Спочатку треба обрати користувача", "Увага"); return;
            }

            if (listView.SelectedItem is AdminInfo)
            {
                using (DBWokrSql db = new DBWokrSql(Connection))
                    try { db.DeleteAdmin((listView.SelectedItem as AdminInfo).Login); } catch (Exception ex) { MessageBox.Show("Помилка при видалені\n" + ex.Message, "Увага"); }
            }

            UpdateListView();
        }
Ejemplo n.º 10
0
 private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         List <string> listLevels = new List <string>();
         using (DBWokrSql db = new DBWokrSql(ConnectionString))
             foreach (var level in db.GetLevels())
             {
                 listLevels.Add(level.Value);
             }
         e.Cancel = false;
         e.Result = listLevels;
     }
     catch (Exception ex)
     {
         e.Cancel = false;
         e.Result = "Не має зв`язку з базою: " + ex.Message;
     }
 }
        void TextInputBox(string text = "")
        {
            int id_question = 0;

            if (string.IsNullOrWhiteSpace(textBox.Text))
            {
                SearchQuestion(); return;
            }

            if (!int.TryParse(textBox.Text + text, out id_question) || id_question < 0)
            {
                return;
            }

            using (DBWokrSql db = new DBWokrSql(Connection))
            {
                var quest = db.GetIDQuestionLike(id_question);

                if (quest.Count() == 0)
                {
                    labelSearch.Content = "Знайдено : 0"; frameView.Navigate(new UserControlNewQuestion(Connection)); return;
                }

                currentQuestions.Clear();

                foreach (var item in quest)
                {
                    var answers_ = db.GetAnswers(item.ID);

                    currentQuestions.Add(item, answers_);
                }
                currentQuest = 0;

                var Cquest = currentQuestions.Keys.ElementAt(currentQuest);

                labelSearch.Content = "Знайдено :" + currentQuestions.Keys.Count;

                frameView.Navigate(new UserControlNewQuestion(Connection, currentQuest, currentQuestions.Keys.Count, Cquest, currentQuestions[Cquest]));
            }
        }
        void SearchQuestion()
        {
            try
            {
                currentQuestions = new Dictionary <QuestionInfo, IEnumerable <AnswerInfo> >();
                var a = (comboBox1.SelectedItem as Data) == null ? 0 : (comboBox1.SelectedItem as Data).ID;
                var b = (comboBox.SelectedItem as Data) == null ? 0 : (comboBox.SelectedItem as Data).ID;
                currentQuestions.Clear();
                using (DBWokrSql db = new DBWokrSql(Connection))
                {
                    foreach (var item in db.GetIDQuestions(a, b))
                    {
                        var question_ = db.GetQuestion(item);

                        var answers_ = db.GetAnswers(item);

                        currentQuestions.Add(question_, answers_);
                    }
                }

                labelSearch.Content = "Знайдено :" + currentQuestions.Keys.Count;

                if (currentQuestions.Keys.Count == 0)
                {
                    frameView.Navigate(new UserControlNewQuestion(Connection)); return;
                }

                currentQuest = 0;

                var Cquest = currentQuestions.Keys.ElementAt(currentQuest);

                frameView.Navigate(new UserControlNewQuestion(Connection, currentQuest, currentQuestions.Keys.Count, Cquest, currentQuestions[Cquest]));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Search Question " + ex.Message);
            }
        }
Ejemplo n.º 13
0
        private void TextInput(string text = "")
        {
            if (Type_ != TypeForm.Users)
            {
                return;
            }

            IEnumerable <object> data = new object[0];

            using (DBWokrSql db = new DBWokrSql(Connection))
            {
                data = db.GetStatisticUsersLike(textBox.Text + text);
            }

            listView.Items.Clear();

            foreach (var item in data)
            {
                listView.Items.Add(item);
            }

            label.Content = "Знайдено :" + listView.Items.Count;
        }
Ejemplo n.º 14
0
        private void txNumber_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txNumber.Text))
            {
                txNumber.Background = Brushes.AliceBlue; txFname.Text = txSname.Text = ""; return;
            }

            int number;

            if (!int.TryParse(txNumber.Text, out number))
            {
                txNumber.Background = Brushes.MediumVioletRed; return;
            }
            else
            {
                txNumber.Background = Brushes.AliceBlue;
            }

            using (DBWokrSql db = new DBWokrSql(ConnectionString))
                try
                {
                    var user = db.GetUserLike(number);
                    if (user.ID > 0)
                    {
                        txFname.Text = user.Fname;
                        txSname.Text = user.Lname;
                    }
                    else
                    {
                        txFname.Text = txSname.Text = "";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
        }
Ejemplo n.º 15
0
        private void buttonWord_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (rezult.Count() == 0)
                {
                    MessageBox.Show("За цей період або нічого не знайдено, або ви не відібрали інформацію яку потрібно записати до файлу. Спочатку вкажіть період проведення тестування та натисніть кнопку Пошук для того, щоб відібрати результати");
                    return;
                }
                string NameFile;
                Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.FileName   = "Протокол тестування_" + DateTime.Now.ToString("yyyy-MM-d--HH-mm-ss");
                dlg.DefaultExt = ".docx";
                Nullable <bool> rezultDLG = dlg.ShowDialog();
                if (rezultDLG == true)
                {
                    NameFile = dlg.FileName;
                }
                else
                {
                    return;
                }

                if (DBWokrSql.WriteProtocol(rezult, NameFile, (DateTime)pick1.SelectedDate, (DateTime)pick2.SelectedDate))
                {
                    System.Diagnostics.Process.Start("WINWORD.EXE", "\"" + NameFile + "\"");
                }
                else
                {
                    MessageBox.Show("Увага!! Помилка при створені файлу");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 16
0
        void CheckRezult(bool IsTest = false)
        {
            if (IsShow)
            {
                return;
            }

            timer.Stop();
            timer.Dispose();

            #region SendRezult

            if (!IsTest && !SendRezult && !IsShow)
            {
                using (var db = new DBWokrSql(ConnectString))
                {
                    foreach (UserControlQuestion item in StackPanelQuestion.Children)
                    {
                        foreach (var ans in item.GetUserAnswers())
                        {
                            db.AddRezult(Id_ticket, ans, item.IDquestion);
                        }
                    }

                    SendRezult = true;
                    #endregion

                    #region CheckRezult

                    int error           = 0,
                        countAnswerTrue = 0,
                        userCountAnser  = 0;

                    foreach (UserControlQuestion item in StackPanelQuestion.Children)
                    {
                        var answers = db.GetAnswers(item.IDquestion, true).Select(x => x.ID);

                        countAnswerTrue += answers.Count();

                        userCountAnser += item.GetUserAnswers().Count();

                        if (answers.Count() != item.GetUserAnswers().Count())
                        {
                            error++; continue;
                        }

                        foreach (var ans in item.GetUserAnswers())
                        {
                            if (!answers.Contains(ans))
                            {
                                error++; break;
                            }
                        }
                    }
                    //update Ticket column isPasses
                    if (error >= 3 || countAnswerTrue != userCountAnser)
                    {
                        MessageBox.Show("Ви не склали іспит");
                    }
                    else
                    {
                        MessageBox.Show("Вітаємо! Ви успішно склали іспит. Нам дуже приємно працювати з такими фахівцями як Ви.");
                    }

                    db.UpdateTicketRezult(Id_ticket, error < 3);
                    #endregion
                }
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show(String.Format("Питання буде {0} у базі. Ви впевнені?", ID == 0 ? "збережено" : "змінено"), "Увага", MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                return;
            }

            if (String.IsNullOrWhiteSpace(textBoxLevel.Text))
            {
                MessageBox.Show("Перевірте поле Рівень"); return;
            }
            if (String.IsNullOrWhiteSpace(textBoxTopic.Text))
            {
                MessageBox.Show("Перевірте поле Тема "); return;
            }
            if (String.IsNullOrWhiteSpace(textBoxQuestion.Text))
            {
                MessageBox.Show("Перевірте поле питання "); return;
            }

            int idTick = 0;

            using (DBWokrSql db = new DBWokrSql(Connect))
            {
                if (ID == 0)
                {
                    //create question
                    idTick = db.AddNewQuestion(
                        new QuestionInfo()
                    {
                        ID = 0, Topic = textBoxTopic.Text, Info = textBoxInfo.Text, Level = textBoxLevel.Text, Question = textBoxQuestion.Text
                    },
                        ans
                        );
                }
                else
                {
                    //update question
                    var questionCurrent = db.GetQuestion(ID);
                    if (
                        !(questionCurrent.Info.Equals(textBoxInfo.Text.Replace('\'', ' ')) &&
                          questionCurrent.Level.Equals(textBoxLevel.Text) &&
                          questionCurrent.Question.Equals(textBoxQuestion.Text.Replace('\'', ' ')) &&
                          questionCurrent.Topic.Equals(textBoxTopic.Text))
                        )
                    {
                        idTick = db.UpdateQuestion(questionCurrent);
                    }

                    if (idTick == 0) //question didn`t change
                    {
                        //update answers
                        var answersCurrent = db.GetAnswers(ID);

                        //get all new answers and check them by similar in database, if they were not found -- add them
                        foreach (var item in ans)
                        {
                            if (answersCurrent.IsGetValue(item))
                            {
                                var ss = answersCurrent.Where(s => s.ID == item.ID).First();

                                if (ss.IsTrue == item.IsTrue && ss.Text.Equals(item.Text.Replace('\'', ' ')))
                                {
                                    continue;
                                }
                                else
                                {
                                    db.UpdateAnswer(ID, item);
                                }
                            }
                            else
                            {
                                int idAnswer = db.AddAnswer(item.Text);

                                db.AddQuestionAnswer(ID, idAnswer, item.IsTrue);
                            }
                        }

                        //marked all answers that not use
                        foreach (var item in answersCurrent)
                        {
                            if (!ans.IsGetValue(item))
                            {
                                db.DisableAnswer(item.ID);
                            }
                        }
                    }
                    else
                    {// add answers to new question
                        foreach (var item in ans)
                        {
                            int idAnswer = db.AddAnswer(item.Text);

                            db.AddQuestionAnswer(idTick, idAnswer, item.IsTrue);
                        }
                    }
                }
            }

            MessageBox.Show("Питання було успішно збережено під номером " + (idTick == 0 ? ID : idTick));
        }
Ejemplo n.º 18
0
        private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (!IsShow)
            {
                try
                {
                    using (DBWokrSql db = new DBWokrSql(ConnectString))
                    {
                        var Ticket = db.CreateTicket(Id_level);

                        var  user     = db.GetUser(Id_user);
                        bool IsOnline = string.IsNullOrWhiteSpace(TicketStore);
                        if (user.ID != 13)
                        {
                            Id_ticket = db.AddTicket(Ticket, Id_user, !IsOnline);
                        }
                        else
                        {
                            IsTEST = true;
                        }

                        if (!IsOnline)
                        {
                            TicketStore = Path.ChangeExtension(Path.Combine(Path.GetDirectoryName(TicketStore), Path.GetFileNameWithoutExtension(TicketStore) + Id_ticket), "docx");
                            //Write to file
                            if (db.WriteTicketToWord(Ticket, user, Id_ticket, TicketStore))
                            {
                                System.Diagnostics.Process.Start("WINWORD.EXE", "\"" + TicketStore + "\"");
                            }
                            else
                            {
                                MessageBox.Show("Увага!! Помилка при створені файлу");
                            }
                        }
                        else
                        {
                            e.Result = new OutputParams()
                            {
                                id_Ticket = Id_ticket, Ticket_ = Ticket
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    e.Cancel = false;
                    e.Result = "Не має зв`язку з базою: " + ex.Message;
                    throw new Exception(ex.Message);
                }
            }
            else
            {
                using (DBWokrSql db = new DBWokrSql(ConnectString))
                {
                    e.Result = new OutputParams()
                    {
                        id_Ticket = Id_ticket, Ticket_ = db.GetTicketRezults(Id_ticket)
                    };
                }
            }
        }
Ejemplo n.º 19
0
        private void lo_Loaded(object sender, RoutedEventArgs e)
        {
            // ButtonRemove
            {
                Grid newGrid = new Grid()
                {
                    Margin = new Thickness(5)
                };
                buttonRemove.Content = newGrid;
                newGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                Image newImage = new Image()
                {
                };
                newGrid.Children.Add(newImage);
                newImage.Source = new BitmapImage(new Uri("bin/Resource/Delete.ico", UriKind.Relative))
                {
                    CreateOptions = BitmapCreateOptions.IgnoreImageCache
                };
                Grid.SetRow(newImage, 0);
            }
            // ButtonAdd
            {
                Grid newGrid = new Grid()
                {
                    Margin = new Thickness(5)
                };
                buttonAdd.Content = newGrid;
                newGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                Image newImage = new Image()
                {
                };
                newGrid.Children.Add(newImage);
                newImage.Source = new BitmapImage(new Uri("bin/Resource/Add.ico", UriKind.Relative))
                {
                    CreateOptions = BitmapCreateOptions.IgnoreImageCache
                };
                Grid.SetRow(newImage, 0);
            }

            // ButtonDetail
            {
                Grid newGrid = new Grid()
                {
                    Margin = new Thickness(5)
                };
                buttonChange.Content = newGrid;
                newGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                Image newImage = new Image()
                {
                };
                newGrid.Children.Add(newImage);
                newImage.Source = new BitmapImage(new Uri("bin/Resource/Change.png", UriKind.Relative))
                {
                    CreateOptions = BitmapCreateOptions.IgnoreImageCache
                };
                Grid.SetRow(newImage, 0);
            }

            switch (Type_)
            {
            case TypeForm.Admin:
            {
                #region
                label.Visibility     = Visibility.Hidden;
                textBox.Visibility   = Visibility.Hidden;
                buttonChange.ToolTip = "Змінити дані адміністратора";
                buttonAdd.ToolTip    = "Додати адміністратора";
                buttonRemove.ToolTip = "Видалити адміністратора";

                GridView myGrid = new GridView();
                myGrid.AllowsColumnReorder = true;

                GridViewColumn colum1 = new GridViewColumn();
                colum1.DisplayMemberBinding = new Binding("Login");
                colum1.Header = "Логін";
                colum1.Width  = 120;
                myGrid.Columns.Add(colum1);

                GridViewColumn colum2 = new GridViewColumn();
                colum2.DisplayMemberBinding = new Binding("Password");
                colum2.Header = "Пароль";
                colum2.Width  = 120;
                myGrid.Columns.Add(colum2);

                GridViewColumn colum3 = new GridViewColumn();
                colum3.DisplayMemberBinding = new Binding("Owner");
                colum3.Header = "Хто створив";
                colum3.Width  = 120;
                myGrid.Columns.Add(colum3);

                GridViewColumn colum4 = new GridViewColumn();
                colum4.DisplayMemberBinding = new Binding("Date");
                colum4.Header = "Коли";
                colum4.Width  = 85;
                myGrid.Columns.Add(colum4);

                listView.View     = myGrid;
                listView.FontSize = 16;

                UpdateListView();

                break;
                #endregion
            }

            case TypeForm.Users:
            {
                #region
                buttonAdd.Visibility    = Visibility.Hidden;
                buttonRemove.Visibility = Visibility.Hidden;
                textBox.Text            = "Пошук";
                buttonChange.ToolTip    = "Детальніше про користувача";


                GridView myGrid = new GridView();
                myGrid.AllowsColumnReorder = true;

                GridViewColumn colum2 = new GridViewColumn();
                colum2.DisplayMemberBinding = new Binding("Lname");
                colum2.Header = "Прізвище";
                colum2.Width  = 90;
                myGrid.Columns.Add(colum2);

                GridViewColumn colum1 = new GridViewColumn();
                colum1.DisplayMemberBinding = new Binding("Fname");
                colum1.Header = "Им'я";
                colum1.Width  = 90;
                myGrid.Columns.Add(colum1);


                GridViewColumn colum3 = new GridViewColumn();
                colum3.DisplayMemberBinding = new Binding("Count");
                colum3.Header = "Спроби";
                colum3.Width  = 65;
                myGrid.Columns.Add(colum3);

                GridViewColumn colum4 = new GridViewColumn();
                colum4.DisplayMemberBinding = new Binding("Online");
                colum4.Header = "Онлайн";
                colum4.Width  = 70;
                myGrid.Columns.Add(colum4);

                GridViewColumn colum5 = new GridViewColumn();
                colum5.DisplayMemberBinding = new Binding("Offline");
                colum5.Header = "Оффлайн";
                colum5.Width  = 80;
                myGrid.Columns.Add(colum5);

                GridViewColumn colum6 = new GridViewColumn();
                colum6.DisplayMemberBinding = new Binding("Passed");
                colum6.Header = "Успішно";
                colum6.Width  = 70;
                myGrid.Columns.Add(colum6);

                listView.View     = myGrid;
                listView.FontSize = 16;

                UpdateListView();

                break;
                #endregion
            }

            case TypeForm.User:
            {
                #region
                buttonAdd.Visibility    = Visibility.Hidden;
                buttonRemove.Visibility = Visibility.Hidden;
                using (DBWokrSql db = new DBWokrSql(Connection))
                {
                    textBox.Text = db.GetUser(Id_user).Fname + "   " + db.GetUser(Id_user).Lname;
                }
                textBox.FontSize     = 18;
                textBox.IsReadOnly   = true;
                buttonChange.ToolTip = "Детальніше про білет користувача";


                GridView myGrid = new GridView();
                myGrid.AllowsColumnReorder = true;

                GridViewColumn colum1 = new GridViewColumn();
                colum1.DisplayMemberBinding = new Binding("ID");
                colum1.Header = "Білет №";
                colum1.Width  = 70;
                myGrid.Columns.Add(colum1);

                GridViewColumn colum2 = new GridViewColumn();
                colum2.DisplayMemberBinding = new Binding("level");
                colum2.Header = "Рівень";
                colum2.Width  = 120;
                myGrid.Columns.Add(colum2);

                GridViewColumn colum3 = new GridViewColumn();
                colum3.DisplayMemberBinding = new Binding("date");
                colum3.Header = "Дата";
                colum3.Width  = 85;
                myGrid.Columns.Add(colum3);

                GridViewColumn colum4 = new GridViewColumn();
                colum4.DisplayMemberBinding = new Binding("IsOffline");
                colum4.Header = "Онлайн";
                colum4.Width  = 80;
                myGrid.Columns.Add(colum4);

                GridViewColumn colum5 = new GridViewColumn();
                colum5.DisplayMemberBinding = new Binding("IsPassed");
                colum5.Header = "Здав";
                colum5.Width  = 80;
                myGrid.Columns.Add(colum5);

                listView.View     = myGrid;
                listView.FontSize = 16;

                UpdateListView();

                break;
                #endregion
            }
            }
        }