public static bool ReplaceBoCaiShop(BoCaiShopDB data)
        {
            int ret = -1;

            try
            {
                using (MyDbConnection3 conn = new MyDbConnection3(false))
                {
                    string sql = string.Format("REPLACE INTO t_bocai_shop(rid, ID, BuyNum, Periods, WuPinID) VALUES({0},{1},{2},'{3}','{4}');", new object[]
                    {
                        data.RoleID,
                        data.ID,
                        data.BuyNum,
                        TimeUtil.NowDataTimeString("yyMMdd"),
                        data.WuPinID
                    });
                    ret = conn.ExecuteNonQuery(sql, 0);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
            }
            return(ret > -1);
        }
 public static void SelectBoCaiShop(string Periods, out List <BoCaiShopDB> dList)
 {
     dList = null;
     try
     {
         using (MyDbConnection3 conn = new MyDbConnection3(false))
         {
             string          sql    = string.Format("SELECT rid, ID, BuyNum, WuPinID from t_bocai_shop where Periods={0}", Periods);
             MySQLDataReader reader = conn.ExecuteReader(sql, new MySQLParameter[0]);
             dList = new List <BoCaiShopDB>();
             while (reader.Read())
             {
                 BoCaiShopDB temp = new BoCaiShopDB();
                 temp.RoleID  = Convert.ToInt32(reader["rid"].ToString());
                 temp.ID      = Convert.ToInt32(reader["ID"].ToString());
                 temp.BuyNum  = Convert.ToInt32(reader["BuyNum"].ToString());
                 temp.WuPinID = reader["WuPinID"].ToString();
                 temp.Periods = Convert.ToInt32(Periods);
                 dList.Add(temp);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
Example #3
0
        private void setShopData(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            string msgStr = "false";

            try
            {
                BoCaiShopDB Data = DataHelper.BytesToObject <BoCaiShopDB>(cmdParams, 0, count);
                msgStr = BoCaiDBOperator.ReplaceBoCaiShop(Data).ToString();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, ex.ToString(), null, true);
            }
            client.sendCmd(nID, msgStr);
        }