Exemplo n.º 1
0
        public UserLogin GetUserLoginInfoById(IDbCommand icmd, Guid id)
        {
            icmd.Parameters.Clear();
            MySqlCommand cmd = icmd as MySqlCommand;

            cmd.CommandType = CommandType.Text;
            string sql = @"select id,login_name,password,cellphone,email,last_login_ip,last_login_time,create_user_id,createtime,is_authentication,prop1,prop2,prop3,status
                            from t_user_login
                            where id = '{0}'";

            cmd.CommandText = string.Format(sql, id);
            DataTable dt   = new DataTable();
            UserLogin info = null;

            dt.Load(cmd.ExecuteReader());
            if (dt.Rows.Count > 0)
            {
                info = new UserLogin();
                info.AllParse(dt.Rows[0]);
            }
            return(info);
        }
Exemplo n.º 2
0
        public List <UserLogin> GetUserLoginInfoPageList(IDbCommand icmd, string fields, string whereCondition, int startIndex, int pageSize)
        {
            icmd.Parameters.Clear();
            MySqlCommand cmd = icmd as MySqlCommand;

            cmd.CommandType = CommandType.Text;
            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(fields))
            {
                sb.AppendFormat("select {0} from t_user_login ", fields);
            }
            if (!string.IsNullOrEmpty(whereCondition))
            {
                sb.AppendFormat("{0} ", whereCondition);
            }
            sb.AppendFormat("limit {0},{1}", startIndex, pageSize);
            cmd.CommandText = sb.ToString();
            DataTable        dt   = new DataTable();
            List <UserLogin> list = new List <UserLogin>();

            dt.Load(cmd.ExecuteReader());
            if (dt.Rows.Count > 0)
            {
                UserLogin info = null;
                foreach (DataRow dr in dt.Rows)
                {
                    info = new UserLogin();
                    info.AllParse(dr);
                    if (info != null)
                    {
                        list.Add(info);
                    }
                }
            }
            return(list);
        }