private void GetPassword(out int er)
        {
            DbConnection conn      = DbSources.Sources().GetConnection(m_idListener, out er);
            DataTable    passTable = DbTSQLInterface.Select(ref conn, GetPassRequest(), null, null, out er);

            if (er == 0)
            {
                if (!(passTable.Rows[0][0] is DBNull))
                {
                    passReceive = passTable.Rows[0][0].ToString();
                }
                else
                {
                    passResult = Errors.ParseError;
                }
            }
            else
            {
                passResult = Errors.NoAccess;
            }
        }
        public void Save(int idListener, List <ConnectionSettings> listConnSett, out int err)
        {
            err = 1;
            int    i = -1, c = -1;
            string strQuery, psw
            , hash;

            //char []hash;
            //StringBuilder sb;

            strQuery = psw = string.Empty;

            DbConnection conn = DbSources.Sources().GetConnection(idListener, out err);

            //DbConnection conn = DbTSQLInterface.GetConnection (m_ConnectionSettings, out err);

            if (err == 0)
            {
                DataTable tableSource = null,
                          tablePsw    = null;

                if (err == 0)
                {
                    for (i = 0; i < listConnSett.Count; i++)
                    {
                        tableSource = DbTSQLInterface.Select(ref conn, ConnectionSettingsRequest(listConnSett[i].id), null, null, out err);
                        //TYPE_DATABASE_CFG.CFG_200 = ???
                        tablePsw = DbTSQLInterface.Select(ref conn, PasswordRequest(TYPE_DATABASE_CFG.CFG_200, listConnSett[i].id, 501), null, null, out err);

                        if (tableSource.Rows.Count == 0)
                        {//INSERT
                        }
                        else
                        if (tableSource.Rows.Count == 1)
                        {    //UPDATE
                            if ((listConnSett[i].server.Equals(tableSource.Rows [0]["IP"].ToString()) == false) ||
                                (listConnSett[i].dbName.Equals(tableSource.Rows[0]["DB_NAME"].ToString()) == false) ||
                                (listConnSett[i].userName.Equals(tableSource.Rows[0]["UID"].ToString()) == false))
                            {
                                strQuery += "UPDATE SOURCE SET ";

                                strQuery += "IP='" + listConnSett[i].server + "',";
                                strQuery += "DB_NAME='" + listConnSett[i].dbName + "',";
                                strQuery += "UID='" + listConnSett[i].userName + "'";

                                strQuery += " WHERE ID=" + listConnSett[i].id + ";";
                            }
                            else
                            {
                                ;     //Ничего не изменилось
                            }
                            if (listConnSett[i].password.Length > 0)
                            {
                                //sb = new StringBuilder(listConnSett[i].password);
                                //hash = Crypt.Crypting().to(sb, out err);
                                hash = Crypt.Crypting().Encrypt(listConnSett[i].password, Crypt.KEY);

                                //if (err > 0)
                                if (hash.Length > 0)
                                {
                                    if (tablePsw.Rows.Count == 0)
                                    {    //INSERT
                                        strQuery += "INSERT INTO passwords (ID_EXT, ID_ROLE, HASH) VALUES (";

                                        strQuery += listConnSett[i].id + ", ";
                                        strQuery += 501 + ", ";
                                        strQuery += "'" + hash + "'";

                                        strQuery += ");";
                                    }
                                    else
                                    if (tablePsw.Rows.Count == 1)
                                    {        //UPDATE
                                        strQuery += "UPDATE passwords SET ";

                                        strQuery += "HASH='" + hash + "'";

                                        strQuery += " WHERE ID_EXT=" + listConnSett[i].id;
                                        strQuery += " AND ";
                                        strQuery += "ID_ROLE=" + 501 + ";";
                                    }
                                    else
                                    {
                                        ;
                                    }
                                }
                                else
                                {
                                    ;     //Ошибка шифрования пароля ИЛИ нет пароля
                                }
                            }
                            else
                            {
                                ;     //Нет пароля
                            }
                        }
                        else
                        {
                            ;
                        }
                    }

                    DbTSQLInterface.ExecNonQuery(ref conn, strQuery, null, null, out err);
                }
                else
                {
                    ;
                }
            }
            else
            {
                ;
            }

            //DbTSQLInterface.CloseConnection (conn, out err);
        }