public void UpdataLoginReward(LoginReward reward) { MySqlConnection connection = DAO.GetConnection(); try { connection.Open(); string cmdText = "UPDATE login_reward SET reward_id=?reward_id, reward_index = ?reward_index, lastday_reward = ?lastday_reward, day_reward = ?day_reward, birthday_reward = ?birthday_reward WHERE account_id = ?account_id"; MySqlCommand mySqlCommand = new MySqlCommand(cmdText, connection); mySqlCommand.Parameters.AddWithValue("?reward_id", reward.RewardID); mySqlCommand.Parameters.AddWithValue("?reward_index", reward.RewardIndex); mySqlCommand.Parameters.AddWithValue("?lastday_reward", reward.LastRewardTime); mySqlCommand.Parameters.AddWithValue("?day_reward", reward.NextRewardTime); mySqlCommand.Parameters.AddWithValue("?birthday_reward", reward.NextBirthDayTime); mySqlCommand.Parameters.AddWithValue("?account_id", reward.AccountId); mySqlCommand.ExecuteNonQuery(); } catch (Exception ex) { ProjectData.SetProjectError(ex); Exception ex2 = ex; log.Error((object)ex2); ProjectData.ClearProjectError(); } finally { connection.Close(); } }
public SM_GS_ACCOUNT_AUTH_RESPONSE(int accountId, bool ok, Account acc) { _accountId = accountId; _ok = ok; _acc = acc; if (!Information.IsNothing(acc)) { _time = acc.AccountTime; _reward = acc.LoginReward; _luna = acc.LunaInfo; } }
protected override void runImpl() { LoginReward loginReward = DAOManager.LoginRewardDAO.LoadLoginReward(accountId); AccountTime accountTime = DAOManager.AccountTimeDAO.LoadAccountTime(accountId); loginReward.RewardID = rewardId; loginReward.RewardIndex = rewardIndex; if (updataDay) { loginReward.LastRewardTime = DateAndTime.Now; loginReward.NextRewardTime = DateAndTime.DateAdd(DateInterval.Day, 1.0, new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, 8, 0, 0)); log.InfoFormat("帐号ID为 {0} 的用户领取了切克隆每日奖励!", (object)accountId); } if (updataBirth) { loginReward.NextBirthDayTime = DateAndTime.DateAdd(DateInterval.Year, 1.0, new DateTime(DateAndTime.Now.Year, accountTime.CreateTime.Month, accountTime.CreateTime.Day)); log.InfoFormat("帐号ID为 {0} 的用户领取了切克隆生日奖励!", (object)accountId); } DAOManager.LoginRewardDAO.UpdataLoginReward(loginReward); }
public LoginReward LoadLoginReward(int accountId) { MySqlConnection connection = DAO.GetConnection(); LoginReward result = null; try { connection.Open(); string cmdText = "SELECT * FROM login_reward WHERE account_id = ?account_id"; MySqlCommand mySqlCommand = new MySqlCommand(cmdText, connection); mySqlCommand.Parameters.AddWithValue("?account_id", accountId); MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader(); if (mySqlDataReader.Read()) { int @int = mySqlDataReader.GetInt32("reward_id"); int int2 = mySqlDataReader.GetInt32("reward_index"); DateTime dateTime = mySqlDataReader.GetDateTime("lastday_reward"); DateTime dateTime2 = mySqlDataReader.GetDateTime("day_reward"); DateTime dateTime3 = mySqlDataReader.GetDateTime("birthday_reward"); result = new LoginReward(accountId, @int, int2, dateTime, dateTime2, dateTime3); return(result); } return(result); } catch (Exception ex) { ProjectData.SetProjectError(ex); Exception ex2 = ex; log.Error((object)ex2); ProjectData.ClearProjectError(); return(result); } finally { connection.Close(); } }