private void Selection(Models.User Temp, bool flag)
        {
            if (flag)
            {
                Users_DGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //Выделение строки
                Change_TSB.Enabled      = true;
                Delete_TSB.Enabled      = true;

                Surname_TB.Text      = Temp.Name;
                Name_TB.Text         = Temp.Surname;
                MiddleName_TB.Text   = Temp.MiddleName;
                Position_TB.Text     = Temp.GetPosition().Name;
                ID_TB.Text           = Temp.ID.ToString();
                DataReg_TB.Text      = Temp.DateCreate.ToShortDateString();
                Login_TB.Text        = Temp.Login;
                HashPassword_TB.Text = Temp.HashPassword;
            }
            else
            {
                Change_TSB.Enabled = false;
                Delete_TSB.Enabled = false;

                Surname_TB.Text      = String.Empty;
                Name_TB.Text         = String.Empty;
                MiddleName_TB.Text   = String.Empty;
                Position_TB.Text     = String.Empty;
                ID_TB.Text           = String.Empty;
                DataReg_TB.Text      = String.Empty;
                Login_TB.Text        = String.Empty;
                HashPassword_TB.Text = String.Empty;
            }
        }
        private void Start(Models.User User)
        {
            Models.Position Position = User.GetPosition();

            if (Position != null)
            {
                Int64 IDPosition = Position.ID;

                switch (IDPosition)
                {
                case 1:     //Администратор
                    Main Administrator = new Main();
                    this.Hide();
                    Tray.Visible = false;
                    Administrator.Show();
                    break;

                case 2:     //Инженер конструктор
                    Design_Engineer_F Design_Engineer = new Design_Engineer_F();
                    this.Hide();
                    if (SystemArgs.SettingsUser.Hidden)
                    {
                        Design_Engineer.WindowState   = FormWindowState.Minimized;
                        Design_Engineer.ShowInTaskbar = false;
                    }
                    Tray.Visible = false;
                    Design_Engineer.Show();
                    break;

                case 3:     //КБ
                    KB_F KB = new KB_F();
                    this.Hide();
                    Tray.Visible = false;
                    KB.Show();
                    break;

                case 4:     //Архивариус
                    AR_Arhive_F Arhive = new AR_Arhive_F();
                    this.Hide();
                    Tray.Visible = false;
                    Arhive.Show();
                    break;

                case 5:    //Сотрудник ПДО
                    PDO_F PDO = new PDO_F();
                    this.Hide();
                    Tray.Visible = false;
                    PDO.Show();
                    break;

                case 6:    //Сотрудник ОПП
                    OPP_F OPP = new OPP_F();
                    this.Hide();
                    Tray.Visible = false;
                    OPP.Show();
                    break;

                case 7:
                    Chief_PDO_F Chief_PDO = new Chief_PDO_F();
                    this.Hide();
                    Tray.Visible = false;
                    Chief_PDO.Show();
                    break;

                default:
                    throw new Exception("Должности пользователя не существует");
                }
            }
        }
        private bool ChangeUser()
        {
            try
            {
                if (Users_DGV.CurrentCell.RowIndex >= 0)
                {
                    Models.User Temp = (Models.User)View[Users_DGV.CurrentCell.RowIndex];

                    if (Temp.Login == "ROOT")
                    {
                        MessageBox.Show("Изменение пользователя ROOT запрещено", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }

                    if (Temp.Login == SystemArgs.User.Login)
                    {
                        MessageBox.Show("Изменение своего пользователя запрещено", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }

                    AD_RegistrationUser_F Dialog = new AD_RegistrationUser_F(Temp)
                    {
                        Text = "Измененте параметров пользователя",
                    };

                    Dialog.DataReg_TB.Text        = Temp.DateCreate.ToShortDateString();
                    Dialog.Surname_TB.Text        = Temp.Name;
                    Dialog.MiddleName_TB.Text     = Temp.MiddleName;
                    Dialog.Name_TB.Text           = Temp.Surname;
                    Dialog.Position_CB.DataSource = SystemArgs.Positions;

                    for (Int32 i = 0; i < SystemArgs.Positions.Count; i++)
                    {
                        if (Temp.GetPosition().ID == SystemArgs.Positions[i].ID)
                        {
                            Dialog.Position_CB.SelectedIndex = i;
                        }
                    }

                    Dialog.label2.Text          = "Укажите новые данные";
                    Dialog.Login_TB.Text        = Temp.Login;
                    Dialog.HashPassword_TB.Text = String.Empty;

                    if (Dialog.ShowDialog() == DialogResult.OK)
                    {
                        Boolean UpdatePassword = true;

                        if (Dialog.ChanageNext_CB.Checked)
                        {
                            UpdatePassword = false;
                        }

                        Models.User NewUser = new Models.User(Temp.ID, Dialog.Surname_TB.Text, Dialog.MiddleName_TB.Text, Dialog.Name_TB.Text, Temp.DateCreate,
                                                              SystemArgs.Positions[Dialog.Position_CB.SelectedIndex].ID,
                                                              Temp.Mails, Dialog.Login_TB.Text, Hash.GetSHA256(Dialog.HashPassword_TB.Text.Trim()), UpdatePassword);

                        if (SystemArgs.Request.ChangeUser(NewUser))
                        {
                            SystemArgs.Users.Remove(Temp);
                            SystemArgs.Users.Add(NewUser);

                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    throw new Exception("Необходимо выбрать объект");
                }
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }