Exemplo n.º 1
0
        public void EditRules(int?Profile_ID, Gameprofile model)
        {
            DeepStreamConnector.Instance.UpdateRecord("Rules", "Rules", model.Rules);
            string sql = "UPDATE Gameprofile SET Rules = @0 WHERE Profile_ID = @1";

            update(sql, model.Rules, Profile_ID);
        }
        public int CreateProfile(Gameprofile model)
        {
            int Profile_ID = 0;

            using (MySqlConnection connection = new MySqlConnection(ConnectionString))
                using (MySqlCommand command = new MySqlCommand("", connection))
                {
                    connection.Open();
                    command.CommandText = "INSERT INTO Gameprofile(Profilename, Starting_Budget, Rebuy, Pause_Time, Pause_After) VALUES(@0, @1, @2, @3, @4)";
                    command.Parameters.AddWithValue("@0", model.Profilename);
                    command.Parameters.AddWithValue("@1", model.Starting_Budget);
                    command.Parameters.AddWithValue("@2", model.Rebuy);
                    command.Parameters.AddWithValue("@3", model.Pause_Time);
                    command.Parameters.AddWithValue("@4", model.Pause_After);
                    command.ExecuteNonQuery();

                    command.CommandText = "SELECT * FROM Gameprofile WHERE Profile_ID = LAST_INSERT_ID()";
                    MySqlDataReader reader = command.ExecuteReader();
                    if (reader.Read())
                    {
                        Profile_ID = Convert.ToInt32(reader["Profile_ID"]);
                    }
                    connection.Close();
                }
            return(Profile_ID);
        }
        public void FindProfile(int?Profile_ID, Gameprofile model)
        {
            string sql    = "SELECT * FROM Gameprofile WHERE Profile_ID = @0";
            var    result = find(sql, Profile_ID);

            model.Profile_ID      = result[0]["Profile_ID"];
            model.Profilename     = result[0]["Profilename"];
            model.Starting_Budget = result[0]["Starting_Budget"];
            model.Rebuy           = result[0]["Rebuy"];
            model.Pause_Time      = result[0]["Pause_Time"];
            model.Pause_After     = result[0]["Pause_After"];
            model.Rules           = result[0]["Rules"] is DBNull ? "" : result[0]["Rules"];
            model.Chips           = result[0]["Chips"] is DBNull ? "{}" : result[0]["Chips"];
        }
Exemplo n.º 4
0
        public void FindProfile(int?Profile_ID, Gameprofile model)
        {
            string sql    = "SELECT profilename, Rules FROM Gameprofile WHERE Profile_ID = @0";
            var    result = find(sql, Profile_ID);

            model.Profilename = result[0]["Profilename"];

            if (!result[0]["Rules"].Equals(DBNull.Value))
            {
                model.Rules = result[0]["Rules"];
            }
            else
            {
                model.Rules = null;
            }
        }
        public void EditProfile(int?Profile_ID, Gameprofile model)
        {
            string sql = "UPDATE Gameprofile SET Profilename = @0, Starting_Budget = @1, Rebuy = @2, Pause_Time = @3, Pause_After = @4 WHERE Profile_ID = @5";

            update(sql, model.Profilename, model.Starting_Budget, model.Rebuy, model.Pause_Time, model.Pause_After, Profile_ID);
        }