int IPetCalculator.CalculateSpeed(PetBreed breed, PetQuality quality, int baseValue, int level) { var breedMultiplier = SpeedMultipliers[breed]; var qualityMultiplier = QualityMultipliers[quality]; return((int)Math.Ceiling((baseValue + breedMultiplier / 10m) * level * qualityMultiplier)); }
public void DeletePetBreed(PetBreed breed) { if (breed == null) throw new ArgumentNullException("breed"); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_DeletePetBreed", connection) { CommandType = System.Data.CommandType.StoredProcedure }; command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@ID", SqlDbType = SqlDbType.UniqueIdentifier, SqlValue = breed.ID }); command.ExecuteNonQuery(); } }
public void DeletePetBreed(PetBreed breed) { if (breed == null) { throw new ArgumentNullException("breed"); } using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_DeletePetBreed", connection) { CommandType = System.Data.CommandType.StoredProcedure }; command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@ID", SqlDbType = SqlDbType.UniqueIdentifier, SqlValue = breed.ID }); command.ExecuteNonQuery(); } }
public ActionResult GetBreeds(Guid animalId) { var breeds = from breed in PetBreed.GetBreeds(null, animalId, null) orderby breed.Name ascending select new { value = breed.ID, text = breed.Name }; return(Json(breeds, JsonRequestBehavior.AllowGet)); }
public PetAnimal(string name = "Unknow", PetBreed petBreed = null, PetCharacteristics petCharacteristics = null) { Name = name; PetCharacteristics = petCharacteristics ?? new(); PetBreed = petBreed ?? new(DefaultPetBreed.Id); }
public void InsertPetBreed(PetBreed breed) { if (breed == null) { throw new ArgumentNullException("breed"); } using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_InsertPetBreed", connection) { CommandType = System.Data.CommandType.StoredProcedure }; FillCommand(command, breed); command.ExecuteNonQuery(); } }
internal void DeletePetBreed(PetBreed breed) { container.Resolve<IPetMatchRepository>().DeletePetBreed(breed); }
internal void InsertPetBreed(PetBreed breed) { container.Resolve<IPetMatchRepository>().InsertPetBreed(breed); }
public void Update(PetBreed petBreed) { _petBreedDal.Update(petBreed); }
public void Add(PetBreed petBreed) { _petBreedDal.Add(petBreed); }
private void FillCommand(SqlCommand command, PetBreed breed) { command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@ID", SqlDbType = SqlDbType.UniqueIdentifier, SqlValue = breed.ID }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@Name", SqlDbType = SqlDbType.NVarChar, Size = 100, SqlValue = breed.Name }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@DateCreated", SqlDbType = SqlDbType.DateTime, SqlValue = breed.DateCreated }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@CreatedBy", SqlDbType = SqlDbType.NVarChar, Size = 512, SqlValue = breed.CreatedBy }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@LastUpdated", SqlDbType = SqlDbType.DateTime, SqlValue = breed.LastUpdated }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@LastUpdatedBy", SqlDbType = SqlDbType.NVarChar, Size = 512, SqlValue = breed.LastUpdatedBy }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@Visible", SqlDbType = SqlDbType.Bit, SqlValue = breed.Visible }); }
public void UpdatePetBreed(PetBreed breed) { if (breed == null) throw new ArgumentNullException("breed"); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_UpdatePetBreed", connection) { CommandType = System.Data.CommandType.StoredProcedure }; FillCommand(command, breed); command.ExecuteNonQuery(); } }