Example #1
0
        public List <UserGroup> GetUserGroupByUid(IDbCommand icmd, Guid uid)
        {
            icmd.Parameters.Clear();
            MySqlCommand cmd = icmd as MySqlCommand;

            cmd.CommandType = CommandType.Text;
            string sql = @"select id,uid,gid,updatetime from t_user_group
                            where uid = '{0}'";

            cmd.CommandText = string.Format(sql, uid);
            DataTable        dt   = new DataTable();
            List <UserGroup> list = new List <UserGroup>();

            dt.Load(cmd.ExecuteReader());
            if (dt.Rows.Count > 0)
            {
                UserGroup info = null;
                foreach (DataRow dr in dt.Rows)
                {
                    info = new UserGroup();
                    info.AllParse(dr);
                    if (info != null)
                    {
                        list.Add(info);
                    }
                }
            }
            return(list);
        }
Example #2
0
        public UserGroup GetUserGroupById(IDbCommand icmd, Guid id)
        {
            icmd.Parameters.Clear();
            MySqlCommand cmd = icmd as MySqlCommand;

            cmd.CommandType = CommandType.Text;
            string sql = @"select id,uid,gid,updatetime from t_user_group
                            where id = '{0}'";

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

            dt.Load(cmd.ExecuteReader());
            if (dt.Rows.Count > 0)
            {
                info = new UserGroup();
                info.AllParse(dt.Rows[0]);
            }
            return(info);
        }