예제 #1
0
        public KuaFuWorldRoleData QueryKuaFuWorldRoleData(int roleID, int ptid)
        {
            KuaFuWorldRoleData data = null;
            MySqlDataReader    sdr  = null;

            try
            {
                string strSql = string.Format("SELECT ptid,rid,temprid,userid,zoneid,channel,roledata FROM `t_pt_roles` where ptid={0} and rid={1}", ptid, roleID);
                sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                if (sdr.Read())
                {
                    data             = new KuaFuWorldRoleData();
                    data.PTID        = Convert.ToInt32(sdr["ptid"].ToString());
                    data.LocalRoleID = Convert.ToInt32(sdr["rid"].ToString());
                    data.TempRoleID  = Convert.ToInt32(sdr["temprid"].ToString());
                    data.UserID      = sdr["userid"].ToString();
                    data.ZoneID      = Convert.ToInt32(sdr["zoneid"].ToString());
                    data.Channel     = sdr["channel"].ToString();
                    data.RoleData    = (sdr["roledata"] as byte[]);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            finally
            {
                if (null != sdr)
                {
                    sdr.Close();
                }
            }
            return(data);
        }
예제 #2
0
        /// <summary>
        /// 加载帮会数据
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool LoadBangHuiDataExList(List <LangHunLingYuBangHuiDataEx> list)
        {
            MySqlDataReader sdr = null;
            string          strSql;

            try
            {
                strSql = string.Format("SELECT * FROM `t_lhly_banghui`;");
                sdr    = DbHelperMySQL.ExecuteReader(strSql);
                for (int index = 1; sdr.Read(); index++)
                {
                    LangHunLingYuBangHuiDataEx data = new LangHunLingYuBangHuiDataEx();
                    data.Bhid   = Convert.ToInt32(sdr["bhid"]);
                    data.ZoneId = Convert.ToInt32(sdr["zoneid"]);
                    data.BhName = sdr["bhname"].ToString();
                    //data.Level = Convert.ToInt32(sdr["level"].ToString());
                    list.Add(data);
                }

                return(true);
            }
            catch (System.Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            finally
            {
                if (null != sdr)
                {
                    sdr.Close();
                }
            }

            return(false);
        }
예제 #3
0
        public static void SelectBoCaiShop(string Periods, out List <KFBoCaiShopDB> dList)
        {
            dList = null;
            MySqlDataReader sdr = null;

            try
            {
                string sql = string.Format("SELECT `ID`,`BuyNum`,`WuPinID` FROM t_bocai_shop WHERE `Periods`={0}", Periods);
                sdr   = DbHelperMySQL.ExecuteReader(sql, false);
                dList = new List <KFBoCaiShopDB>();
                while (sdr != null && sdr.Read())
                {
                    KFBoCaiShopDB data = new KFBoCaiShopDB();
                    data.ID      = Convert.ToInt32(sdr["ID"]);
                    data.BuyNum  = Convert.ToInt32(sdr["BuyNum"]);
                    data.WuPinID = sdr["WuPinID"].ToString();
                    data.Periods = Convert.ToInt32(Periods);
                    dList.Add(data);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.Message);
            }
            finally
            {
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
        }
예제 #4
0
        public static void SelectOpenLottery(int BocaiType, string cmd, out List <OpenLottery> dList)
        {
            dList = null;
            MySqlDataReader sdr = null;

            try
            {
                string sql = string.Format("SELECT `SurplusBalance`,`XiaoHaoDaiBi`,`strWinNum`,`WinInfo`,`AllBalance`,`DataPeriods` FROM t_bocai_open_lottery WHERE `BocaiType`={0}{1}", BocaiType, cmd);
                sdr   = DbHelperMySQL.ExecuteReader(sql, false);
                dList = new List <OpenLottery>();
                while (sdr != null && sdr.Read())
                {
                    OpenLottery data = new OpenLottery();
                    data.DataPeriods    = Convert.ToInt64(sdr["DataPeriods"]);
                    data.AllBalance     = Convert.ToInt64(sdr["AllBalance"]);
                    data.SurplusBalance = Convert.ToInt64(sdr["SurplusBalance"]);
                    data.XiaoHaoDaiBi   = Convert.ToInt32(sdr["XiaoHaoDaiBi"]);
                    data.strWinNum      = sdr["strWinNum"].ToString();
                    data.WinInfo        = sdr["WinInfo"].ToString();
                    data.BocaiType      = BocaiType;
                    dList.Add(data);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.Message);
            }
            finally
            {
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
        }
예제 #5
0
        public static void LoadLotteryHistory(BoCaiTypeEnum BocaiType, out List <KFBoCaoHistoryData> HistoryList, string cmd = "")
        {
            MySqlDataReader sdr = null;

            HistoryList = new List <KFBoCaoHistoryData>();
            try
            {
                string sql = string.Format("SELECT `rid`,`DataPeriods`,`ServerID`,`RoleName`,`ZoneID`,`BuyNum`,`WinNo`,`WinMoney`FROM t_bocai_lottery_history WHERE `BocaiType`={0} ORDER BY `DataPeriods` DESC, `BuyNum` ASC {1};", (int)BocaiType, cmd);
                sdr = DbHelperMySQL.ExecuteReader(sql, false);
                while (sdr != null && sdr.Read())
                {
                    KFBoCaoHistoryData data = new KFBoCaoHistoryData();
                    data.RoleID      = Convert.ToInt32(sdr["rid"]);
                    data.ZoneID      = Convert.ToInt32(sdr["ZoneID"]);
                    data.ServerID    = Convert.ToInt32(sdr["ServerID"]);
                    data.RoleName    = sdr["RoleName"].ToString();
                    data.BuyNum      = Convert.ToInt32(sdr["BuyNum"]);
                    data.WinNo       = Convert.ToInt32(sdr["WinNo"]);
                    data.WinMoney    = Convert.ToInt64(sdr["WinMoney"]);
                    data.DataPeriods = Convert.ToInt64(sdr["DataPeriods"]);
                    HistoryList.Add(data);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.Message);
            }
            finally
            {
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
        }
예제 #6
0
        public List <PaymentModeInfo> GetPaymentModes(int type, string keyword = "")
        {
            List <PaymentModeInfo> list   = new List <PaymentModeInfo>();
            StringBuilder          strSql = new StringBuilder();

            strSql.Append("SELECT * FROM Pay_PaymentTypes WHERE Gateway <> 'adminaction'  ");
            if (type > 0)
            {
                strSql.AppendFormat(" And DrivePath like '%|{0}|%'", type);
            }
            if (!String.IsNullOrWhiteSpace(keyword))
            {
                strSql.AppendFormat(" And Name like '%{0}%'", Common.InjectionFilter.SqlFilter(keyword));
            }
            strSql.Append("  Order by DisplaySequence");

            using (IDataReader reader = DbHelperMySQL.ExecuteReader(strSql.ToString()))
            {
                while (reader.Read())
                {
                    list.Add(this.PopupPayment(reader));
                }
            }
            return(list);
        }
        private List <ZhanDuiZhengBaPkLogData> LoadPkLogList(int nowMonth)
        {
            List <ZhanDuiZhengBaPkLogData> roleList = new List <ZhanDuiZhengBaPkLogData>();

            try
            {
                string strSql = string.Format("SELECT month,id,zhanduiid1,zoneid1,zhanduiname1,zhanduiid2,zoneid2,zhanduiname2,result,upgrade,starttime,endtime FROM t_zhandui_zhengba_pk_log where `month`={0} ORDER BY endtime ASC;", nowMonth);
                using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
                {
                    while (sdr != null && sdr.Read())
                    {
                        roleList.Add(new ZhanDuiZhengBaPkLogData
                        {
                            Month        = Convert.ToInt32(sdr["month"]),
                            ID           = Convert.ToInt32(sdr["id"]),
                            ZhanDuiID1   = Convert.ToInt32(sdr["zhanduiid1"].ToString()),
                            ZoneID1      = Convert.ToInt32(sdr["zoneid1"]),
                            ZhanDuiName1 = sdr["zhanduiname1"].ToString(),
                            ZhanDuiID2   = Convert.ToInt32(sdr["zhanduiid2"].ToString()),
                            ZoneID2      = Convert.ToInt32(sdr["zoneid2"]),
                            ZhanDuiName2 = sdr["zhanduiname2"].ToString(),
                            PkResult     = Convert.ToInt32(sdr["result"]),
                            UpGrade      = (Convert.ToInt32(sdr["upgrade"]) == 1),
                            StartTime    = Convert.ToDateTime(sdr["starttime"].ToString()),
                            EndTime      = Convert.ToDateTime(sdr["endtime"].ToString())
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            return(roleList);
        }
예제 #8
0
        private List <EraTaskData> LoadEraTaskList(int junTuanId)
        {
            MySqlDataReader sdr = null;

            try
            {
                List <EraTaskData> EraTaskList = new List <EraTaskData>();
                string             strSql      = string.Format("SELECT * FROM t_juntuan_era_task WHERE `eraid`={0} AND `juntuanid`={1};", this.RuntimeData.CurrentEraID, junTuanId);
                sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                while (sdr != null && sdr.Read())
                {
                    EraTaskList.Add(new EraTaskData
                    {
                        TaskID   = Convert.ToInt32(sdr["taskid"].ToString()),
                        TaskVal1 = Convert.ToInt32(sdr["taskv1"].ToString()),
                        TaskVal2 = Convert.ToInt32(sdr["taskv2"].ToString()),
                        TaskVal3 = Convert.ToInt32(sdr["taskv3"].ToString())
                    });
                }
                return(EraTaskList);
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            finally
            {
                if (null != sdr)
                {
                    sdr.Close();
                }
            }
            return(null);
        }
예제 #9
0
        public List <KFAllyData> DBAllyAcceptList(int unionID)
        {
            List <KFAllyData> list = new List <KFAllyData>();

            try
            {
                string strSql = string.Format(@"SELECT myUnionID,logTime,logState FROM t_ally_request WHERE unionID='{0}'", unionID);
                var    sdr    = DbHelperMySQL.ExecuteReader(strSql);
                while (sdr != null && sdr.Read())
                {
                    KFAllyData item = new KFAllyData();
                    item.UnionID  = (int)Convert.ToInt32(sdr["myUnionID"]);
                    item.LogTime  = Convert.ToDateTime(sdr["logTime"]);
                    item.LogState = (int)Convert.ToInt32(sdr["logState"]);

                    list.Add(item);
                }

                if (sdr != null)
                {
                    sdr.Close();
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(list);
        }
예제 #10
0
        public List <AllyLogData> DBAllyLogList(int unionID)
        {
            List <AllyLogData> list = new List <AllyLogData>();

            try
            {
                string strSql = string.Format(@"SELECT l.myUnionID,l.unionID,u.unionZoneID,u.unionName,l.logTime,l.logState
                                                FROM t_ally_log l,t_ally_union u
                                                WHERE l.unionID = u.unionID AND l.unionID='{0}'", unionID);
                var    sdr    = DbHelperMySQL.ExecuteReader(strSql);
                while (sdr != null && sdr.Read())
                {
                    AllyLogData item = new AllyLogData();
                    item.MyUnionID = (int)Convert.ToInt32(sdr["myUnionID"]);
                    item.UnionID   = (int)Convert.ToInt32(sdr["unionID"]);
                    item.LogTime   = Convert.ToDateTime(sdr["logTime"]);
                    item.LogState  = (int)Convert.ToInt32(sdr["logState"]);

                    list.Add(item);
                }

                if (sdr != null)
                {
                    sdr.Close();
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(list);
        }
예제 #11
0
        private bool LoadBHMatchBHData_Join(BangHuiMatchType type, int seasonID, List <BHMatchBHData> BHMatchBHDataList_Join, bool lastSeason = false)
        {
            bool result;

            if (null == BHMatchBHDataList_Join)
            {
                result = false;
            }
            else
            {
                BHMatchBHDataList_Join.Clear();
                try
                {
                    KuaFuData <BHMatchBHData> bhData = null;
                    string strSql = string.Format("SELECT * FROM t_banghui_match_bh_season WHERE `type`={0} AND `season`={1}", (int)type, seasonID);
                    if (type == BangHuiMatchType.BHMT_Begin)
                    {
                        strSql += string.Format(" ORDER BY `group` ASC", new object[0]);
                    }
                    MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        int bhid = Convert.ToInt32(sdr["bhid"]);
                        if (type == BangHuiMatchType.BHMT_Begin && this.BHMatchBHDataDict_Gold.TryGetValue(bhid, out bhData))
                        {
                            TimeUtil.AgeByNow(ref bhData.Age);
                            if (!lastSeason)
                            {
                                bhData.V.cur_win   = Convert.ToInt32(sdr["win"]);
                                bhData.V.group     = Convert.ToInt32(sdr["group"]);
                                bhData.V.cur_score = 0;
                            }
                            BHMatchBHDataList_Join.Add(bhData.V);
                        }
                        if (type == BangHuiMatchType.Rookie && this.BHMatchBHDataDict_Rookie.TryGetValue(bhid, out bhData))
                        {
                            TimeUtil.AgeByNow(ref bhData.Age);
                            if (!lastSeason)
                            {
                                bhData.V.cur_win   = Convert.ToInt32(sdr["win"]);
                                bhData.V.group     = 0;
                                bhData.V.cur_score = Convert.ToInt32(sdr["score"]);
                            }
                            BHMatchBHDataList_Join.Add(bhData.V);
                        }
                    }
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }
예제 #12
0
        public List <int> DBAllyIDList(int unionID)
        {
            List <int> idList = new List <int>();

            try
            {
                string strSql = string.Format(@"SELECT DISTINCT(unionID2) uid from t_ally where unionID1='{0}' 
                                                UNION
                                                SELECT DISTINCT(unionID1) uid from t_ally where unionID2='{0}' 
                                                ORDER BY uid", unionID);

                var sdr = DbHelperMySQL.ExecuteReader(strSql);
                while (sdr != null && sdr.Read())
                {
                    idList.Add(Convert.ToInt32(sdr["uid"]));
                }

                if (sdr != null)
                {
                    sdr.Close();
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(idList);
        }
예제 #13
0
        public PaymentModeInfo GetPaymentMode(int modeId)
        {
            PaymentModeInfo info   = new PaymentModeInfo();
            StringBuilder   strSql = new StringBuilder();

            strSql.Append("SELECT * FROM Pay_PaymentTypes WHERE ModeId = ?ModeId;SELECT Code FROM Pay_PaymentCurrencys WHERE ModeId = ?ModeId");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("?ModeId", MySqlDbType.Int32)
            };
            parameters[0].Value = modeId;
            using (IDataReader reader = DbHelperMySQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.Read())
                {
                    info = this.PopupPayment(reader);
                }
                if (!reader.NextResult())
                {
                    return(info);
                }
                while (reader.Read())
                {
                    info.SupportedCurrencys.Add(reader.GetString(0));
                }
            }
            return(info);
        }
예제 #14
0
        /// <summary>
        /// 从数据库t_game_config加载数据
        /// </summary>
        /// <param name="dbAge"></param>
        public void LoadGameConfigFromDataBase(int dbAge)
        {
            MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(string.Format("select * from t_game_config where gametype={0}", (int)GameTypes.HuanYingSiYuan));

            if (sdr.Read())
            {
                HuanYingSiYuanGameConfigData.GameType = (int)Convert.ToInt32(sdr["gametype"]);
                HuanYingSiYuanGameConfigData.MaxCount = (int)Convert.ToInt32(sdr["maxcount"]);
                HuanYingSiYuanGameConfigData.DayCount = (int)Convert.ToInt32(sdr["daycount"]);
                HuanYingSiYuanGameConfigData.Date     = (DateTime)Convert.ToDateTime(sdr["date"]);
            }

            DateTime date = DateTime.Now.Date;

            if (HuanYingSiYuanGameConfigData.Date != date)
            {
                dbAge++;
                HuanYingSiYuanGameConfigData.Date     = date;
                HuanYingSiYuanGameConfigData.DayCount = 0;
                DbHelperMySQL.ExecuteSql(string.Format("update t_game_config set daycount=0,date='{1}' where gametype={0}", (int)GameTypes.HuanYingSiYuan, date.ToString("yyyy-MM-dd")));
                DbHelperMySQL.ExecuteSql("update t_async set value=value+1 where id = 3");
            }

            GameDataAge = dbAge;
        }
예제 #15
0
        public bool LoadBangHuiDataExList(List <LangHunLingYuBangHuiDataEx> list)
        {
            MySqlDataReader sdr = null;

            try
            {
                string strSql = string.Format("SELECT * FROM `t_lhly_banghui`;", new object[0]);
                sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                int index = 1;
                while (sdr.Read())
                {
                    list.Add(new LangHunLingYuBangHuiDataEx
                    {
                        Bhid   = Convert.ToInt32(sdr["bhid"]),
                        ZoneId = Convert.ToInt32(sdr["zoneid"]),
                        BhName = sdr["bhname"].ToString()
                    });
                    index++;
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            finally
            {
                if (null != sdr)
                {
                    sdr.Close();
                }
            }
            return(false);
        }
예제 #16
0
        public int GetAwardHistoryForUser(string userid, int activitytype, string keystr, out long hasgettimes, out string lastgettime)
        {
            hasgettimes = 0L;
            lastgettime = "";
            int             ret    = -1;
            MySqlDataReader reader = null;

            try
            {
                string cmdText = string.Format("SELECT hasgettimes, lastgettime from t_huodongawarduserhist where userid='{0}' and activitytype={1} and keystr='{2}' ", userid, activitytype, keystr);
                reader = DbHelperMySQL.ExecuteReader(cmdText, false);
                if (reader.Read())
                {
                    hasgettimes = Convert.ToInt64(reader["hasgettimes"].ToString());
                    lastgettime = reader["lastgettime"].ToString();
                    ret         = 0;
                }
            }
            finally
            {
                if (null != reader)
                {
                    reader.Close();
                }
            }
            return(ret);
        }
예제 #17
0
        public List <KFAllyData> DBAllyRequestList(int unionID)
        {
            List <KFAllyData> list = new List <KFAllyData>();

            try
            {
                string          strSql = string.Format("SELECT unionID,logTime,logState FROM t_ally_request WHERE myUnionID='{0}'", unionID);
                MySqlDataReader sdr    = DbHelperMySQL.ExecuteReader(strSql, false);
                while (sdr != null && sdr.Read())
                {
                    list.Add(new KFAllyData
                    {
                        UnionID  = Convert.ToInt32(sdr["unionID"]),
                        LogTime  = Convert.ToDateTime(sdr["logTime"]),
                        LogState = Convert.ToInt32(sdr["logState"])
                    });
                }
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(list);
        }
예제 #18
0
        public List <AllyLogData> DBAllyLogList(int unionID)
        {
            List <AllyLogData> list = new List <AllyLogData>();

            try
            {
                string          strSql = string.Format("SELECT l.myUnionID,l.unionID,u.unionZoneID,u.unionName,l.logTime,l.logState\r\n                                                FROM t_ally_log l,t_ally_union u\r\n                                                WHERE l.unionID = u.unionID AND l.unionID='{0}'", unionID);
                MySqlDataReader sdr    = DbHelperMySQL.ExecuteReader(strSql, false);
                while (sdr != null && sdr.Read())
                {
                    list.Add(new AllyLogData
                    {
                        MyUnionID = Convert.ToInt32(sdr["myUnionID"]),
                        UnionID   = Convert.ToInt32(sdr["unionID"]),
                        LogTime   = Convert.ToDateTime(sdr["logTime"]),
                        LogState  = Convert.ToInt32(sdr["logState"])
                    });
                }
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(list);
        }
예제 #19
0
        public KFAllyData DBUnionDataGet(int unionZoneID, string unionName)
        {
            KFAllyData item = null;

            try
            {
                string          strSql = string.Format("SELECT unionID,unionZoneID,unionName,unionLevel,unionNum,leaderID,leaderZoneID,leaderName,logTime,serverID\r\n                                                FROM t_ally_union\r\n                                                WHERE unionZoneID='{0}' and unionName='{1}'", unionZoneID, unionName);
                MySqlDataReader sdr    = DbHelperMySQL.ExecuteReader(strSql, false);
                while (sdr != null && sdr.Read())
                {
                    item              = new KFAllyData();
                    item.UnionID      = Convert.ToInt32(sdr["unionID"]);
                    item.UnionZoneID  = Convert.ToInt32(sdr["unionZoneID"]);
                    item.UnionName    = sdr["unionName"].ToString();
                    item.UnionLevel   = Convert.ToInt32(sdr["unionLevel"]);
                    item.UnionNum     = Convert.ToInt32(sdr["unionNum"]);
                    item.LeaderID     = Convert.ToInt32(sdr["leaderID"]);
                    item.LeaderZoneID = Convert.ToInt32(sdr["leaderZoneID"]);
                    item.LeaderName   = sdr["leaderName"].ToString();
                    item.LogTime      = Convert.ToDateTime(sdr["logTime"]);
                    item.ServerID     = Convert.ToInt32(sdr["serverID"]);
                }
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(item);
        }
예제 #20
0
        private List <EscapeBattleZhanDuiData> LoadZhanDuiData()
        {
            List <EscapeBattleZhanDuiData> list = new List <EscapeBattleZhanDuiData>();

            try
            {
                string strSql = string.Format("SELECT season,e.zhanduiid,zhanduiname,zoneid,e.duanweiid,e.duanweijifen,e.duanweirank,zhanli FROM t_zhandui_escape e left join t_kf_5v5_zhandui z on e.zhanduiid=z.zhanduiid order by e.duanweijifen desc,e.zhanduiid", new object[0]);
                using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
                {
                    while (sdr != null && sdr.Read())
                    {
                        list.Add(new EscapeBattleZhanDuiData
                        {
                            Season       = Convert.ToInt32(sdr["season"]),
                            ZhanDuiID    = Convert.ToInt32(sdr["zhanduiid"]),
                            ZoneId       = Convert.ToInt32(sdr["zoneid"]),
                            ZhanDuiName  = sdr["zhanduiname"].ToString(),
                            DuanWeiId    = Convert.ToInt32(sdr["duanweiid"]),
                            DuanWeiRank  = Convert.ToInt32(sdr["duanweirank"]),
                            DuanWeiJiFen = Convert.ToInt32(sdr["duanweijifen"]),
                            ZhanLi       = Convert.ToInt64(sdr["zhanli"])
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            return(list);
        }
예제 #21
0
        public List <KFEscapeRankInfo> LoadEscapeRankData(int season)
        {
            List <KFEscapeRankInfo> list = new List <KFEscapeRankInfo>();

            try
            {
                string strSql = string.Format("SELECT zhanduiid,zhanduiname,zoneid,duanweijifen,zhanli FROM t_zhandui_escape_paihang e where season={0}", season);
                using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
                {
                    while (sdr != null && sdr.Read())
                    {
                        list.Add(new KFEscapeRankInfo
                        {
                            Key       = Convert.ToInt32(sdr["zhanduiid"]),
                            ZoneID    = Convert.ToInt32(sdr["zoneid"]),
                            StrParam1 = sdr["zhanduiname"].ToString(),
                            Value     = Convert.ToInt32(sdr["duanweijifen"]),
                            Param1    = (long)Convert.ToInt32(sdr["zhanli"])
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            list.Sort(new Comparison <KFEscapeRankInfo>(TianTiPersistence.CompareKFEscapeRankInfo));
            return(list);
        }
예제 #22
0
 public int[] GetHistSeasonIDs(int maxCount)
 {
     int[] result = new int[3];
     try
     {
         string strSql = string.Format("SELECT `season` FROM `t_kfld_season` order by `season` desc limit {0}", maxCount);
         using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
         {
             while (sdr != null && sdr.Read())
             {
                 int season = Convert.ToInt32(sdr[0].ToString());
                 if (result[0] > 0)
                 {
                     result[1] = season;
                 }
                 if (result[0] == 0)
                 {
                     result[0] = season;
                 }
                 if (--maxCount == 0)
                 {
                     result[2] = season;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
     }
     return(result);
 }
예제 #23
0
        /// <summary>
        /// 检测登录用户信息
        /// </summary>
        public S_USER CheckLogin(string account, string password)
        {
            string sqlValue = @"SELECT * FROM S_USER WHERE TEL=@ACCOUNT AND USER_PSD =@PASSWORD
                                UNION ALL SELECT * FROM S_USER WHERE REAL_NAME=@ACCOUNT AND USER_PSD =@PASSWORD
                                UNION ALL SELECT * FROM S_USER WHERE USER_NAME=@ACCOUNT AND USER_PSD =@PASSWORD ";
            List <MySqlParameter> parameters = new List <MySqlParameter>();

            parameters.Add(new MySqlParameter("@ACCOUNT", account));
            parameters.Add(new MySqlParameter("@PASSWORD", password));

            S_USER model = new S_USER();

            try
            {
                using (IDataReader reader = DbHelperMySQL.ExecuteReader(sqlValue, parameters.ToArray()))
                {
                    while (reader.Read())
                    {
                        model = DataReaderToModel(reader);
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }
            return(model);
        }
예제 #24
0
        public PaymentModeInfo GetPaymentMode(string gateway)
        {
            PaymentModeInfo info   = null;
            StringBuilder   strSql = new StringBuilder();

            strSql.Append("SELECT * FROM Pay_PaymentTypes WHERE Gateway = @Gateway LIMIT 1;SELECT Code FROM Pay_PaymentCurrencys WHERE ModeId = (SELECT ModeId FROM Pay_PaymentTypes WHERE Gateway = @Gateway LIMIT 1) ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Gateway", MySqlDbType.VarChar)
            };
            parameters[0].Value = gateway;
            using (IDataReader reader = DbHelperMySQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.Read())
                {
                    info = this.PopupPayment(reader);
                }
                if (!reader.NextResult())
                {
                    return(info);
                }
                while (reader.Read())
                {
                    info.SupportedCurrencys.Add(reader.GetString(0));
                }
            }
            return(info);
        }
예제 #25
0
 private bool LoadBHMatchBHData_LastSeason(BangHuiMatchType type, int seasonID)
 {
     try
     {
         KuaFuData <BHMatchBHData> bhData = null;
         string          strSql           = string.Format("SELECT * FROM t_banghui_match_bh_season where `type`={0} and `season`={1}", (int)type, seasonID);
         MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
         while (sdr != null && sdr.Read())
         {
             int bhid = Convert.ToInt32(sdr["bhid"]);
             if (type == BangHuiMatchType.BHMT_Begin && this.BHMatchBHDataDict_Gold.TryGetValue(bhid, out bhData))
             {
                 TimeUtil.AgeByNow(ref bhData.Age);
                 bhData.V.last_win   = Convert.ToInt32(sdr["win"]);
                 bhData.V.last_score = 0;
             }
             if (type == BangHuiMatchType.Rookie && this.BHMatchBHDataDict_Rookie.TryGetValue(bhid, out bhData))
             {
                 TimeUtil.AgeByNow(ref bhData.Age);
                 bhData.V.last_win   = Convert.ToInt32(sdr["win"]);
                 bhData.V.last_score = Convert.ToInt32(sdr["score"]);
             }
         }
         if (sdr != null)
         {
             sdr.Close();
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
         return(false);
     }
     return(true);
 }
예제 #26
0
        /// <summary>
        /// 加载雕像数据
        /// </summary>
        /// <param name="week"></param>
        /// <returns></returns>
        public CoupleWishSyncStatueData LoadCoupleStatue(int week)
        {
            CoupleWishSyncStatueData data = new CoupleWishSyncStatueData();

            data.ModifyTime = TimeUtil.NowDateTime();
            MySqlDataReader sdr = null;

            try
            {
                string sql = string.Format("SELECT `couple_id`,`man_rid`,`man_zoneid`,`man_rname`,`man_statue`,`wife_rid`,`wife_zoneid`,`wife_rname`,`wife_statue`,`admire_cnt`,`is_divorced`,`yanhui_join_num` " +
                                           "FROM t_couple_wish_statue WHERE `week`={0};", week);
                sdr = DbHelperMySQL.ExecuteReader(sql);
                while (sdr != null && sdr.Read())
                {
                    data.DbCoupleId = Convert.ToInt32(sdr["couple_id"]);

                    data.Man          = new KuaFuRoleMiniData();
                    data.Man.RoleId   = Convert.ToInt32(sdr["man_rid"]);
                    data.Man.ZoneId   = Convert.ToInt32(sdr["man_zoneid"]);
                    data.Man.RoleName = sdr["man_rname"].ToString();
                    if (!sdr.IsDBNull(sdr.GetOrdinal("man_statue")))
                    {
                        data.ManRoleDataEx = (byte[])(sdr["man_statue"]);
                    }

                    data.Wife          = new KuaFuRoleMiniData();
                    data.Wife.RoleId   = Convert.ToInt32(sdr["wife_rid"]);
                    data.Wife.ZoneId   = Convert.ToInt32(sdr["wife_zoneid"]);
                    data.Wife.RoleName = sdr["wife_rname"].ToString();
                    if (!sdr.IsDBNull(sdr.GetOrdinal("wife_statue")))
                    {
                        data.WifeRoleDataEx = (byte[])(sdr["wife_statue"]);
                    }

                    data.BeAdmireCount = Convert.ToInt32(sdr["admire_cnt"]);
                    data.IsDivorced    = Convert.ToInt32(sdr["is_divorced"]);
                    data.YanHuiJoinNum = Convert.ToInt32(sdr["yanhui_join_num"]);
                    data.Week          = week;

                    break;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.Message);
            }
            finally
            {
                if (sdr != null)
                {
                    sdr.Close();
                }
            }

            return(data);
        }
예제 #27
0
 private bool LoadKuaFuLueDuoBHData(Dictionary <int, KuaFuData <KuaFuLueDuoBHData> > KuaFuLueDuoBHDataDict, int minSeason)
 {
     try
     {
         long   sAge   = TimeUtil.AgeByNow();
         string strSql = string.Format("SELECT * FROM t_kfld_banghui where `season`>={0}", minSeason);
         using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
         {
             while (sdr != null && sdr.Read())
             {
                 KuaFuData <KuaFuLueDuoBHData> bhData = new KuaFuData <KuaFuLueDuoBHData>();
                 bhData.V.season      = Convert.ToInt32(sdr["season"]);
                 bhData.V.bhid        = Convert.ToInt32(sdr["bhid"]);
                 bhData.V.bhname      = (sdr["bhname"] as string);
                 bhData.V.zoneid      = Convert.ToInt32(sdr["zoneid"]);
                 bhData.V.sum_ziyuan  = Convert.ToInt32(sdr["sum_ziyuan"]);
                 bhData.V.last_ziyuan = Convert.ToInt32(sdr["last"]);
                 bhData.Age           = sAge;
                 KuaFuLueDuoBHDataDict[bhData.V.bhid] = bhData;
                 int zoneid = bhData.V.zoneid;
                 if (bhData.V.sum_ziyuan > 0 && zoneid > 0 && zoneid < this.ZoneID2ServerIDs.Length)
                 {
                     KuaFuLueDuoServerInfo data;
                     if (this.ServerInfoDict.TryGetValue(this.ZoneID2ServerIDs[zoneid], out data))
                     {
                         string name = KuaFuServerManager.FormatName(bhData.V.bhname, bhData.V.zoneid);
                         data.MingXingList.Add(new KuaFuLueDuoRankInfo
                         {
                             Key    = bhData.V.bhid,
                             Param1 = name,
                             Value  = bhData.V.sum_ziyuan
                         });
                     }
                 }
             }
         }
         foreach (KuaFuLueDuoServerInfo data in this.ServerInfoDict.Values)
         {
             string mingxing = KuaFuLueDuoUtils.RankList2MingXingStr(data.MingXingList, 2);
             if (mingxing != data.MingXingZhanMengList)
             {
                 data.MingXingZhanMengList = mingxing;
                 string sql = string.Format("update t_kfld_server set `mingxing`='{1}' where `serverid`={0}", data.ServerId, mingxing);
                 this.ExecuteSqlNoQuery(sql);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
         return(false);
     }
     return(true);
 }
예제 #28
0
        private bool LoadCompData(KuaFuData <Dictionary <int, KFCompData> > CompDataDict)
        {
            bool result;

            if (null == CompDataDict)
            {
                result = false;
            }
            else
            {
                try
                {
                    string          strSql = string.Format("SELECT * FROM `t_comp`", new object[0]);
                    MySqlDataReader sdr    = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        KFCompData myCompData = new KFCompData();
                        myCompData.InitPlunderResList();
                        myCompData.CompType         = Convert.ToInt32(sdr["type"]);
                        myCompData.BoomValue        = Convert.ToInt32(sdr["boomval"]);
                        myCompData.YestdBoomValue   = Convert.ToInt32(sdr["boomval_yestd"]);
                        myCompData.EnemyCompType    = Convert.ToInt32(sdr["enemytype"]);
                        myCompData.EnemyCompTypeSet = Convert.ToInt32(sdr["enemyset"]);
                        myCompData.Bulletin         = sdr["bulletin"].ToString();
                        myCompData.Crystal          = Convert.ToInt32(sdr["crystal"]);
                        myCompData.BossDamageTop    = Convert.ToInt32(sdr["bossdamage"]);
                        myCompData.Boss             = Convert.ToInt32(sdr["boss"]);
                        myCompData.YestdCrystal     = Convert.ToInt32(sdr["crystal_yestd"]);
                        myCompData.YestdBoss        = Convert.ToInt32(sdr["boss_yestd"]);
                        myCompData.ParsePlunderResListString(sdr["plunderres"].ToString(), myCompData.PlunderResList);
                        myCompData.ParsePlunderResListString(sdr["plunderres_yestd"].ToString(), myCompData.YestdPlunderResList);
                        myCompData.ParseStrongholdDictString(sdr["stronghold"].ToString(), myCompData.StrongholdDict);
                        myCompData.BossKillCompType      = Convert.ToInt32(sdr["bosskilltype"]);
                        myCompData.YestdBossKillCompType = Convert.ToInt32(sdr["bosskilltype_yestd"]);
                        myCompData.MineRes  = Convert.ToInt32(sdr["mine"]);
                        myCompData.MineRank = Convert.ToInt32(sdr["mine_rank"]);
                        CompDataDict.V[myCompData.CompType] = myCompData;
                    }
                    TimeUtil.AgeByNow(ref CompDataDict.Age);
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }
예제 #29
0
        /// <summary>
        /// 从数据库加载排行榜
        /// </summary>
        /// <returns></returns>
        public List <CoupleWishCoupleDataK> LoadRankFromDb(int week)
        {
            MySqlDataReader sdr = null;
            List <CoupleWishCoupleDataK> result = new List <CoupleWishCoupleDataK>();

            try
            {
                string sql = string.Format("SELECT `couple_id`,`man_rid`,`man_zoneid`,`man_rname`,`man_selector`,`wife_rid`,`wife_zoneid`,`wife_rname`,`wife_selector`,`be_wish_num`,`rank` " +
                                           "FROM t_couple_wish_group WHERE `week`={0} ORDER BY `rank`;", week);
                sdr = DbHelperMySQL.ExecuteReader(sql);
                while (sdr != null && sdr.Read())
                {
                    CoupleWishCoupleDataK data = new CoupleWishCoupleDataK();
                    data.DbCoupleId = Convert.ToInt32(sdr["couple_id"]);

                    data.Man          = new KuaFuRoleMiniData();
                    data.Man.RoleId   = Convert.ToInt32(sdr["man_rid"]);
                    data.Man.ZoneId   = Convert.ToInt32(sdr["man_zoneid"]);
                    data.Man.RoleName = sdr["man_rname"].ToString();
                    if (!sdr.IsDBNull(sdr.GetOrdinal("man_selector")))
                    {
                        data.ManSelector = (byte[])(sdr["man_selector"]);
                    }

                    data.Wife          = new KuaFuRoleMiniData();
                    data.Wife.RoleId   = Convert.ToInt32(sdr["wife_rid"]);
                    data.Wife.ZoneId   = Convert.ToInt32(sdr["wife_zoneid"]);
                    data.Wife.RoleName = sdr["wife_rname"].ToString();
                    if (!sdr.IsDBNull(sdr.GetOrdinal("wife_selector")))
                    {
                        data.WifeSelector = (byte[])(sdr["wife_selector"]);
                    }

                    data.BeWishedNum = Convert.ToInt32(sdr["be_wish_num"]);
                    data.Rank        = Convert.ToInt32(sdr["rank"]);

                    result.Add(data);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.Message);
            }
            finally
            {
                if (sdr != null)
                {
                    sdr.Close();
                }
            }

            return(result);
        }
예제 #30
0
        private bool LoadBHMatchPKInfoList(BangHuiMatchType type, KuaFuData <List <BangHuiMatchPKInfo> > BHMatchPKInfoList_Gold)
        {
            bool result;

            if (null == BHMatchPKInfoList_Gold)
            {
                result = false;
            }
            else
            {
                BHMatchPKInfoList_Gold.V.Clear();
                try
                {
                    KuaFuData <BHMatchBHData> bhData = null;
                    string          strSql           = string.Format("SELECT * FROM t_banghui_match_pk_log WHERE `type`={0} ORDER BY `season` DESC, `round` DESC LIMIT {1}", (int)type, 80);
                    MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        BangHuiMatchPKInfo pkInfo = new BangHuiMatchPKInfo();
                        pkInfo.type    = Convert.ToByte(sdr["type"]);
                        pkInfo.season  = Convert.ToInt32(sdr["season"]);
                        pkInfo.round   = Convert.ToByte(sdr["round"]);
                        pkInfo.bhid1   = Convert.ToInt32(sdr["bhid1"]);
                        pkInfo.bhid2   = Convert.ToInt32(sdr["bhid2"]);
                        pkInfo.result  = Convert.ToByte(sdr["result"]);
                        pkInfo.zoneid1 = Convert.ToInt32(sdr["zoneid1"]);
                        pkInfo.zoneid2 = Convert.ToInt32(sdr["zoneid2"]);
                        if (this.BHMatchBHDataDict_Gold.TryGetValue(pkInfo.bhid1, out bhData))
                        {
                            pkInfo.bhname1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname);
                        }
                        if (this.BHMatchBHDataDict_Gold.TryGetValue(pkInfo.bhid2, out bhData))
                        {
                            pkInfo.bhname2 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname);
                        }
                        BHMatchPKInfoList_Gold.V.Add(pkInfo);
                    }
                    TimeUtil.AgeByNow(ref BHMatchPKInfoList_Gold.Age);
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }