コード例 #1
0
//        ALTER TABLE `gamblestoneplayerbetrecord201702`
//ADD COLUMN `InningIndex` INT NOT NULL DEFAULT 0 AFTER `InningID`;



        public bool AddGambleStoneRoundInfo(GambleStoneRoundInfo round)
        {
            return(MyDBHelper.Instance.ConnectionCommandExecuteNonQuery(mycmd =>
            {
                string sqlText = "insert into gamblestoneroundinfo (`StartTime`,`FinishedInningCount`,`EndTime`,`CurrentWinRedCount`,`CurrentWinGreenCount`,`CurrentWinBlueCount`,`CurrentWinPurpleCount`,`LastWinRedCount`,`LastWinGreenCount`,`LastWinBlueCount`,`LastWinPurpleCount`,`AllBetInStone`,`AllWinnedOutStone`,`WinColorItems`,`TableName`) " +
                                 " values ( @StartTime,@FinishedInningCount,@EndTime,@CurrentWinRedCount,@CurrentWinGreenCount,@CurrentWinBlueCount,@CurrentWinPurpleCount,@LastWinRedCount,@LastWinGreenCount,@LastWinBlueCount,@LastWinPurpleCount,@AllBetInStone,@AllWinnedOutStone,@WinColorItems,@TableName ) ";
                mycmd.CommandText = sqlText;
                mycmd.Parameters.AddWithValue("@StartTime", round.StartTime.ToDateTime());
                mycmd.Parameters.AddWithValue("@FinishedInningCount", round.FinishedInningCount);
                mycmd.Parameters.AddWithValue("@EndTime", round.EndTime == null ? DBNull.Value : (object)round.EndTime.ToDateTime());
                mycmd.Parameters.AddWithValue("@CurrentWinRedCount", round.CurrentWinRedCount);
                mycmd.Parameters.AddWithValue("@CurrentWinGreenCount", round.CurrentWinGreenCount);
                mycmd.Parameters.AddWithValue("@CurrentWinBlueCount", round.CurrentWinBlueCount);
                mycmd.Parameters.AddWithValue("@CurrentWinPurpleCount", round.CurrentWinPurpleCount);
                mycmd.Parameters.AddWithValue("@LastWinRedCount", round.LastWinRedCount);
                mycmd.Parameters.AddWithValue("@LastWinGreenCount", round.LastWinGreenCount);
                mycmd.Parameters.AddWithValue("@LastWinBlueCount", round.LastWinBlueCount);
                mycmd.Parameters.AddWithValue("@LastWinPurpleCount", round.LastWinPurpleCount);
                mycmd.Parameters.AddWithValue("@AllBetInStone", round.AllBetInStone);
                mycmd.Parameters.AddWithValue("@AllWinnedOutStone", round.AllWinnedOutStone);
                mycmd.Parameters.AddWithValue("@WinColorItems", BytesConverter.ConvertByteArrayToBytes(round.WinColorItems));
                mycmd.Parameters.AddWithValue("@TableName", round.TableName);

                mycmd.ExecuteNonQuery();
            }));
        }
コード例 #2
0
        public bool UpdateGambleStoneRoundInfo(GambleStoneRoundInfo round, CustomerMySqlTransaction myTrans)
        {
            MySqlCommand mycmd = null;

            try
            {
                mycmd = myTrans.CreateCommand();
                string sqlText = "update gamblestoneroundinfo set `StartTime`=@StartTime,`FinishedInningCount`=@FinishedInningCount,`EndTime`=@EndTime,`CurrentWinRedCount`=@CurrentWinRedCount," +
                                 "`CurrentWinGreenCount`=@CurrentWinGreenCount,`CurrentWinBlueCount`=@CurrentWinBlueCount,`CurrentWinPurpleCount`=@CurrentWinPurpleCount,`LastWinRedCount`=@LastWinRedCount," +
                                 "`LastWinGreenCount`=@LastWinGreenCount,`LastWinBlueCount`=@LastWinBlueCount,`LastWinPurpleCount`=@LastWinPurpleCount,`AllBetInStone`=@AllBetInStone," +
                                 "`AllWinnedOutStone`=@AllWinnedOutStone,`WinColorItems`=@WinColorItems,`TableName`=@TableName " +
                                 " where `id`=@id ";
                mycmd.CommandText = sqlText;
                mycmd.Parameters.AddWithValue("@StartTime", round.StartTime.ToDateTime());
                mycmd.Parameters.AddWithValue("@FinishedInningCount", round.FinishedInningCount);
                mycmd.Parameters.AddWithValue("@EndTime", round.EndTime == null ? DBNull.Value : (object)round.EndTime.ToDateTime());
                mycmd.Parameters.AddWithValue("@CurrentWinRedCount", round.CurrentWinRedCount);
                mycmd.Parameters.AddWithValue("@CurrentWinGreenCount", round.CurrentWinGreenCount);
                mycmd.Parameters.AddWithValue("@CurrentWinBlueCount", round.CurrentWinBlueCount);
                mycmd.Parameters.AddWithValue("@CurrentWinPurpleCount", round.CurrentWinPurpleCount);
                mycmd.Parameters.AddWithValue("@LastWinRedCount", round.LastWinRedCount);
                mycmd.Parameters.AddWithValue("@LastWinGreenCount", round.LastWinGreenCount);
                mycmd.Parameters.AddWithValue("@LastWinBlueCount", round.LastWinBlueCount);
                mycmd.Parameters.AddWithValue("@LastWinPurpleCount", round.LastWinPurpleCount);
                mycmd.Parameters.AddWithValue("@AllBetInStone", round.AllBetInStone);
                mycmd.Parameters.AddWithValue("@AllWinnedOutStone", round.AllWinnedOutStone);
                mycmd.Parameters.AddWithValue("@WinColorItems", BytesConverter.ConvertByteArrayToBytes(round.WinColorItems));
                mycmd.Parameters.AddWithValue("@TableName", round.TableName);
                mycmd.Parameters.AddWithValue("@id", round.ID);

                mycmd.ExecuteNonQuery();
                return(true);
            }
            finally
            {
                if (mycmd != null)
                {
                    mycmd.Dispose();
                }
            }
        }