public void InsertDeadAnimals(Animalpar model) { int num = 0; foreach (var b in batches.GetAll()) { if (model.AniCode.Substring(0, 2) == model.BatchTypeDesc.Substring(0, 2)) { num = b.NumOfAnimals - 1; } } using (var x = new DeadAnimalRepository()) { var deadAnimals = new DeadAnimal { AnimalId = model.AnimalId, AniCode = model.AniCode, BatchTypeid = bat.GetAll().Find(y => y.BatchTypeDesc == model.BatchTypeDesc).BatchTypeid, AniColor = model.AniColor, AniFeedingStatus = model.AniFeedingStatus, AniAge = model.AniAge, AniGender = model.AniGender, AniHealthStatus = "Dead", AniCurrentCost = model.AniCurrentCost, AniSaleStatus = model.AniSaleStatus, AniTotCost = 0, AnimalValue = 0, //deathCause = model.deathCause, }; x.Insert(deadAnimals); } }
public void DeadAnimalDetails(DeadAnimalView model) { using (var animal = new DeadAnimalRepository()) { DeadAnimal ani = animal.GetById(model.AnimalId); } }
private void OnTick(object sender, EventArgs e) { string[] strings = { "Bad Pelt", "Good Pelt", "Rare Pelt", "Perfect Pelt", "Legendary Pelt" }; Random random = new Random(); string randomString = strings[random.Next(0, strings.Length)]; foreach (var DeadAnimal in World.GetNearbyPeds(Game.Player.Character.Position, 30f)) { if (Function.Call <bool>(Hash.IS_ENTITY_TOUCHING_ENTITY, Game.Player.Character, DeadAnimal)) { if (DeadAnimal.Exists() && DeadAnimal.IsDead && !DeadAnimal.IsHuman && !SkinnedAnimals.Contains(DeadAnimal)) { TextBox("Press ~INPUT_CONTEXT~ to skin this animal.", true); if (Game.IsControlJustPressed(2, Control.Context)) { Function.Call(Hash.REQUEST_ANIM_DICT, "missarmenian3_gardener"); Wait(200); Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "missarmenian3_gardener", "idle_a", 4f, 0f, 3200, 0, 4f, 0, 0); Wait(2000); Function.Call(Hash.STOP_ANIM_TASK, Game.Player.Character, "missarmenian3_gardener", "idle_a", 0); SkinnedAnimals.Add(DeadAnimal); if (randomString == "Bad Pelt") { TextBox("You got a: ~r~" + randomString, true); } else if (randomString == "Good Pelt") { TextBox("You got a: ~g~" + randomString, true); } else if (randomString == "Rare Pelt") { TextBox("You got a: ~b~" + randomString, true); } else { TextBox("You got a: ~y~" + randomString, true); } SkinnedPelts.Add(randomString); HasGoToButcherTextDisplayed = false; Wait(3000); if (!HasGoToButcherTextDisplayed) { TextBox("Go to the ~y~Butcher's ~w~located on your map to sell your pelts.", true); HasGoToButcherTextDisplayed = true; } } } } if (!DeadAnimal.Exists()) { SkinnedAnimals.Remove(DeadAnimal); // Delete ped from list when they no longer exist. } } }
public void DeleteDeadAnimals(int id) { using (var deadAnimal = new DeadAnimalRepository()) { DeadAnimal anima = deadAnimal.GetById(id); if (anima != null) { deadAnimal.Delete(anima); } } }
public void UpdateDeadAnimals(Animalpar model) { using (var animal = new DeadAnimalRepository()) { DeadAnimal ani = animal.GetById(model.AnimalId); if (ani != null) { ani.AnimalId = model.AnimalId; ani.AniCode = model.AniCode; //ani.b = model.BatchTypeDesc; ani.AniColor = model.AniColor; ani.AniFeedingStatus = model.AniFeedingStatus; ani.AniAge = model.AniAge; ani.AniGender = model.AniGender; ani.AniHealthStatus = model.AniHealthStatus; ani.AniCurrentCost = model.AniCurrentCost; ani.AniSaleStatus = model.AniSaleStatus; ani.AniTotCost = model.AniTotCost; ani.AnimalValue = model.AnimalValue; animal.Update(ani); } } }
public Animalpar GetDeadById(int id) { using (var animal = new DeadAnimalRepository()) { DeadAnimal ani = animal.GetById(id); var anView = new Animalpar(); if (ani != null) { anView.AnimalId = ani.AnimalId; anView.AniCode = ani.AniCode; anView.BatchTypeDesc = bat.GetAll().Find(y => y.BatchTypeid == ani.BatchTypeid).BatchTypeDesc; anView.AniColor = ani.AniColor; anView.AniFeedingStatus = ani.AniFeedingStatus; anView.AniAge = ani.AniAge; anView.AniGender = ani.AniGender; anView.AniHealthStatus = ani.AniHealthStatus; anView.AniCurrentCost = ani.AniCurrentCost; anView.AniSaleStatus = ani.AniSaleStatus; anView.AniTotCost = ani.AniTotCost; anView.AnimalValue = ani.AnimalValue; } return(anView); } }
public void Delete(DeadAnimal model) { _deadAnimalRepository.Delete(model); }
public void Update(DeadAnimal model) { _deadAnimalRepository.Update(model); }
public void Insert(DeadAnimal model) { _deadAnimalRepository.Insert(model); }