public void Insert(BetAutoDropWater drop) { string sql = string.Format(@"INSERT INTO {0} ({1},{2},{3},{4}) VALUES (@{1},@{2},@{3},@{4}) SELECT SCOPE_IDENTITY()", BetAutoDropWater.TABLENAME, BetAutoDropWater.COMPANYTYPEID, BetAutoDropWater.GAMEPLAYWAYID, BetAutoDropWater.AMOUNT, BetAutoDropWater.DROPVALUE); object id = base.ExecuteScalar(sql, new SqlParameter(BetAutoDropWater.COMPANYTYPEID, drop.CompanyTypeId), new SqlParameter(BetAutoDropWater.GAMEPLAYWAYID, drop.GamePlayWayId), new SqlParameter(BetAutoDropWater.AMOUNT, drop.Amount), new SqlParameter(BetAutoDropWater.DROPVALUE, drop.DropValue)); drop.BetDropId = Convert.ToInt32(id); }
public void AddBetAutoDrop(CompanyType companyType, int gameplaywayId, decimal amount, double dropValue) { if (DaAutoDrop.GetDrops(companyType, gameplaywayId, amount).Count() > 0) throw new BusinessException(Resource.AlreadyExist); BetAutoDropWater drop = new BetAutoDropWater { CompanyType = companyType, GamePlayWayId = gameplaywayId, Amount = amount, DropValue = dropValue }; DaAutoDrop.Insert(drop); }