public DataTable verifyPassword(string password)
        {
            List <Tuple <string, string> > Columns = new List <Tuple <string, string> >();

            Columns.Add(Tuple.Create("id", Login.user_id.ToString()));
            Columns.Add(Tuple.Create("password", "\'" + Encrption.GetHashString(password) + "\'"));
            return(this.select("users", Columns));
        }
        public int addUser()
        {
            List <Tuple <string, string> > Columns = new List <Tuple <string, string> >();

            Columns.Add(Tuple.Create("name", "\'" + this.name + "\'"));
            Columns.Add(Tuple.Create("username", "\'" + this.username + "\'"));
            Columns.Add(Tuple.Create("email", "\'" + this.email + "\'"));
            Columns.Add(Tuple.Create("password", "\'" + Encrption.GetHashString(this.password) + "\'"));
            Columns.Add(Tuple.Create("user_role_code", "\'" + this.user_role + "\'"));
            Columns.Add(Tuple.Create("user_status_id", this.user_status.ToString()));
            Columns.Add(Tuple.Create("created_at", "\'" + this.created_at + "\'"));
            return(this.insert("users", Columns));
        }
        public int updateUser()
        {
            Hashtable Columns = new Hashtable();

            Columns.Add("name", "\'" + this.name + "\'");
            Columns.Add("username", "\'" + this.username + "\'");
            Columns.Add("email", "\'" + this.email + "\'");
            Columns.Add("user_role_code", "\'" + this.user_role + "\'");
            Columns.Add("user_status_id", this.user_status);
            Columns.Add("password", "\'" + Encrption.GetHashString(this.password) + "\'");

            Hashtable whereClause = new Hashtable();

            whereClause.Add("id", this.id);

            return(this.update("users", Columns, whereClause));
        }
Example #4
0
        public DataTable Login_action(string username, string password)
        {
            String Password = Encrption.GetHashString(password);
            List <Tuple <string, string> > Columns = new List <Tuple <string, string> >();

            Columns.Add(Tuple.Create("username", "\'" + username + "\'"));
            Columns.Add(Tuple.Create("password", "\'" + Password + "\'"));

            DataTable data = this.select("users", Columns, new string[] { "*" });

            if (data.Rows.Count > 0)
            {
                Login.user_id     = int.Parse(data.Rows[0]["id"].ToString());
                Login.name        = data.Rows[0]["name"].ToString();
                Login.username    = data.Rows[0]["username"].ToString();
                Login.email       = data.Rows[0]["email"].ToString();
                Login.user_role   = data.Rows[0]["user_role_code"].ToString();
                Login.user_status = data.Rows[0]["user_status_id"].ToString();

                return(data);
            }
            return(data);
        }