public void deleteUser(RemoteUser rUser) { //Remove user from the local table this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); cmd.CommandText = "delete from " + TABLE_NAME + " where username='******' and system='" + rUser.getSystemName() + "'"; cmd.ExecuteNonQuery(); this.disconnect(); }
public void addUser(RemoteUser rUser) { //add new user this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); DateTime currentTime = DateTime.Now; cmd.CommandText = "insert into " + TABLE_NAME + "(system,username,password,modified_date,status) values('" + rUser.getSystemName() + "','" + rUser.getUsername() + "','" + rUser.getPassword() + "','" + currentTime.ToString() + "','" + rUser.getStatus() + "')"; cmd.ExecuteNonQuery(); this.disconnect(); }
public bool exists(RemoteUser rUser) { //Check whether the entry with the specified System & Username already exists int count = 0; this.connect(); String query = "Select count(*) from " + TABLE_NAME + " where system='" + rUser.getSystemName() + "' and username='******'" ; SqlCeCommand cmd = new SqlCeCommand(query, this.conn); count = (int)cmd.ExecuteScalar(); this.disconnect(); if (count > 0) { return true; } else { return false; } }
public void updatePassword(RemoteUser rUser) {//change user password this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); DateTime currentTime = DateTime.Now; cmd.CommandText = "update " + TABLE_NAME + " set password='******',status='',modified_date='" + currentTime.ToString() + "' where username='******' and system='" + rUser.getSystemName() + "'"; cmd.ExecuteNonQuery(); this.disconnect(); }
public void addUser(RemoteUser rUser) {//add new user this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); DateTime currentTime = DateTime.Now; cmd.CommandText = "insert into " + TABLE_NAME + "(system,username,password,modified_date,status) values('" + rUser.getSystemName() + "','" + rUser.getUsername() + "','" + rUser.getPassword() + "','" + currentTime.ToString() + "','" + rUser.getStatus() + "')"; cmd.ExecuteNonQuery(); this.disconnect(); }
public bool exists(RemoteUser rUser) { //Check whether the entry with the specified System & Username already exists int count = 0; this.connect(); String query = "Select count(*) from " + TABLE_NAME + " where system='" + rUser.getSystemName() + "' and username='******'"; SqlCeCommand cmd = new SqlCeCommand(query, this.conn); count = (int)cmd.ExecuteScalar(); this.disconnect(); if (count > 0) { return(true); } else { return(false); } }
public void updateStatus(RemoteUser rUser) {//Set status this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); cmd.CommandText = "update " + TABLE_NAME + " set status='" + rUser.getStatus() + "' where username='******' and system='" + rUser.getSystemName() + "'"; cmd.ExecuteNonQuery(); this.disconnect(); }
public void deleteUser(RemoteUser rUser) {//Remove user from the local table this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); cmd.CommandText = "delete from " + TABLE_NAME + " where username='******' and system='" + rUser.getSystemName() + "'"; cmd.ExecuteNonQuery(); this.disconnect(); }
public void updateStatus(RemoteUser rUser) { //Set status this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); cmd.CommandText = "update " + TABLE_NAME + " set status='" + rUser.getStatus() + "' where username='******' and system='" + rUser.getSystemName() + "'"; cmd.ExecuteNonQuery(); this.disconnect(); }
public void updatePassword(RemoteUser rUser) { //change user password this.connect(); SqlCeCommand cmd = this.conn.CreateCommand(); DateTime currentTime = DateTime.Now; cmd.CommandText = "update " + TABLE_NAME + " set password='******',status='',modified_date='" + currentTime.ToString() + "' where username='******' and system='" + rUser.getSystemName() + "'"; cmd.ExecuteNonQuery(); this.disconnect(); }