Ejemplo n.º 1
0
        public static bool ReplaceOpenLottery(OpenLottery data)
        {
            int ret = -1;

            try
            {
                using (MyDbConnection3 conn = new MyDbConnection3(false))
                {
                    string sql = string.Format("REPLACE INTO t_bocai_open_lottery(DataPeriods, AllBalance, SurplusBalance, XiaoHaoDaiBi, BocaiType, strWinNum, WinInfo, IsAward) VALUES({0},{1},{2},{3},{4},'{5}','{6}', {7});", new object[]
                    {
                        data.DataPeriods,
                        data.AllBalance,
                        data.SurplusBalance,
                        data.XiaoHaoDaiBi,
                        data.BocaiType,
                        data.strWinNum,
                        data.WinInfo,
                        data.IsAward
                    });
                    ret = conn.ExecuteNonQuery(sql, 0);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
            }
            return(ret > -1);
        }
Ejemplo n.º 2
0
        private void updateOpen(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            string msgStr = "false";

            try
            {
                OpenLottery Data = DataHelper.BytesToObject <OpenLottery>(cmdParams, 0, count);
                msgStr = BoCaiDBOperator.ReplaceOpenLottery(Data).ToString();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, ex.ToString(), null, true);
            }
            client.sendCmd(nID, msgStr);
        }
Ejemplo n.º 3
0
        public static void SelectOpenLottery(int bocaiType, out List <OpenLottery> dList)
        {
            MySQLConnection conn  = null;
            DBManager       dbMgr = DBManager.getInstance();

            dList = null;
            try
            {
                conn = dbMgr.DBConns.PopDBConnection();
                string          sql    = string.Format("SELECT `DataPeriods`,`XiaoHaoDaiBi`,`strWinNum`,`WinInfo` ,`AllBalance`,`SurplusBalance` FROM t_bocai_open_lottery WHERE `IsAward` < 1 AND `BocaiType`={0};", bocaiType);
                MySQLCommand    cmd    = new MySQLCommand(sql, conn);
                MySQLDataReader reader = cmd.ExecuteReaderEx();
                dList = new List <OpenLottery>();
                while (reader.Read())
                {
                    OpenLottery Item = new OpenLottery
                    {
                        strWinNum      = reader["strWinNum"].ToString(),
                        XiaoHaoDaiBi   = Convert.ToInt32(reader["XiaoHaoDaiBi"].ToString()),
                        WinInfo        = reader["WinInfo"].ToString(),
                        DataPeriods    = Convert.ToInt64(reader["DataPeriods"].ToString()),
                        AllBalance     = Convert.ToInt64(reader["AllBalance"].ToString()),
                        SurplusBalance = Convert.ToInt64(reader["SurplusBalance"].ToString()),
                        BocaiType      = bocaiType
                    };
                    dList.Add(Item);
                }
                GameDBManager.SystemServerSQLEvents.AddEvent(string.Format("+SQL: {0}", sql), EventLevels.Important);
                cmd.Dispose();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
            }
            finally
            {
                if (null != conn)
                {
                    dbMgr.DBConns.PushDBConnection(conn);
                }
            }
        }