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);
            }
        }
        private bool AddUser()
        {
            try
            {
                AD_RegistrationUser_F Dialog = new AD_RegistrationUser_F(null);

                DateTime DateCreate = DateTime.Now;
                Dialog.DataReg_TB.Text        = DateCreate.ToShortDateString();
                Dialog.Position_CB.DataSource = SystemArgs.Positions;

                if (Dialog.ShowDialog() == DialogResult.OK)
                {
                    Int64 Index = -1;

                    using (var Connect = new NpgsqlConnection(SystemArgs.DataBase.ToString()))
                    {
                        Connect.Open();

                        using (var Command = new NpgsqlCommand($"SELECT last_value FROM \"User_ID_seq\"", Connect))
                        {
                            using (var Reader = Command.ExecuteReader())
                            {
                                while (Reader.Read())
                                {
                                    Index = Reader.GetInt64(0);
                                }
                            }
                        }
                    }

                    Boolean UpdatePassword = true;

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

                    Models.User Temp = new Models.User(Index + 1, Dialog.Name_TB.Text, Dialog.MiddleName_TB.Text, Dialog.Surname_TB.Text, DateCreate, SystemArgs.Positions[Dialog.Position_CB.SelectedIndex].ID,
                                                       new List <Mail>(), Dialog.Login_TB.Text, Hash.GetSHA256(Dialog.HashPassword_TB.Text), UpdatePassword);

                    if (SystemArgs.Request.AddUser(Temp))
                    {
                        SystemArgs.Users.Add(Temp);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }