public PlayerBuyVirtualShoppingItemRecord[] GetPlayerBuyVirtualShoppingItemRecordByName(string playerUserName, string shoppingItemName, MyDateTime beginBuyTime, MyDateTime endBuyTime, int pageItemCount, int pageIndex) { PlayerBuyVirtualShoppingItemRecord[] items = null; bool isOK = MyDBHelper.Instance.ConnectionCommandSelect(mycmd => { string sqlTextA = "SELECT n.* FROM playerbuyvirtualshoppingitemrecord n "; StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(playerUserName)) { builder.Append(" n.UserID = (select `id` from playersimpleinfo where `UserName` = @UserName) "); mycmd.Parameters.AddWithValue("@UserName", DESEncrypt.EncryptDES(playerUserName)); } if (!string.IsNullOrEmpty(shoppingItemName)) { if (builder.Length != 0) { builder.Append(" and "); } builder.Append(" n.VirtualShoppingItemID = (SELECT `ID` FROM virtualshoppingitem where `Name`=@ItemName) "); mycmd.Parameters.AddWithValue("@ItemName", shoppingItemName); } if (beginBuyTime != null && !beginBuyTime.IsNull && endBuyTime != null && !endBuyTime.IsNull) { if (builder.Length != 0) { builder.Append(" and "); } DateTime beginTime = beginBuyTime.ToDateTime(); DateTime endTime = endBuyTime.ToDateTime(); if (beginTime >= endTime) { return; } builder.Append(" n.BuyTime >= @beginTime and n.BuyTime < @endTime "); mycmd.Parameters.AddWithValue("@beginTime", beginTime); mycmd.Parameters.AddWithValue("@endTime", endTime); } string sqlWhere = ""; if (builder.Length > 0) { sqlWhere = " where " + builder.ToString(); } string sqlOrderLimit = " order by n.ID desc "; if (pageItemCount > 0) { int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount; sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount; } string sqlAllText = "select ttt.*, s.UserName as UserName, v.Name as VirtualShoppingItemName from " + " ( " + sqlTextA + sqlWhere + sqlOrderLimit + " ) ttt " + " left join playersimpleinfo s on ttt.UserID = s.id " + " left join virtualshoppingitem v on ttt.VirtualShoppingItemID=v.ID"; mycmd.CommandText = sqlAllText; DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); items = MetaDBAdapter <PlayerBuyVirtualShoppingItemRecord> .GetPlayerBuyVirtualShoppingItemRecordFromDataTable(table); table.Dispose(); adapter.Dispose(); }); return(items); }
/// <summary> /// 没有填充AwardItem属性 /// </summary> /// <param name="UserName"></param> /// <param name="RouletteAwardItemID"></param> /// <param name="ContainsNone"></param> /// <param name="BeginWinTime"></param> /// <param name="EndWinTime"></param> /// <param name="IsGot">-1表示null;0表示false;1表示true</param> /// <param name="IsPay">-1表示null;0表示false;1表示true</param> /// <param name="pageItemCount"></param> /// <param name="pageIndex"></param> /// <returns></returns> public RouletteWinnerRecord[] GetAllPayWinAwardRecords(string UserName, int RouletteAwardItemID, bool ContainsNone, MyDateTime BeginWinTime, MyDateTime EndWinTime, int IsGot, int IsPay, int pageItemCount, int pageIndex, RouletteAwardItem noneAwardItem) { RouletteWinnerRecord[] records = null; MySqlConnection myconn = null; MySqlCommand mycmd = null; try { myconn = MyDBHelper.Instance.CreateConnection(); mycmd = myconn.CreateCommand(); string sqlTextA = "select r.*, m.AwardName, m.RouletteAwardType " + " from roulettewinnerrecord r " + " left join rouletteawarditem m on r.AwardItemID = m.id "; StringBuilder builder = new StringBuilder(); //builder.Append(" r.AwardItemID != @AwardItemID "); //mycmd.Parameters.AddWithValue("@AwardItemID", noneAwardItem.ID); if (!string.IsNullOrEmpty(UserName)) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" r.UserID = ( select id from playersimpleinfo where UserName = @UserName ) "); string encryptUserName = DESEncrypt.EncryptDES(UserName); mycmd.Parameters.AddWithValue("@UserName", encryptUserName); } if (RouletteAwardItemID >= 0) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" r.AwardItemID = @AwardItemID "); mycmd.Parameters.AddWithValue("@AwardItemID", RouletteAwardItemID); } else { //如果外部传入中奖类型,则不判断为NONE的情况 if (!ContainsNone) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" m.RouletteAwardType != @RouletteAwardType "); mycmd.Parameters.AddWithValue("@RouletteAwardType", RouletteAwardType.None); } } if (BeginWinTime != null && !BeginWinTime.IsNull && EndWinTime != null && !EndWinTime.IsNull) { if (builder.Length != 0) { builder.Append(" and "); } DateTime beginWinTime = BeginWinTime.ToDateTime(); DateTime endWinTime = EndWinTime.ToDateTime(); if (beginWinTime >= endWinTime) { return(null); } builder.Append(" r.WinTime >= @beginWinTime and r.WinTime < @endWinTime "); mycmd.Parameters.AddWithValue("@beginWinTime", beginWinTime); mycmd.Parameters.AddWithValue("@endWinTime", endWinTime); } if (IsGot >= 0) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" r.IsGot = @IsGot "); mycmd.Parameters.AddWithValue("@IsGot", IsGot != 0); } if (IsPay >= 0) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" r.IsPay = @IsPay "); mycmd.Parameters.AddWithValue("@IsPay", IsPay != 0); } string sqlWhere = ""; if (builder.Length > 0) { sqlWhere = " where " + builder.ToString(); } string sqlOrderLimit = " order by r.id desc "; if (pageItemCount > 0) { int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount; sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount; } string sqlAllText = "select ttt.*, s.UserName as UserName from " + " ( " + sqlTextA + sqlWhere + sqlOrderLimit + " ) ttt " + " left join playersimpleinfo s on ttt.UserID = s.id "; mycmd.CommandText = sqlAllText; myconn.Open(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); DataTable table = new DataTable(); adapter.Fill(table); records = MetaDBAdapter <RouletteWinnerRecord> .GetRouletteWinnerRecordFromDataTable(table); table.Clear(); table.Dispose(); adapter.Dispose(); return(records); } finally { if (mycmd != null) { mycmd.Dispose(); } if (myconn != null) { myconn.Close(); myconn.Dispose(); } } }
public StoneDelegateBuyOrderInfo[] GetAllFinishedStoneDelegateBuyOrderInfoByPlayer(string userName, MetaData.MyDateTime myBeginCreateTime, MetaData.MyDateTime myEndCreateTime, int pageItemCount, int pageIndex) { MySqlConnection myconn = MyDBHelper.Instance.CreateConnection(); MySqlCommand mycmd = null; try { mycmd = myconn.CreateCommand(); string sqlTextA = "SELECT n.* FROM finishedstonedelegatebuyorderinfo n "; StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(userName)) { builder.Append(" n.UserID = ( select id from playersimpleinfo where UserName = @UserName ) "); mycmd.Parameters.AddWithValue("@UserName", DESEncrypt.EncryptDES(userName)); } if (myBeginCreateTime != null && !myBeginCreateTime.IsNull && myEndCreateTime != null && !myEndCreateTime.IsNull) { if (builder.Length != 0) { builder.Append(" and "); } DateTime beginCreateTime = myBeginCreateTime.ToDateTime(); DateTime endCreateTime = myEndCreateTime.ToDateTime(); if (beginCreateTime >= endCreateTime) { return(null); } builder.Append(" n.DelegateTime >= @beginCreateTime and n.DelegateTime < @endCreateTime "); mycmd.Parameters.AddWithValue("@beginCreateTime", beginCreateTime); mycmd.Parameters.AddWithValue("@endCreateTime", endCreateTime); } string sqlWhere = ""; if (builder.Length > 0) { sqlWhere = " where " + builder.ToString(); } string sqlOrderLimit = " order by n.id desc "; if (pageItemCount > 0) { int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount; sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount; } string sqlAllText = "select ttt.*, s.UserName as UserName from " + " ( " + sqlTextA + sqlWhere + sqlOrderLimit + " ) ttt " + " left join playersimpleinfo s on ttt.UserID = s.id "; mycmd.CommandText = sqlAllText; myconn.Open(); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); var lists = MetaDBAdapter <StoneDelegateBuyOrderInfo> .GetStoneDelegateBuyOrderInfoFromDataTable(table, true); table.Clear(); table.Dispose(); adapter.Dispose(); return(lists); } finally { if (mycmd != null) { mycmd.Dispose(); } MyDBHelper.Instance.DisposeConnection(myconn); } }
public GoldCoinRechargeRecord GetGoldCoinRechargeRecord(string playerUserName, string orderNumber) { GoldCoinRechargeRecord[] records = null; MySqlConnection myconn = null; try { DataTable dt = new DataTable(); myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); MySqlCommand mycmd = myconn.CreateCommand(); string sqlTextA = "select a.* from goldcoinrechargerecord a "; StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(playerUserName)) { builder.Append(" a.UserID = ( select id from playersimpleinfo where UserName = @UserName ) "); string encryptUserName = DESEncrypt.EncryptDES(playerUserName); mycmd.Parameters.AddWithValue("@UserName", encryptUserName); } if (!string.IsNullOrEmpty(orderNumber)) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" OrderNumber = @OrderNumber "); mycmd.Parameters.AddWithValue("@OrderNumber", orderNumber); } string whereText = builder.Length > 0 ? " where " : ""; string sqlAllText = "select ttt.*, s.UserName as UserName from " + " ( " + sqlTextA + whereText + builder.ToString() + " ) ttt " + " left join playersimpleinfo s on ttt.UserID = s.id "; mycmd.CommandText = sqlAllText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(dt); if (dt != null) { records = MetaDBAdapter <GoldCoinRechargeRecord> .GetGoldCoinRechargeRecordFromDataTable(dt); } dt.Clear(); dt.Dispose(); adapter.Dispose(); mycmd.Dispose(); if (records.Length > 0) { return(records[0]); } return(null); } finally { MyDBHelper.Instance.DisposeConnection(myconn); } }
public GoldCoinRechargeRecord[] GetFinishedGoldCoinRechargeRecordList(string playerUserName, string orderNumber, MyDateTime beginCreateTime, MyDateTime endCreateTime, int pageItemCount, int pageIndex) { GoldCoinRechargeRecord[] records = null; MySqlConnection myconn = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); MySqlCommand mycmd = myconn.CreateCommand(); string sqlTextA = "select a.* from goldcoinrechargerecord a "; StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(playerUserName)) { builder.Append(" a.UserID = ( select id from playersimpleinfo where UserName = @UserName ) "); string encryptUserName = DESEncrypt.EncryptDES(playerUserName); mycmd.Parameters.AddWithValue("@UserName", encryptUserName); } if (!string.IsNullOrEmpty(orderNumber)) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" .OrderNumber = @OrderNumber "); mycmd.Parameters.AddWithValue("@OrderNumber", orderNumber); } if (beginCreateTime != null && !beginCreateTime.IsNull && endCreateTime != null && !endCreateTime.IsNull) { if (builder.Length > 0) { builder.Append(" and "); } DateTime beginTime = beginCreateTime.ToDateTime(); DateTime endTime = endCreateTime.ToDateTime(); if (beginTime >= endTime) { return(null); } builder.Append(" a.CreateTime >= @beginCreateTime and a.CreateTime < @endCreateTime "); mycmd.Parameters.AddWithValue("@beginCreateTime", beginTime); mycmd.Parameters.AddWithValue("@endCreateTime", endTime); } string sqlWhere = ""; if (builder.Length > 0) { sqlWhere = " where " + builder.ToString(); } string sqlOrderLimit = " order by a.id desc "; if (pageItemCount > 0) { int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount; sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount; } string sqlAllText = "select ttt.*, s.UserName as UserName from " + " ( " + sqlTextA + sqlWhere + sqlOrderLimit + " ) ttt " + " left join playersimpleinfo s on ttt.UserID = s.id "; mycmd.CommandText = sqlAllText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); DataTable table = new DataTable(); adapter.Fill(table); if (table != null) { records = MetaDBAdapter <GoldCoinRechargeRecord> .GetGoldCoinRechargeRecordFromDataTable(table); } table.Clear(); table.Dispose(); adapter.Dispose(); mycmd.Dispose(); return(records); } finally { MyDBHelper.Instance.DisposeConnection(myconn); } }
public RaiderPlayerBetInfo[] GetPlayerBetInfoByRoundID(int roundID, string userName, int pageItemCount, int pageIndex) { MySqlConnection myconn = null; MySqlCommand mycmd = null; try { myconn = MyDBHelper.Instance.CreateConnection(); mycmd = myconn.CreateCommand(); string sqlTextA = "SELECT * FROM raiderplayerbetinfo "; string sqlWhere = ""; if (roundID > 0) { sqlWhere = " where RaiderRoundID = @RaiderRoundID "; mycmd.Parameters.AddWithValue("@RaiderRoundID", roundID); } if (!string.IsNullOrEmpty(userName)) { if (sqlWhere.Length == 0) { sqlWhere = " where "; } else { sqlWhere += " and "; } sqlWhere += " UserID = ( select id from playersimpleinfo where UserName = @UserName ) "; mycmd.Parameters.AddWithValue("@UserName", DESEncrypt.EncryptDES(userName)); } string sqlOrderLimit = " order by id desc "; if (pageItemCount > 0) { int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount; sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount; } string sqlAllText = "select ttt.*, s.UserName as UserName from " + " ( " + sqlTextA + sqlWhere + sqlOrderLimit + " ) ttt " + " left join playersimpleinfo s on ttt.UserID = s.id "; mycmd.CommandText = sqlAllText; myconn.Open(); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); var lists = MetaDBAdapter <RaiderPlayerBetInfo> .GetPlayerBetInfoFromDataTable(table); table.Clear(); table.Dispose(); adapter.Dispose(); return(lists); } finally { if (mycmd != null) { mycmd.Dispose(); } if (myconn != null) { myconn.Close(); myconn.Dispose(); } } }
public bool UpdateRaiderRoundMetaDataInfo(RaiderRoundMetaDataInfo roundInfo, CustomerMySqlTransaction myTrans) { MySqlCommand mycmd = null; try { string sqlText = "UPDATE raiderroundmetadatainfo " + " set `State` = @State, `StartTime` = @StartTime, `AwardPoolSumStones` = @AwardPoolSumStones, `JoinedPlayerCount`=@JoinedPlayerCount, `WinnerUserName`=@WinnerUserName,`WinStones`=@WinStones,`EndTime`=@EndTime where `id` = @id ; "; mycmd = myTrans.CreateCommand(); mycmd.CommandText = sqlText; mycmd.Parameters.AddWithValue("@State", (int)roundInfo.State); mycmd.Parameters.AddWithValue("@StartTime", roundInfo.StartTime == null ? DBNull.Value : (object)roundInfo.StartTime.ToDateTime()); mycmd.Parameters.AddWithValue("@AwardPoolSumStones", roundInfo.AwardPoolSumStones); mycmd.Parameters.AddWithValue("@JoinedPlayerCount", roundInfo.JoinedPlayerCount); mycmd.Parameters.AddWithValue("@WinnerUserName", string.IsNullOrEmpty(roundInfo.WinnerUserName) ? DBNull.Value : (object)DESEncrypt.EncryptDES(roundInfo.WinnerUserName)); mycmd.Parameters.AddWithValue("@WinStones", roundInfo.WinStones); mycmd.Parameters.AddWithValue("@EndTime", roundInfo.EndTime == null ? DBNull.Value : (object)roundInfo.EndTime.ToDateTime()); mycmd.Parameters.AddWithValue("@id", roundInfo.ID); mycmd.ExecuteNonQuery(); return(true); } finally { if (mycmd != null) { mycmd.Dispose(); } } }
public bool AddDeletedPlayer(PlayerInfo player, DateTime time, CustomerMySqlTransaction trans) { MySqlCommand mycmd = null; try { mycmd = trans.CreateCommand(); string cmdTextA; cmdTextA = "insert into deletedplayerinfo " + "(`UserLoginName`,`UserName`, `Password`, `GroupType`, `IsAgentReferred`, `AgentReferredLevel`, `AgentUserID`, `Alipay`, `AlipayRealName`, `IDCardNo`, `Email`, `QQ`, `RegisterIP`, `InvitationCode`, `RegisterTime`, `LastLoginTime`, `LastLogOutTime`, `ReferrerUserName`, `LastLoginIP`, `LastLoginMac`, " + " `Exp`, `CreditValue`, `RMB`, `FreezingRMB`, `GoldCoin`, `MinesCount`, `StonesReserves`, `TotalProducedStonesCount`, `MinersCount`, `StockOfStones`, `TempOutputStonesStartTime`, `TempOutputStones`, " + " `FreezingStones`, `StockOfDiamonds`, `FreezingDiamonds`, `StoneSellQuan`, `FirstRechargeGoldCoinAward`," + #if !V1 "`ShoppingCreditsEnabled`,`ShoppingCreditsFreezed`,`UserRemoteServerValidStopTime`,`IsLongTermRemoteServiceUser`,`UserRemoteServiceValidTimes`,`MakeAVowToGodTime_DayofYear`,`MakeAVowToGodTimesLastDay` " + #endif " `DeleteTime` ) values " + " (@UserLoginName,@UserName, @Password, @GroupType, @IsAgentReferred, @AgentReferredLevel, @AgentUserID, @Alipay, @AlipayRealName, @IDCardNo, @Email, @QQ, @RegisterIP, @InvitationCode, @RegisterTime, @LastLoginTime, @LastLogOutTime, @ReferrerUserName, @LastLoginIP, @LastLoginMac, " + " @Exp, @CreditValue, @RMB, @FreezingRMB, @GoldCoin, @MinesCount, @StonesReserves, @TotalProducedStonesCount, @MinersCount, @StockOfStones, @TempOutputStonesStartTime, @TempOutputStones, " + " @FreezingStones, @StockOfDiamonds,@FreezingDiamonds, @StoneSellQuan, @FirstRechargeGoldCoinAward," + #if !V1 "@ShoppingCreditsEnabled,@ShoppingCreditsFreezed,@UserRemoteServerValidStopTime,@IsLongTermRemoteServiceUser,@UserRemoteServiceValidTimes,@MakeAVowToGodTime_DayofYear,@MakeAVowToGodTimesLastDay " + #endif " @DeleteTime ); "; mycmd.Parameters.AddWithValue("@UserLoginName", DESEncrypt.EncryptDES(player.SimpleInfo.UserLoginName)); mycmd.Parameters.AddWithValue("@UserName", DESEncrypt.EncryptDES(player.SimpleInfo.UserName)); mycmd.Parameters.AddWithValue("@Password", DESEncrypt.EncryptDES(player.SimpleInfo.Password)); mycmd.Parameters.AddWithValue("@GroupType", (int)player.SimpleInfo.GroupType); mycmd.Parameters.AddWithValue("@IsAgentReferred", player.SimpleInfo.IsAgentReferred); mycmd.Parameters.AddWithValue("@AgentReferredLevel", player.SimpleInfo.AgentReferredLevel); mycmd.Parameters.AddWithValue("@AgentUserID", player.SimpleInfo.AgentUserID); mycmd.Parameters.AddWithValue("@Alipay", string.IsNullOrEmpty(player.SimpleInfo.Alipay) ? null : DESEncrypt.EncryptDES(player.SimpleInfo.Alipay)); mycmd.Parameters.AddWithValue("@AlipayRealName", string.IsNullOrEmpty(player.SimpleInfo.AlipayRealName) ? null : DESEncrypt.EncryptDES(player.SimpleInfo.AlipayRealName)); mycmd.Parameters.AddWithValue("@IDCardNo", string.IsNullOrEmpty(player.SimpleInfo.IDCardNo) ? DBNull.Value : (object)player.SimpleInfo.IDCardNo); mycmd.Parameters.AddWithValue("@Email", string.IsNullOrEmpty(player.SimpleInfo.AlipayRealName) ? null : DESEncrypt.EncryptDES(player.SimpleInfo.Email)); mycmd.Parameters.AddWithValue("@QQ", string.IsNullOrEmpty(player.SimpleInfo.QQ) ? null : DESEncrypt.EncryptDES(player.SimpleInfo.QQ)); mycmd.Parameters.AddWithValue("@RegisterIP", player.SimpleInfo.RegisterIP); mycmd.Parameters.AddWithValue("@InvitationCode", DESEncrypt.EncryptDES(player.SimpleInfo.InvitationCode)); mycmd.Parameters.AddWithValue("@RegisterTime", player.SimpleInfo.RegisterTime); mycmd.Parameters.AddWithValue("@LastLoginTime", player.SimpleInfo.LastLoginTime == null ? DBNull.Value : (object)player.SimpleInfo.LastLoginTime); mycmd.Parameters.AddWithValue("@LastLogOutTime", player.SimpleInfo.LastLogOutTime == null ? DBNull.Value : (object)player.SimpleInfo.LastLogOutTime); mycmd.Parameters.AddWithValue("@ReferrerUserName", DESEncrypt.EncryptDES(player.SimpleInfo.ReferrerUserName)); mycmd.Parameters.AddWithValue("@LastLoginIP", player.SimpleInfo.LastLoginIP == null ? DBNull.Value : (object)player.SimpleInfo.LastLoginIP); mycmd.Parameters.AddWithValue("@LastLoginMac", player.SimpleInfo.LastLoginMac == null ? DBNull.Value : (object)player.SimpleInfo.LastLoginMac); mycmd.Parameters.AddWithValue("@Exp", player.FortuneInfo.Exp); mycmd.Parameters.AddWithValue("@CreditValue", player.FortuneInfo.CreditValue); mycmd.Parameters.AddWithValue("@RMB", player.FortuneInfo.RMB); mycmd.Parameters.AddWithValue("@FreezingRMB", player.FortuneInfo.FreezingRMB); mycmd.Parameters.AddWithValue("@GoldCoin", player.FortuneInfo.GoldCoin); mycmd.Parameters.AddWithValue("@MinesCount", player.FortuneInfo.MinesCount); mycmd.Parameters.AddWithValue("@StonesReserves", player.FortuneInfo.StonesReserves); mycmd.Parameters.AddWithValue("@TotalProducedStonesCount", player.FortuneInfo.TotalProducedStonesCount); mycmd.Parameters.AddWithValue("@MinersCount", player.FortuneInfo.MinersCount); mycmd.Parameters.AddWithValue("@StockOfStones", player.FortuneInfo.StockOfStones); mycmd.Parameters.AddWithValue("@TempOutputStonesStartTime", player.FortuneInfo.TempOutputStonesStartTime); mycmd.Parameters.AddWithValue("@TempOutputStones", player.FortuneInfo.TempOutputStones); mycmd.Parameters.AddWithValue("@FreezingStones", player.FortuneInfo.FreezingStones); mycmd.Parameters.AddWithValue("@StockOfDiamonds", player.FortuneInfo.StockOfDiamonds); mycmd.Parameters.AddWithValue("@FreezingDiamonds", player.FortuneInfo.FreezingDiamonds); mycmd.Parameters.AddWithValue("@StoneSellQuan", player.FortuneInfo.StoneSellQuan); mycmd.Parameters.AddWithValue("@FirstRechargeGoldCoinAward", player.FortuneInfo.FirstRechargeGoldCoinAward); #if !V1 mycmd.Parameters.AddWithValue("@ShoppingCreditsEnabled", player.FortuneInfo.ShoppingCreditsEnabled); mycmd.Parameters.AddWithValue("@ShoppingCreditsFreezed", player.FortuneInfo.ShoppingCreditsFreezed); if (player.FortuneInfo.UserRemoteServerValidStopTime == null) { mycmd.Parameters.AddWithValue("@UserRemoteServerValidStopTime", DBNull.Value); } else { mycmd.Parameters.AddWithValue("@UserRemoteServerValidStopTime", player.FortuneInfo.UserRemoteServerValidStopTime); } mycmd.Parameters.AddWithValue("@IsLongTermRemoteServiceUser", player.FortuneInfo.IsLongTermRemoteServiceUser); mycmd.Parameters.AddWithValue("@UserRemoteServiceValidTimes", player.FortuneInfo.UserRemoteServiceValidTimes); mycmd.Parameters.AddWithValue("@MakeAVowToGodTime_DayofYear", player.FortuneInfo.MakeAVowToGodTime_DayofYear); mycmd.Parameters.AddWithValue("@MakeAVowToGodTimesLastDay", player.FortuneInfo.MakeAVowToGodTimesLastDay); #endif mycmd.Parameters.AddWithValue("@DeleteTime", time); mycmd.CommandText = cmdTextA; mycmd.ExecuteNonQuery(); return(true); } finally { mycmd.Dispose(); } }
/// <summary> /// /// </summary> /// <param name="userName">""表示所有玩家</param> /// <returns></returns> public LockSellStonesOrder[] GetLockSellStonesOrderList(string sellerUserName, string orderNumber, string buyUserName, int orderState) { LockSellStonesOrder[] orders = null; MySqlConnection myconn = MyDBHelper.Instance.CreateConnection(); try { DataTable table = new DataTable(); myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); MySqlCommand mycmd = myconn.CreateCommand(); string sqlTextA = "select l.*, s.*, f.CreditValue as SellerCreditValue, f.Exp as SellerExpValue " + "from locksellstonesorder l " + "left join sellstonesorder s on s.OrderNumber = l.OrderNumber " + "left join playerfortuneinfo f on f.userId = (select u.id from playersimpleinfo u where u.UserName = s.SellerUserName)"; StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(sellerUserName)) { builder.Append(" s.SellerUserName = @SellerUserName "); string encryptSellerUserName = DESEncrypt.EncryptDES(sellerUserName); mycmd.Parameters.AddWithValue("@SellerUserName", encryptSellerUserName); } if (!string.IsNullOrEmpty(orderNumber)) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" s.OrderNumber = @OrderNumber "); mycmd.Parameters.AddWithValue("@OrderNumber", orderNumber); } if (!string.IsNullOrEmpty(buyUserName)) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" l.LockedByUserName = @BuyerUserName "); string encryptUserName = DESEncrypt.EncryptDES(buyUserName); mycmd.Parameters.AddWithValue("@BuyerUserName", encryptUserName); } if (orderState > 0) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" s.OrderState = @OrderState "); mycmd.Parameters.AddWithValue("@OrderState", orderState); } string sqlWhere = ""; if (builder.Length > 0) { sqlWhere = " where " + builder.ToString(); } string sqlAllText = sqlTextA + sqlWhere; mycmd.CommandText = sqlAllText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); if (table != null) { orders = MetaDBAdapter <LockSellStonesOrder> .GetLockStonesOrderListFromDataTable(table); } table.Clear(); table.Dispose(); adapter.Dispose(); mycmd.Dispose(); return(orders); } finally { MyDBHelper.Instance.DisposeConnection(myconn); } }
/// <summary> /// /// </summary> /// <param name="orderState">null表示全部状态, 可以多种状态组合查询</param> /// <param name="userName">""表示全部玩家</param> /// <returns></returns> public SellStonesOrder[] GetSellOrderList(string sellerUserName, string orderNumber, int orderState, MyDateTime myBeginCreateTime, MyDateTime myEndCreateTime, int pageItemCount, int pageIndex) { SellStonesOrder[] orders = null; MySqlConnection myconn = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); MySqlCommand mycmd = myconn.CreateCommand(); string sqlTextA = "select s.*, f.CreditValue as SellerCreditValue, f.Exp as SellerExpValue from sellstonesorder s " + "left join playerfortuneinfo f on f.userId = (select u.id from playersimpleinfo u where u.UserName = s.SellerUserName)"; StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(sellerUserName)) { builder.Append(" s.SellerUserName = @SellerUserName "); string encryptSellerUserName = DESEncrypt.EncryptDES(sellerUserName); mycmd.Parameters.AddWithValue("@SellerUserName", encryptSellerUserName); } if (!string.IsNullOrEmpty(orderNumber)) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" s.OrderNumber = @OrderNumber "); mycmd.Parameters.AddWithValue("@OrderNumber", orderNumber); } if (myBeginCreateTime != null && !myBeginCreateTime.IsNull && myEndCreateTime != null && !myEndCreateTime.IsNull) { DateTime beginTime = myBeginCreateTime.ToDateTime(); DateTime endTime = myEndCreateTime.ToDateTime(); if (beginTime >= endTime) { return(null); } if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" s.SellTime >= @beginTime and s.SellTime < @endTime "); mycmd.Parameters.AddWithValue("@beginTime", beginTime); mycmd.Parameters.AddWithValue("@endTime", endTime); } if (orderState > 0) { if (builder.Length > 0) { builder.Append(" and "); } builder.Append(" s.OrderState = @OrderState "); mycmd.Parameters.AddWithValue("@OrderState", orderState); } string sqlWhere = ""; if (builder.Length > 0) { sqlWhere = " where " + builder.ToString(); } string sqlOrderLimit = " order by s.SellTime desc "; if (pageItemCount > 0) { int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount; sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount; } string sqlAllText = sqlTextA + sqlWhere + sqlOrderLimit; mycmd.CommandText = sqlAllText; DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); if (table != null) { orders = MetaDBAdapter <SellStonesOrder> .GetSellStonesOrderFromDataTable(table); } table.Clear(); table.Dispose(); adapter.Dispose(); mycmd.Dispose(); return(orders); } finally { MyDBHelper.Instance.DisposeConnection(myconn); } }