public static bool Update(GoldAuctionDBItem Item) { int ret = -1; try { using (MyDbConnection3 conn = new MyDbConnection3(false)) { string cmdText = string.Format("UPDATE t_gold_auction SET BuyerData='{0}', AuctionTime='{1}', AuctionType='{2}', UpDBWay='{3}', UpdateTime='{4}' WHERE AuctionSource='{5}' AND ProductionTime='{6}'", new object[] { Item.BuyerData.getAttackerValue(), Item.AuctionTime, Item.AuctionType, ((DBAuctionUpEnum)Item.UpDBWay).ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Item.AuctionSource, Item.ProductionTime }); ret = conn.ExecuteNonQuery(cmdText, 0); LjlLog.WriteLogFormat(LogTypes.Info, new string[] { "金团拍卖行更新", (ret > -1).ToString(), " ", cmdText }); } } catch (Exception ex) { LjlLog.WriteLog(LogTypes.Exception, ex.ToString(), ""); } return(ret > -1); }
public static bool Insert(GoldAuctionDBItem Item) { int ret = -1; try { using (MyDbConnection3 conn = new MyDbConnection3(false)) { string strAttackerList = DataHelper.ObjectToHexString <List <AuctionRoleData> >(Item.RoleList); string temp = "INSERT INTO t_gold_auction(BuyerData, AuctionTime, AuctionType, AuctionSource, ProductionTime,"; temp += "StrGoods, BossLife, KillBossRoleID, UpDBWay, UpdateTime, AttackerList)"; temp += " VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', {10})"; string cmdText = string.Format(temp, new object[] { Item.BuyerData.getAttackerValue(), Item.AuctionTime, Item.AuctionType, Item.AuctionSource, Item.ProductionTime, Item.StrGoods, Item.BossLife, Item.KillBossRoleID, ((DBAuctionUpEnum)Item.UpDBWay).ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), strAttackerList }); ret = conn.ExecuteNonQuery(cmdText, 0); LjlLog.WriteLogFormat(LogTypes.Info, new string[] { "SQL Insert ", (ret > -1).ToString() }); } } catch (Exception ex) { LjlLog.WriteLog(LogTypes.Exception, ex.ToString(), ""); } return(ret > -1); }
public static bool DelData(string Sql) { int ret = -1; try { using (MyDbConnection3 conn = new MyDbConnection3(false)) { ret = conn.ExecuteNonQuery(string.Format("delete from t_gold_auction where {0}", Sql), 0); LjlLog.WriteLogFormat(LogTypes.Info, new string[] { "DelData ", (ret > -1).ToString(), " ,delete from t_gold_auction where ", Sql }); } } catch (Exception ex) { LjlLog.WriteLog(LogTypes.Exception, ex.ToString(), ""); } return(ret > -1); }