Example #1
0
        public void saveResource(SimpleSQLManager dbManager, ResourceResp response)
        {
            ConfigRow configRow = LoadConfig(dbManager);

            if (response.latestVersion > configRow.ResourceVersion)
            {
                dbManager.BeginTransaction();

                dbManager.Execute("UPDATE ConfigRow SET ResourceVersion = ? WHERE Id = ?", response.latestVersion, 1);

                Resource   r;
                Resource[] list = response.list;
                for (int i = 0; i < list.Length; i++)
                {
                    r = list[i];
                    dbManager.Execute("DELETE FROM ResourceRow WHERE Code = ? AND Lan = ?", r.code, r.lan);
                    dbManager.Insert(new ResourceRow
                    {
                        Code = r.code,
                        Lan  = r.lan,
                        Desc = r.desc
                    });
                }

                dbManager.Commit();
                Debug.Log(list.Length + " ResourceRow records updated.");
            }
        }
Example #2
0
        public ConfigRow SaveDefaultConfig(SimpleSQLManager dbManager)
        {
            ConfigRow configRow = new ConfigRow();

            configRow.Id = 1;
            configRow.ResourceVersion = 0;
            //SystemLanguage systemLanguage = Application.systemLanguage;
            //configRow.Lan = systemLanguage.ToString();
            configRow.Lan = "Chinese";
            dbManager.Insert(configRow);
            return(configRow);
        }
Example #3
0
        public void SaveProfile(SimpleSQLManager dbManager, LoginResp response)
        {
            dbManager.BeginTransaction();
            dbManager.Execute("DELETE FROM SessionRow WHERE Id = 1");
            SessionRow row = new SessionRow();

            row.Id       = 1;
            row.Token    = response.token;
            row.Mobile   = response.mobile;
            row.Status   = response.status;
            row.NickName = response.nickName;
            dbManager.Insert(row);
            dbManager.Commit();
        }
Example #4
0
    public void SaveUserInfo()
    {
        Debug.Log("application " + Application.persistentDataPath);
        UserProfile user_Data = dbmanager.Table <UserProfile>().FirstOrDefault();

        if (user_Data.Username == null)
        {
            user_Data.Username = UsernameField.text;
            user_Data.ImageUrl = image_path;
            dbmanager.Insert(user_Data);
        }
        else
        {
            user_Data.Username = UsernameField.text;
            user_Data.ImageUrl = image_path;
            dbmanager.UpdateTable(user_Data);
        }
    }
 /// <summary>创建一条数据</summary>
 private void createData(CacheInfo data)
 {
     m_DbManager.Insert(data);
 }