public ClientSpace SelectClientSpace(long clientSpaceID) { try { using (TransactionScope scope = new TransactionScope()) { SQLiteConnection connection = (SQLiteConnection)DatabaseManager.DatabaseEngine.GetConnection(); SQLiteCommand cmd = connection.CreateCommand(); cmd.Connection = connection; cmd.CommandText = procs["Select ClientSpace"]; cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", clientSpaceID)); SQLiteDataReader reader = cmd.ExecuteReader(); ClientSpace obj = null; if (reader.Read()) { obj = new ClientSpace(reader); } reader.Close(); scope.Complete(); return(obj); } } finally { DatabaseManager.DatabaseEngine.ReleaseConnection(); } }
public Result Store(ClientSpace client) { try { using (TransactionScope scope = new TransactionScope()) { SQLiteConnection connection = (SQLiteConnection)DatabaseManager.DatabaseEngine.GetConnection(); SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = procs["Store ClientSpace"]; cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", client.ClientSpaceID)); cmd.Parameters.Add(new SQLiteParameter("@Name", client.Name)); cmd.Parameters.Add(new SQLiteParameter("@Enabled", client.Enabled)); cmd.Parameters.Add(new SQLiteParameter("@PrimaryUserID", client.PrimaryUserID)); cmd.ExecuteNonQuery(); scope.Complete(); } } catch (Exception ex) { return(new Result("Unable to store ClientSpace: " + ex.Message)); } finally { DatabaseManager.DatabaseEngine.ReleaseConnection(); } return(new Result()); }
public Result Store(ClientSpace client) { using (SQLiteConnection connection = new SQLiteConnection(DatabaseManager.DatabaseEngine.ConnectionString)) { connection.Open(); using (TransactionScope scope = new TransactionScope()) { try { SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = GetSQL("Store ClientSpace"); cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", client.ClientSpaceID)); cmd.Parameters.Add(new SQLiteParameter("@Name", client.Name)); cmd.Parameters.Add(new SQLiteParameter("@Enabled", client.Enabled)); cmd.Parameters.Add(new SQLiteParameter("@PrimaryUserID", client.PrimaryUserID)); cmd.ExecuteNonQuery(); scope.Complete(); } catch (Exception ex) { return(new Result("Unable to store ClientSpace: " + ex.Message)); } } } return(new Result()); }
public void create(Client _client, ClientSpace space) { client = _client; currentSpace = space; patienceLeft = client.patience; foreach (Requirenment req in client.requirenments) { addRequirenment(req); } Sprite t1 = Resources.Load <Sprite> ("clients/" + client.avatar); avatar.sprite2D = t1; if (client.item.Length == 0) { Sprite[] textures = Resources.LoadAll <Sprite>("items"); Sprite texture = textures[Random.Range(0, textures.Length)]; itemIcon.sprite2D = texture; //go.GetComponent<Renderer>().material.mainTexture = texture; } else { Sprite t2 = Resources.Load <Sprite>("items/" + client.item); itemIcon.sprite2D = t2; } /* * Object[] textures = Resources.LoadAll("Textures"); * Texture2D texture = textures[Random.Range(0, textures.Length)]; * go.GetComponent<Renderer>().material.mainTexture = texture; */ Sprite t3 = Resources.Load <Sprite> ("heat/" + getHeatName(client.heatType)); heatIcon.sprite2D = t3; Invoke("startPatienceReduction", patienceTimerDelay); // TODO heat moneyRewardLabel.text = client.reward.ToString(); gameObject.MoveBy(-new Vector3(0f, 0.75f, 0f), 1f, 0, EaseType.easeInOutSine); }
public Result Delete(ClientSpace client) { Result result = new Result(); if (OnBeforeDeleteClientSpace != null) { OnBeforeDeleteClientSpace(client, result); } if (result.Succeeded) { using (SQLiteConnection connection = new SQLiteConnection(DatabaseManager.DatabaseEngine.ConnectionString)) { connection.Open(); using (TransactionScope scope = new TransactionScope()) { try { SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "DELETE FROM ClientSpaces WHERE ClientSpaceID = @ClientSpaceID"; cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", client.ClientSpaceID)); cmd.ExecuteNonQuery(); scope.Complete(); } catch (Exception ex) { return(new Result("Unable to delete ClientSpace: " + ex.Message)); } } } if (OnClientSpaceDeleted != null) { OnClientSpaceDeleted(client); } } return(result); }
public Result Store(ClientSpace client) { try { using (TransactionScope scope = new TransactionScope()) { SQLiteConnection connection = (SQLiteConnection)DatabaseManager.DatabaseEngine.GetConnection(); SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = procs["Store ClientSpace"]; cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", client.ClientSpaceID)); cmd.Parameters.Add(new SQLiteParameter("@Name", client.Name)); cmd.Parameters.Add(new SQLiteParameter("@Enabled", client.Enabled)); cmd.Parameters.Add(new SQLiteParameter("@PrimaryUserID", client.PrimaryUserID)); cmd.ExecuteNonQuery(); scope.Complete(); } } catch (Exception ex) { return new Result("Unable to store ClientSpace: " + ex.Message); } finally { DatabaseManager.DatabaseEngine.ReleaseConnection(); } return new Result(); }
public ClientSpace SelectClientSpace(long clientSpaceID) { try { using (TransactionScope scope = new TransactionScope()) { SQLiteConnection connection = (SQLiteConnection)DatabaseManager.DatabaseEngine.GetConnection(); SQLiteCommand cmd = connection.CreateCommand(); cmd.Connection = connection; cmd.CommandText = procs["Select ClientSpace"]; cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", clientSpaceID)); SQLiteDataReader reader = cmd.ExecuteReader(); ClientSpace obj = null; if (reader.Read()) obj = new ClientSpace(reader); reader.Close(); scope.Complete(); return obj; } } finally { DatabaseManager.DatabaseEngine.ReleaseConnection(); } }
public Result Delete(ClientSpace client) { Result result = new Result(); if (OnBeforeDeleteClientSpace != null) OnBeforeDeleteClientSpace(client, result); if (result.Succeeded) { using (SQLiteConnection connection = new SQLiteConnection(DatabaseManager.DatabaseEngine.ConnectionString)) { connection.Open(); using (TransactionScope scope = new TransactionScope()) { try { SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "DELETE FROM ClientSpaces WHERE ClientSpaceID = @ClientSpaceID"; cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", client.ClientSpaceID)); cmd.ExecuteNonQuery(); scope.Complete(); } catch (Exception ex) { return new Result("Unable to delete ClientSpace: " + ex.Message); } } } if (OnClientSpaceDeleted != null) OnClientSpaceDeleted(client); } return result; }
public Result Store(ClientSpace client) { using (SQLiteConnection connection = new SQLiteConnection(DatabaseManager.DatabaseEngine.ConnectionString)) { connection.Open(); using (TransactionScope scope = new TransactionScope()) { try { SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = GetSQL("Store ClientSpace"); cmd.Parameters.Add(new SQLiteParameter("@ClientSpaceID", client.ClientSpaceID)); cmd.Parameters.Add(new SQLiteParameter("@Name", client.Name)); cmd.Parameters.Add(new SQLiteParameter("@Enabled", client.Enabled)); cmd.Parameters.Add(new SQLiteParameter("@PrimaryUserID", client.PrimaryUserID)); cmd.ExecuteNonQuery(); scope.Complete(); } catch(Exception ex) { return new Result("Unable to store ClientSpace: " + ex.Message); } } } return new Result(); }