Beispiel #1
0
 public DataTableUpdater(ConnectionInfo Connection, DataTable Table, string table_name)
 {
     this.dt_now = DateTime.Now;
     this.p_now = new NpgsqlParameter("p_now", this.dt_now);
     this.connection = Connection;
     this.table = Table;
     this.table_name = table_name;
     this.NotifyChangeSink = true;
     this.UpdateUserInfo = true;
     this.UserId = connection.UserId;
 }
Beispiel #2
0
        public static ConnectionInfo Create(string login, string password)
        {
            NpgsqlConnection connection = new NpgsqlConnection();
            connection.ConnectionString =
                System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            ConnectionInfo result = new ConnectionInfo();
            result.Connection = connection;
            result.UserName = login;
            result.passwdhash = GetSHA1String(password, login);
            result.Open();
            object id = result.ExecuteScalar(
                "select id from sys_user where username=:username and passwd=:passwd",
                new NpgsqlParameter("username", login),
                new NpgsqlParameter("passwd", result.passwdhash));
            if(id == null || id is DBNull)
            {
                result.Dispose();
                throw new SoapException("Neplatné jméno nebo heslo", SoapException.ClientFaultCode);
            }
            result.UserId = Convert.ToInt64(id);
            return result;
        }