public static void AddNewSkladStorage(string NameFaction) { const int Pistols = 1000; const int Rifle = 1000; const int SMG = 1500; const int Shotgun = 2500; const int Melee = 2500; const int Armor = 2500; const int Medicals = 2500; switch (NameFaction) { case "Start": Dictionary <string, string> parametersStatr = new Dictionary <string, string> { { "@NameFaction", NameFaction }, { "@Pistols", Pistols.ToString() }, { "@Rifle", Rifle.ToString() }, { "@SMG", SMG.ToString() }, { "@Shotgun", Shotgun.ToString() }, { "@Melee", Melee.ToString() }, { "@Armor", Armor.ToString() }, { "@Medicals", Medicals.ToString() } }; DataTable resultStatr = Database.ExecutePreparedStatement("INSERT INTO sklad_faction_storages (NameFaction, Pistols, Rifle, SMG, Shotgun, Melee, Armor, Medicals) " + DatabaseValues, parametersStatr); break; } }
public void DeleteFromDataBaseUnitTest() { //Arrange DatabaseContext db = new DatabaseContext(); db.Database.Migrate(); int ExpectedPostDeletedCount = 1; int ActualPostDeletedCount; //Act var TestItem = new Pistols { Image = "https://upload.wikimedia.org/wikipedia/commons/6/61/M9-pistolet.jpg", ModelName = "M9", Manufacturer = "Beretta", StartService = "1985", EndService = "Present", Designed = "1980", StartProduction = "1990", EndProduction = "Present", Weight = 0.97, Length = 217, BarrelLength = 125, Cartridge = "9x19mm Parabellum", Action = "Short Recoil", MuzzleVelocity = 381, EffectiveRange = 100, MaxRange = 200, FeedSystem = "15-round detachable box magazine", Sights = "Iron sights" }; var TestItem2 = new Howitzers { Image = "https://upload.wikimedia.org/wikipedia/commons/1/1b/M777_Light_Towed_Howitzer_1.jpg", ModelName = "M777", Manufacturer = "BAE Systems", StartService = "2005", EndService = "Present", Designed = "2000s", StartProduction = "2002", EndProduction = "Present", Shell = "M107 155mm HE", Weight = 4200, Length = 10.7, BarrelLength = 5.08, Carriage = "Split Trail", Crew = 8, MinimumElevation = 0, MaximumElevation = 71.7, RateOfFire = 5 }; DatabaseHelper.InsertItem(TestItem, "Small Arms", "Pistols"); DatabaseHelper.InsertItem(TestItem2, "Artillery", "Howitzers"); db.SaveChanges(); var FirstItem = db.SmallArms.First(); DatabaseHelper.DeleteItem(FirstItem); db.SaveChanges(); ActualPostDeletedCount = db.SmallArms.Count(); //Assert Assert.AreEqual(ExpectedPostDeletedCount, ActualPostDeletedCount); }
void Awake() { pistols = this.GetComponent <Pistols>(); //Pistols Panel PistolsPanel = GameObject.Find(PistolsPanelPath); //Pistols Button PistolsButton = GameObject.Find(PistolsButtonPath).GetComponent <Button>(); PistolsButton.onClick.AddListener(() => PistolsControls()); }
public void AddToDataBaseUnitTest() { //Arrange DatabaseContext db = new DatabaseContext(); db.Database.Migrate(); Pistols TestItem = null; int ExpectedPostAddedCount = 1; int ActualPostAddedCount; //Act TestItem = new Pistols { Image = "https://upload.wikimedia.org/wikipedia/commons/6/61/M9-pistolet.jpg", ModelName = "M9", Manufacturer = "Beretta", StartService = "1985", EndService = "Present", Designed = "1980", StartProduction = "1990", EndProduction = "Present", Weight = 0.97, Length = 217, BarrelLength = 125, Cartridge = "9x19mm Parabellum", Action = "Short Recoil", MuzzleVelocity = 381, EffectiveRange = 100, MaxRange = 200, FeedSystem = "15-round detachable box magazine", Sights = "Iron sights" }; DatabaseHelper.InsertItem(TestItem, "Small Arms", "Pistols"); db.SaveChanges(); ActualPostAddedCount = db.SmallArms.Count(); //Assert Assert.AreEqual(ExpectedPostAddedCount, ActualPostAddedCount); }
// Implementation in Homework5 private static void Homework5() { Pistols myPistol = new Pistols("Beretta", 45); Pistols.ShootPistol thePistol = myPistol.ShootAPistol; thePistol(" I shot a " + myPistol.PistolBrand + " at a caliber of " + myPistol.PistolCaliber); Pistols mySecond = new Pistols(); Pistols morePistols = new Pistols(45); Pistols.ShootPistol somePistols, policePistol, shotGunPistol; policePistol = morePistols.PolicePistol; policePistol("Glock"); shotGunPistol = morePistols.ShotGunPistol; shotGunPistol("The Judge"); somePistols = policePistol + shotGunPistol; somePistols("Cool"); }
internal static void AddSA(object Item, string SType) { using (var db = new DatabaseContext()) { switch (SType) { case "AntiMaterial": AntiMaterial tempAM = new AntiMaterial(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempAM, x.GetValue(Item)); } db.SmallArms.Add(tempAM); break; case "DMRSniperRifles": DMRSniperRifles tempDSR = new DMRSniperRifles(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempDSR, x.GetValue(Item)); } db.SmallArms.Add(tempDSR); break; case "MachineGuns": MachineGuns tempMG = new MachineGuns(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempMG, x.GetValue(Item)); } db.SmallArms.Add(tempMG); break; case "Pistols": Pistols tempP = new Pistols(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempP, x.GetValue(Item)); } db.SmallArms.Add(tempP); break; case "RiflesAndCarbines": RiflesAndCarbines tempRAC = new RiflesAndCarbines(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempRAC, x.GetValue(Item)); } db.SmallArms.Add(tempRAC); break; case "Shotguns": Shotguns tempSh = new Shotguns(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempSh, x.GetValue(Item)); } db.SmallArms.Add(tempSh); break; case "SubmachineGuns": SubmachineGuns tempSMG = new SubmachineGuns(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempSMG, x.GetValue(Item)); } db.SmallArms.Add(tempSMG); break; } db.SaveChanges(); } }