Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        //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);
        }
Ejemplo n.º 3
0
        //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);
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
 public void login_user(UserEN u)
 {
 }
Ejemplo n.º 10
0
 public void update_user(UserEN u)
 {
 }
Ejemplo n.º 11
0
 public void delete_user(UserEN u)
 {
 }
Ejemplo n.º 12
0
 public void register_user(UserEN u)
 {
 }