public ArrayList login_user(UserEN u) { string s = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ToString(); ArrayList al = new ArrayList(); SqlConnection c = new SqlConnection(s); try { c.Open(); SqlCommand com = new SqlCommand("Select * from User where email = " + u.Email, c); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { al.Add(dr["Email"].ToString()); } dr.Close(); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR: Login User"); } finally { c.Close(); } return(al); }
//Method used in order to update the information about a client public DataSet update_Client(UserEN cl, int i) { ClientCAD c = new ClientCAD(); DataSet da = c.update(cl, i); return(da); }
//Method used in order to add a client to the DB public DataSet add_Client(UserEN u) { ClientCAD c = new ClientCAD(); DataSet da = c.addClient(u); return(da); }
public void delete_user(UserEN u) { string s = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ToString(); SqlConnection c = new SqlConnection(s); try { c.Open(); SqlCommand com = new SqlCommand("Delete From User Where Email = " + u.Email, c); com.ExecuteNonQuery(); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR Deleting the Admin"); } finally { c.Close(); } }
public void register_user(UserEN u) { string s = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ToString(); SqlConnection c = new SqlConnection(s); try { c.Open(); SqlCommand com = new SqlCommand("Insert Into User (password, username, name, email, phoneNumber, dni) VALUES ('" + u.Password + "','" + u.Username + "','" + u.Name + "','" + u.Email + "'," + u.PhoneNumber + "'," + u.Dni + "')", c); com.ExecuteNonQuery(); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR Registering the User"); } finally { c.Close(); } }
public void update_user(UserEN u) { string s = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ToString(); SqlConnection c = new SqlConnection(s); try { c.Open(); SqlCommand com = new SqlCommand("Update User Set name = '" + u.Name + "', email ='" + u.Email + "', password = '******',username = "******"',phoneNumber = '" + u.PhoneNumber + "'and dni = '" + u.Dni, c); com.ExecuteNonQuery(); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR updating the User"); } finally { c.Close(); } }
public DataSet addClient(UserEN cliente_nuevo) { String str; str = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); SqlConnection c = new SqlConnection(str); DataSet virtdb = new DataSet(); try { SqlDataAdapter da = new SqlDataAdapter("select * from Client", c); da.Fill(virtdb, "client"); DataTable dt = new DataTable(); dt = virtdb.Tables["client"]; DataRow newRow = dt.NewRow(); newRow[0] = cliente_nuevo.Email; newRow[1] = cliente_nuevo.Password; newRow[2] = cliente_nuevo.Name; newRow[3] = cliente_nuevo.Username; newRow[4] = cliente_nuevo.PhoneNumber; newRow[5] = cliente_nuevo.Dni; dt.Rows.Add(newRow); SqlCommandBuilder cbuilder = new SqlCommandBuilder(da); da.Update(virtdb, "client"); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR adding the new client"); } finally { c.Close(); } return(virtdb); }
public DataSet update(UserEN cliente_actualizado, int i) { string s; s = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); SqlConnection c = new SqlConnection(s); DataSet virtdb = new DataSet(); try { SqlDataAdapter da = new SqlDataAdapter("select * from Client'", c); da.Fill(virtdb, "client"); DataTable t = new DataTable(); t = virtdb.Tables["client"]; t.Rows[i]["Email"] = cliente_actualizado.Email; t.Rows[i]["Password"] = cliente_actualizado.Password; t.Rows[i]["Name"] = cliente_actualizado.Name; t.Rows[i]["Username"] = cliente_actualizado.Username; t.Rows[i]["PhoneNumber"] = cliente_actualizado.PhoneNumber; t.Rows[i]["Dni"] = cliente_actualizado.Dni; SqlCommandBuilder cbuilder = new SqlCommandBuilder(da); da.Update(virtdb, "client"); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR Updating the client"); } finally { c.Close(); } return(virtdb); }
public void login_user(UserEN u) { }
public void update_user(UserEN u) { }
public void delete_user(UserEN u) { }
public void register_user(UserEN u) { }