Exemplo n.º 1
0
        public static List<UserDetail> getUsers()
        {
            string strSQL = "select * from USER";

            DataTable dt=sql.RunSQL(strSQL);
            List<UserDetail> users = new List<UserDetail>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                UserDetail user = new UserDetail();
                user.user_id = int.Parse(dr["USER_ID"].ToString());
                user.user_name=dr["USER_NAME"].ToString();
                users.Add(user);
            }

            return users;
        }
Exemplo n.º 2
0
        public static UserDetail signIN(string email, string password)
        {
            UserDetail user = null;
            try
            {
                user = new UserDetail();
                string strSQL = "select * from USER where EMAIL='" + email + "' and PASSWORD='******'";
                DataTable dt = sql.RunSQL(strSQL);
                if (dt.Rows.Count <= 0)
                    return null;

                DataRow tr = dt.Rows[0];
                user.user_id = int.Parse(tr["USER_ID"].ToString());
                user.user_name = tr["USER_NAME"].ToString();
            }
            catch (Exception e)
            {
                return null;
            }

            return user;
        }
Exemplo n.º 3
0
        public static UserDetail getUser(int user_id)
        {
            UserDetail user = new UserDetail();
                string strSQL = "select * from USER where USER_ID=" + user_id;

                DataTable dt = sql.RunSQL(strSQL);

                DataRow tr = dt.Rows[0];
                user.user_id = int.Parse(tr["USER_ID"].ToString());
                user.user_name = tr["USER_NAME"].ToString();
                return user;
        }