Example #1
0
        /// <summary>
        /// 根据指定的范围,获取指定的数据
        /// </summary>
        /// <param name="start"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public static List <dataList> GetPageList(int start, int num)
        {
            string sql = "select * from vip_user limit @start , @num";

            MySqlParameter[] pars =
            {
                new MySqlParameter("@start", MySqlDbType.Int32),
                new MySqlParameter("@num",   MySqlDbType.Int32)
            };
            pars[0].Value = start;
            pars[1].Value = num;

            DataTable       da   = sqlHelper.GetDataTable(sql, CommandType.Text, pars);
            List <dataList> list = null;

            if (da.Rows.Count > 0)
            {
                list = new List <dataList>();
                dataList datalist = null;
                foreach (DataRow row in da.Rows)
                {
                    datalist = new dataList();
                    LoadEntity(datalist, row);
                    list.Add(datalist);
                }
            }
            return(list);
        }
Example #2
0
        /// <summary>
        /// 将数据库读取的值一个一个对应的赋予类dataList的变量
        /// </summary>
        /// <param name="dataList"></param>
        /// <param name="row"></param>
        private static void LoadEntity(dataList dataList, DataRow row)
        {
            dataList.Id       = Convert.ToInt32(row["id"]);
            dataList.UserName = row["user"] != DBNull.Value ? row["user"].ToString() : string.Empty;

            dataList.PassWord = row["password"] != DBNull.Value ? row["password"].ToString() : string.Empty;

            dataList.Mac = row["mac"].ToString();
            dataList.Ip  = row["ip"].ToString();
        }
Example #3
0
    // Use this for initialization
    void Start()
    {
        //adding child objects into separate arrays at the start
        //each array will contain a list of gameobjects with the specific tag

        gridMap = new int[3, 3, 3];//3D array which holds the positions of the cube pieces
        form    = 0;
        id      = 0;
        TextAsset asset = Resources.Load("data") as TextAsset;

        if (asset != null)
        {
            dataList = JsonUtility.FromJson <dataList>(asset.text);
        }
        else
        {
            print("asset is null");
        }

        piece1 = GameObject.FindGameObjectsWithTag("piece1");
        piece2 = GameObject.FindGameObjectsWithTag("piece2");
        piece3 = GameObject.FindGameObjectsWithTag("piece3");
        piece4 = GameObject.FindGameObjectsWithTag("piece4");
        piece5 = GameObject.FindGameObjectsWithTag("piece5");
        piece6 = GameObject.FindGameObjectsWithTag("piece6");
        piece7 = GameObject.FindGameObjectsWithTag("piece7");

        sCube[0] = piece1;
        sCube[1] = piece2;
        sCube[2] = piece3;
        sCube[3] = piece4;
        sCube[4] = piece5;
        sCube[5] = piece6;
        sCube[6] = piece7;

        formation = "";



        print("x" + Mathf.Floor(piece1[0].transform.position.x));
        //print("y"+piece1[0].transform.position.y);
        //print("z"+piece1[0].transform.position.z);
        print(getPositionX(piece1[0]));



        // print("x" + piece1[1].transform.position.x);
        //print("y" + piece1[1].transform.position.y);
        //print("z" + piece1[1].transform.position.z);
    }
Example #4
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public static List <dataList> GetList()
        {
            string          sql  = "select * from vip_user";
            DataTable       da   = sqlHelper.GetDataTable(sql, CommandType.Text);
            List <dataList> list = null;

            if (da.Rows.Count > 0)
            {
                list = new List <dataList>();
                dataList datalist = null;
                foreach (DataRow row in da.Rows)
                {
                    datalist = new dataList();
                    LoadEntity(datalist, row);   //将数据库读取的值一个一个对应的赋予类dataList的变量
                    list.Add(datalist);
                }
            }
            return(list);
        }