public List <UniversalUserEntity> GetAllUnSyncUserLimit()
        {
            List <UniversalUserEntity> entities = new List <UniversalUserEntity>();

            ConnectDbCustom();

            IDataReader reader = GetDataByStringLimit(KEY_SYNC, "false", 10);

            Debug.Log("Reader fieldCount : " + reader.FieldCount);

            while (reader.Read())
            {
                UniversalUserEntity entity = new UniversalUserEntity();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    // Debug.Log("Index i : " + i);
                    entity.name    = reader[1].ToString();
                    entity.email   = reader[2].ToString();
                    entity.contact = reader[3].ToString();
                    //    entity.age = reader[4].ToString();
                    //    entity.dob = reader[5].ToString();
                    //   entity.gender = reader[6].ToString();
                    entity.game_result  = reader[7].ToString();
                    entity.game_score   = reader[8].ToString();
                    entity.created_at   = reader[9].ToString();
                    entity.is_submitted = reader[10].ToString();
                }

                entities.Add(entity);
            }

            Close();

            return(entities);
        }
        public List <UniversalUserEntity> GetAllUnSyncUserSlow()
        {
            List <UniversalUserEntity> entities = new List <UniversalUserEntity>();

            ConnectDbCustom();

            FieldInfo[] fieldInfo = Type.GetType(gameSettings.sQliteDBSettings.UniversalUserClassName).GetFields();

            IDataReader reader = GetDataByString(KEY_SYNC, "false");

            //   Debug.Log("Reader fieldCount : " + reader.FieldCount);

            while (reader.Read())
            {
                UniversalUserEntity entity = new UniversalUserEntity();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    // Debug.Log("Index i : " + i);
                    fieldInfo[i].SetValue(entity, reader[i].ToString());
                }

                entities.Add(entity);
            }

            Close();

            return(entities);
        }
        public void UpdateSyncUser(UniversalUserEntity userEntity)
        {
            List <string> col = new List <string>();
            List <string> con = new List <string>();

            col.Add("is_submitted");
            con.Add("true");

            string condition = KEY_EMAIL + " = '" + userEntity.email + "'";

            try { UpdateData(col, con, condition); Debug.Log("Update user " + userEntity.email + " to submitted"); }
            catch (Exception ex)
            {
                Debug.LogError(ex.Message);
            }
        }
예제 #4
0
    private IEnumerator CompareLocalAndServerData()
    {
        SetUpDb();

        DataBank.UniversalUserEntity u = new DataBank.UniversalUserEntity();

        for (int m = 0; m < emailList.Count; m++)
        {
            UniversalUserEntity foundUser = FindDuplicatedStringItem(emailList[m], unSyncUsers);
            if (foundUser != null)
            {
                // SetUpDb();
                //  if (udb.GetDataByString("email", foundUser.email) != null) udb.UpdateSyncUser(foundUser);

                yield return(new WaitForEndOfFrame());

                unSyncUsers.Remove(foundUser);

                Debug.Log(foundUser.email + " is removed from sync");
            }
        }
    }
        public List <UniversalUserEntity> GetAllUser()
        {
            List <UniversalUserEntity> entities = new List <UniversalUserEntity>();

            FieldInfo[] fieldInfo = Type.GetType(gameSettings.sQliteDBSettings.UniversalUserClassName).GetFields();

            IDataReader reader = GetAllData();

            while (reader.Read())
            {
                UniversalUserEntity entity = new UniversalUserEntity();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    fieldInfo[i].SetValue(entity, reader[i].ToString());
                }

                entities.Add(entity);
            }

            Close();

            return(entities);
        }