public bool UpdateBargainDetial(HelpBargainDetialInfo helpBargainDetial) { string query = "update Hishop_BargainDetial set Price=Price-@BargainPrice,NumberOfParticipants=NumberOfParticipants+1 where id=@id"; DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); this.database.AddInParameter(sqlStringCommand, "BargainPrice", DbType.Decimal, helpBargainDetial.BargainPrice); this.database.AddInParameter(sqlStringCommand, "id", DbType.Int32, helpBargainDetial.BargainDetialId); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public bool ExistsHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial) { string query = "select count(*) from Hishop_HelpBargainDetial where BargainDetialId=@BargainDetialId and UserId=@UserId and BargainId=@BargainId"; DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); this.database.AddInParameter(sqlStringCommand, "BargainDetialId", DbType.Int32, helpBargainDetial.BargainDetialId); this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, helpBargainDetial.UserId); this.database.AddInParameter(sqlStringCommand, "BargainId", DbType.Int32, helpBargainDetial.BargainId); return(int.Parse(this.database.ExecuteScalar(sqlStringCommand).ToString()) > 0); }
public HelpBargainDetialInfo GeHelpBargainDetialInfo(int bargainDetialId, int userId) { HelpBargainDetialInfo info = new HelpBargainDetialInfo(); DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_HelpBargainDetial WHERE BargainDetialId = @BargainDetialId and UserId=@UserId"); this.database.AddInParameter(sqlStringCommand, "BargainDetialId", DbType.Int32, bargainDetialId); this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, userId); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { return(ReaderConvert.ReaderToModel <HelpBargainDetialInfo>(reader)); } }
public bool InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial) { string query = "insert into Hishop_HelpBargainDetial(BargainDetialId,UserId,BargainPrice,CreateDate,BargainId) values(@BargainDetialId,@UserId,@BargainPrice,@CreateDate,@BargainId)"; DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); this.database.AddInParameter(sqlStringCommand, "BargainDetialId", DbType.Int32, helpBargainDetial.BargainDetialId); this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, helpBargainDetial.UserId); this.database.AddInParameter(sqlStringCommand, "BargainPrice", DbType.Decimal, helpBargainDetial.BargainPrice); this.database.AddInParameter(sqlStringCommand, "CreateDate", DbType.DateTime, helpBargainDetial.CreateDate); this.database.AddInParameter(sqlStringCommand, "BargainId", DbType.Int32, helpBargainDetial.BargainId); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public HelpBargainDetialInfo GeHelpBargainDetialInfo(int bargainDetialId, int userId) { HelpBargainDetialInfo result = new HelpBargainDetialInfo(); System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_HelpBargainDetial WHERE BargainDetialId = @BargainDetialId and UserId=@UserId"); this.database.AddInParameter(sqlStringCommand, "BargainDetialId", System.Data.DbType.Int32, bargainDetialId); this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.Int32, userId); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToModel <HelpBargainDetialInfo>(dataReader); } return(result); }
public static string InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial) { string str2 = new BargainDao().IsCanBuyByBarginId(helpBargainDetial.BargainId); if (str2 != "1") { return(str2); } if (new BargainDao().InsertHelpBargainDetial(helpBargainDetial)) { new BargainDao().UpdateBargainDetial(helpBargainDetial); } return("1"); }
public static string InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial) { string result = string.Empty; string text = new BargainDao().IsCanBuyByBarginId(helpBargainDetial.BargainId); if (text != "1") { result = text; } else { if (new BargainDao().InsertHelpBargainDetial(helpBargainDetial)) { new BargainDao().UpdateBargainDetial(helpBargainDetial); } result = "1"; } return(result); }
public static string InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial) { string empty = string.Empty; string str = (new BargainDao()).IsCanBuyByBarginId(helpBargainDetial.BargainId); if (!(str != "1")) { if ((new BargainDao()).InsertHelpBargainDetial(helpBargainDetial)) { (new BargainDao()).UpdateBargainDetial(helpBargainDetial); } empty = "1"; } else { empty = str; } return(empty); }
public static bool ExistsHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial) { return(new BargainDao().ExistsHelpBargainDetial(helpBargainDetial)); }
public static bool UpdateBargainDetial(HelpBargainDetialInfo helpBargainDetial) { return(new BargainDao().UpdateBargainDetial(helpBargainDetial)); }