public static List <OnlineInfoEntity> GetOnlineList(int offLineMinutes, int batchSize) { List <OnlineInfoEntity> list = new List <OnlineInfoEntity>(); using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(con, CommandType.StoredProcedure, "C_Online_GetOnlineList"); cmd.AddMyParameter("@OffLineMinutes", SqlDbType.Int, offLineMinutes); cmd.AddMyParameter("@BatchSize", SqlDbType.Int, batchSize); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { OnlineInfoEntity item = new OnlineInfoEntity(); item.ManagerId = (Guid)dr["ManagerId"]; item.LoginTime = (DateTime)dr["LoginTime"]; item.GuildInTime = (DateTime)dr["GuildInTime"]; item.ActiveTime = (DateTime)dr["ActiveTime"]; list.Add(item); } } cmd.Parameters.Clear(); return(list); } }
public static void SaveDailycupMatchBatch(DailycupMatchDataSet.DailyCup_MatchDataTable matchData) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(con, CommandType.StoredProcedure, "P_DailycupMatch_Insert2"); cmd.AddMyParameter("@DailyCupId", SqlDbType.Int, matchData.DailyCupIdColumn.ColumnName); cmd.AddMyParameter("@HomeManager", SqlDbType.UniqueIdentifier, matchData.HomeManagerColumn.ColumnName); cmd.AddMyParameter("@AwayManager", SqlDbType.UniqueIdentifier, matchData.AwayManagerColumn.ColumnName); cmd.AddMyParameter("@HomeName", SqlDbType.VarChar, matchData.HomeNameColumn.ColumnName); cmd.AddMyParameter("@AwayName", SqlDbType.VarChar, matchData.AwayNameColumn.ColumnName); cmd.AddMyParameter("@HomeLogo", SqlDbType.VarChar, matchData.HomeLogoColumn.ColumnName); cmd.AddMyParameter("@AwayLogo", SqlDbType.VarChar, matchData.AwayLogoColumn.ColumnName); cmd.AddMyParameter("@HomeLevel", SqlDbType.Int, matchData.HomeLevelColumn.ColumnName); cmd.AddMyParameter("@AwayLevel", SqlDbType.Int, matchData.AwayLevelColumn.ColumnName); cmd.AddMyParameter("@HomePower", SqlDbType.Int, matchData.HomePowerColumn.ColumnName); cmd.AddMyParameter("@AwayPower", SqlDbType.Int, matchData.AwayPowerColumn.ColumnName); cmd.AddMyParameter("@HomeWorldScore", SqlDbType.Int, matchData.HomeWorldScoreColumn.ColumnName); cmd.AddMyParameter("@AwayWorldScore", SqlDbType.Int, matchData.AwayWorldScoreColumn.ColumnName); cmd.AddMyParameter("@HomeScore", SqlDbType.Int, matchData.HomeScoreColumn.ColumnName); cmd.AddMyParameter("@AwayScore", SqlDbType.Int, matchData.AwayScoreColumn.ColumnName); cmd.AddMyParameter("@Round", SqlDbType.Int, matchData.RoundColumn.ColumnName); cmd.AddMyParameter("@ChipInCount", SqlDbType.Int, matchData.ChipInCountColumn.ColumnName); cmd.AddMyParameter("@Status", SqlDbType.Int, matchData.StatusColumn.ColumnName); cmd.AddMyParameter("@RowTime", SqlDbType.DateTime, matchData.RowTimeColumn.ColumnName); cmd.AddMyParameter("@Idx", SqlDbType.UniqueIdentifier, matchData.IdxColumn.ColumnName); SqlDataAdapter adap = SqlBatchHelper.GetMyBatchAdapter(null, cmd, cmd, cmd); con.Open(); adap.Update(matchData); cmd.Parameters.Clear(); } }
public static bool ResetActive(int batchSize) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(con, CommandType.StoredProcedure, "C_Online_ResetActive"); cmd.AddMyParameter("@BatchSize", SqlDbType.Int, batchSize); con.Open(); cmd.ExecuteNonQuery(); return(true); } }
//public static void SaveManagerPrize(List<LadderManagerhistoryEntity> list,MailinfoDataSet.Mail_InfoDataTable mailInfoDataTable,string zoneId="") //{ // var connectionString = ConnectionFactory.Instance.GetConnectionString(zoneId, EnumDbType.Main); // var ladderTable = BuildManagerPrizeTable(list); // using (SqlConnection conn = new SqlConnection(connectionString)) // { // conn.Open(); // SqlTransaction trans = conn.BeginTransaction(); // try // { // SaveManagerPrize(ladderTable, trans); // MailSqlHelper.SaveMailBulk(mailInfoDataTable, trans); // trans.Commit(); // } // catch (Exception ex) // { // trans.Rollback(); // throw ex; // } // finally // { // conn.Close(); // } // } //} //public static LadderManagerhistoryDataSet.Ladder_ManagerHistoryDataTable BuildManagerPrizeTable(List<LadderManagerhistoryEntity> list) //{ // LadderManagerhistoryDataSet.Ladder_ManagerHistoryDataTable dataTable = new LadderManagerhistoryDataSet.Ladder_ManagerHistoryDataTable(); // foreach (var entity in list) // { // var row = dataTable.NewRow(); // row["Idx"] = entity.Idx; // row["Season"] = entity.Season; // row["ManagerId"] = entity.ManagerId; // row["Rank"] = entity.Rank; // row["Score"] = entity.Score; // row["PrizeItems"] = entity.PrizeItems; // row["Status"] = entity.Status; // row["RowTime"] = entity.RowTime; // dataTable.Rows.Add(row); // } // return dataTable; //} public static void SaveManagerPrize(LadderManagerhistoryDataSet.Ladder_ManagerHistoryDataTable dataTable, SqlTransaction trans) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(trans.Connection, CommandType.StoredProcedure, "C_Ladder_SavePrize"); cmd.AddMyParameter("@Idx", SqlDbType.Int, dataTable.IdxColumn.ColumnName); cmd.AddMyParameter("@PrizeItems", SqlDbType.VarChar, dataTable.PrizeItemsColumn.ColumnName); SqlDataAdapter adap = SqlBatchHelper.GetMyBatchAdapter(null, cmd, cmd, cmd); cmd.Transaction = trans; adap.Update(dataTable); cmd.Parameters.Clear(); }
public static void SaveCompetitorsFight(DailyCupCompetitorsDataSet.DailyCup_CompetitorsDataTable competitorsData) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(con, CommandType.StoredProcedure, "C_DailyCupCompetitors_SaveFight"); cmd.AddMyParameter("@Idx", SqlDbType.Int, competitorsData.IdxColumn.ColumnName); cmd.AddMyParameter("@MaxRound", SqlDbType.Int, competitorsData.MaxRoundColumn.ColumnName); cmd.AddMyParameter("@WinCount", SqlDbType.Int, competitorsData.WinCountColumn.ColumnName); cmd.AddMyParameter("@Rank", SqlDbType.Int, competitorsData.RankColumn.ColumnName); SqlDataAdapter adap = SqlBatchHelper.GetMyBatchAdapter(null, cmd, cmd, cmd); con.Open(); adap.Update(competitorsData); cmd.Parameters.Clear(); } }
public static void SaveCompetitorsPrize(DailyCupCompetitorsDataSet.DailyCup_CompetitorsDataTable competitorsData) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(con, CommandType.StoredProcedure, "C_DailyCupCompetitors_SavePrize"); cmd.AddMyParameter("@Idx", SqlDbType.Int, competitorsData.IdxColumn.ColumnName); cmd.AddMyParameter("@ManagerId", SqlDbType.UniqueIdentifier, competitorsData.ManagerIdColumn.ColumnName); cmd.AddMyParameter("@PrizeScore", SqlDbType.Int, competitorsData.PrizeScoreColumn.ColumnName); cmd.AddMyParameter("@PrizeSophisticate", SqlDbType.Int, competitorsData.PrizeSophisticateColumn.ColumnName); cmd.AddMyParameter("@PrizeCoin", SqlDbType.Int, competitorsData.PrizeCoinColumn.ColumnName); cmd.AddMyParameter("@PrizeItems", SqlDbType.VarChar, competitorsData.PrizeItemsColumn.ColumnName); SqlDataAdapter adap = SqlBatchHelper.GetMyBatchAdapter(null, cmd, cmd, cmd); con.Open(); adap.Update(competitorsData); cmd.Parameters.Clear(); } }
public static bool UpdateActive(OnlineinfoDataSet.Online_InfoDataTable inData) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = SqlBatchHelper.GetMyCommand(con, CommandType.StoredProcedure, "C_Online_UpdateActive"); cmd.AddMyParameter("@ManagerId", SqlDbType.UniqueIdentifier, inData.ManagerIdColumn.ColumnName); cmd.AddMyParameter("@ActiveFlag", SqlDbType.Bit, inData.ActiveFlagColumn.ColumnName); cmd.AddMyParameter("@ResetFlag", SqlDbType.Bit, inData.ResetFlagColumn.ColumnName); cmd.AddMyParameter("@LoginTime", SqlDbType.DateTime, inData.LoginTimeColumn.ColumnName); cmd.AddMyParameter("@GuildInTime", SqlDbType.DateTime, inData.GuildInTimeColumn.ColumnName); cmd.AddMyParameter("@ActiveTime", SqlDbType.DateTime, inData.ActiveTimeColumn.ColumnName); cmd.AddMyParameter("@CntOnlineMinutes", SqlDbType.Int, inData.CntOnlineMinutesColumn.ColumnName); cmd.AddMyParameter("@CurOnlineMinutes", SqlDbType.Int, inData.CurOnlineMinutesColumn.ColumnName); SqlDataAdapter adap = SqlBatchHelper.GetMyBatchAdapter(null, cmd, cmd, cmd); con.Open(); adap.Update(inData); cmd.Parameters.Clear(); return(true); } }