private void FundMoney(GameServerClient client, int nID, byte[] cmdParams, int count) { bool bResult = false; try { FundDBItem item = DataHelper.BytesToObject <FundDBItem>(cmdParams, 0, count); bResult = this.FundAddMoney(item.UserID, item.Value1, item.RoleID, item.Value2); } catch (Exception ex) { LogManager.WriteException(ex.Message); } client.sendCmd <bool>(nID, bResult); }
private void FundBuy(GameServerClient client, int nID, byte[] cmdParams, int count) { bool bResult = false; MySQLConnection conn = null; try { FundDBItem item = DataHelper.BytesToObject <FundDBItem>(cmdParams, 0, count); string cmdText = string.Format("UPDATE t_fund SET state='0' where zoneID='{0}' and userID='{1}' and roleID='{2}' and fundType='{3}' and state='1'", new object[] { item.ZoneID, item.UserID, item.RoleID, item.FundType }); string cmdText2 = string.Format("INSERT INTO t_fund(zoneID,userID,roleID,fundType,fundID,buyTime) VALUE('{0}','{1}','{2}','{3}','{4}','{5}')", new object[] { item.ZoneID, item.UserID, item.RoleID, item.FundType, item.FundID, item.BuyTime }); GameDBManager.SystemServerSQLEvents.AddEvent(string.Format("+SQL: {0}", cmdText), EventLevels.Important); GameDBManager.SystemServerSQLEvents.AddEvent(string.Format("+SQL: {0}", cmdText2), EventLevels.Important); conn = DBManager.getInstance().DBConns.PopDBConnection(); MySQLCommand cmd = new MySQLCommand(cmdText, conn); bResult = (cmd.ExecuteNonQuery() > 0); cmd = new MySQLCommand(cmdText2, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); bResult = true; } catch (Exception ex) { LogManager.WriteException(ex.Message); bResult = false; } finally { if (null != conn) { DBManager.getInstance().DBConns.PushDBConnection(conn); } } client.sendCmd <bool>(nID, bResult); }
private void FundAward(GameServerClient client, int nID, byte[] cmdParams, int count) { bool bResult = false; using (MyDbConnection3 conn = new MyDbConnection3(false)) { FundDBItem item = DataHelper.BytesToObject <FundDBItem>(cmdParams, 0, count); string cmdText = string.Format("UPDATE t_fund SET awardID='{0}',state='{1}' where zoneID='{2}' and userID='{3}' and roleID='{4}' and fundType='{5}' and fundID='{6}'", new object[] { item.AwardID, item.State, item.ZoneID, item.UserID, item.RoleID, item.FundType, item.FundID }); bResult = conn.ExecuteNonQueryBool(cmdText, 0); } client.sendCmd <bool>(nID, bResult); }