/// <summary> /// Instantiates a SalesQuote object with defined vehicle sale price, trade0in amount, and sales tax rate. /// </summary> /// <param name="vehicleSalePrice">Sale price of vehicle.</param> /// <param name="tradeInAmount">Amount paid to be subtracted in total cost.</param> /// <param name="salesTaxRate">Tax rate applied to subtotal.</param> /// <exception cref="ArgumentOutOfRangeException">When the vehicle sale price is less than or equal to 0. </exception> /// <exception cref="ArgumentOutOfRangeException">When the trade in amount is less than 0. </exception> /// <exception cref="ArgumentOutOfRangeException">When the sales tax rate is either less than 0 or greater than 1. </exception> public SalesQuote(decimal vehicleSalePrice, decimal tradeInAmount, decimal salesTaxRate) { if (vehicleSalePrice <= 0) { throw new ArgumentOutOfRangeException("vehicleSalePrice", "The value cannot be less than or equal to 0."); } _vehicleSalePrice = vehicleSalePrice; if (tradeInAmount < 0) { throw new ArgumentOutOfRangeException("tradeInAmount", "The value cannot be less than 0."); } _tradeInAmount = tradeInAmount; if (salesTaxRate < 0) { throw new ArgumentOutOfRangeException("salesTaxRate", "The value cannot be less than 0."); } else if (salesTaxRate > 1) { throw new ArgumentOutOfRangeException("salesTaxRate", "The value cannot be greater than 1."); } _salesTaxRate = salesTaxRate; _accessoriesChosen = Accessories.None; _exteriorFinishChosen = ExteriorFinish.None; }
private string OneDataValue(string value, DataColumn c) { switch (c.DataType.ToString().Replace("System.", "")) { case "String": case "DateTime": case "Guid": return(String.Format("'{0}'", Accessories.DbQuote(value))); case "Byte": case "Int8": case "Int16": case "Int32": case "Int64": case "Single": case "Double": case "Decimal": { string v = value; if (String.IsNullOrEmpty(v)) { v = "null"; } return(String.Format("{0}", v)); } case "Boolean": return(DataConvert.IsNull(value) ? "null" : DataConvert.ToBoolean(value) ? "1" : "0"); default: throw new ArgumentOutOfRangeException("unsupport type: " + c.ToString()); } }
/// <summary> /// Initializes an instance of SalesQuote with a vehicle price, trade-in value, sales tax rate, accessories chosen and exterior finish chosen. /// </summary> /// <param name="vehicleSalePrice">The selling price of the vehicle being sold.</param> /// <param name="tradeInAmount">The amount offered to the customer for the trade in of their vehicle.</param> /// <param name="salesTaxRate">The tax rate applied to the sale of a vehicle.</param> /// <param name="accessoriesChosen">The value of the chosen accessories.</param> /// <param name="exteriorFinishChosen">The value of the chosen exterior finish.</param> /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the vehicle sale price is less than or equal to 0.</exception> /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the trade in amount is less than 0.</exception> /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the sales tax rate is less than 0.</exception> /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the sales tax rate is greater than 1.</exception> public SalesQuote(decimal vehicleSalePrice, decimal tradeInAmount, decimal salesTaxRate, Accessories accessoriesChosen, ExteriorFinish exteriorFinishChosen) { if (vehicleSalePrice <= 0) { throw new ArgumentOutOfRangeException("vehicleSalePrice", "The argument cannot be less than or equal to 0."); } if (tradeInAmount < 0) { throw new ArgumentOutOfRangeException("tradeInAmount", "The argument cannot be less than 0."); } if (salesTaxRate < 0) { throw new ArgumentOutOfRangeException("salesTaxRate", "The argument cannot be less than 0."); } if (salesTaxRate > 1) { throw new ArgumentOutOfRangeException("salesTaxRate", "The argument cannot be greater than 1."); } this.vehicleSalePrice = vehicleSalePrice; this.tradeInAmount = tradeInAmount; this.salesTaxRate = salesTaxRate; this.accessoriesChosen = accessoriesChosen; this.exteriorFinishChosen = exteriorFinishChosen; }
void Awake() { //weapon = GetComponentInChildren<Weapon>(); //weapon = transform.Find("Sword").GetComponent<Weapon>(); armor = GetComponentInChildren <Armor>(); acc = GetComponentInChildren <Accessories>(); }
/// <summary> /// Generate a CREATE TABLE statement /// </summary> /// <param name="tablename"></param> /// <param name="dt"></param> /// <returns></returns> public string CreateTableStatement(string tablename, System.Data.DataTable dt) { var result = new StringBuilder(); string[] primaryColumns = Accessories.GetPrimaryColumns(dt); result.AppendFormat("create table [{1}] ({0}", crlf, tablename); for (int i = 0; i < dt.Columns.Count; i++) { if (i > 0) { result.Append(crlf + ","); } DataColumn c = dt.Columns[i]; result.AppendFormat("{0}", OneDataColumn(c)); if (StringUtil.Search(primaryColumns, c.ColumnName) >= 0) { result.AppendFormat("eger primary key", tablename, c.ColumnName); } } result.AppendFormat(");"); return(result.ToString()); }
public async Task <IActionResult> Edit(int id, [Bind("ID, Name, Discount, PicturePath, AnimalId")] Accessories accessories) { if (id != accessories.ID) { return(NotFound()); } if (!ModelState.IsValid) { return(View(accessories)); } try { await _accessoriesRepository.Update(accessories); } catch (DbUpdateConcurrencyException) { if (!_accessoriesRepository.Exists(accessories.ID)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); }
public void VerifyToolbarElementsAccessoryPageGen() { CPQNavigate.NavigateToAccessoriesPage(Brand.GEN, ModelPageUrl.GENERAL_1000_EPS_BASE_TEST); Accessories.WaitForAccessoriesPageToLoad(); Assert.IsTrue(Accessories.Toolbar.IsToolbarDisplayed(), "Toolbar was not displayed"); Accessories.VerifyToolbarIconsAreEnabled(); }
public void SalesQuote_Test() { decimal vehicleSalePrice = 0.1M; decimal tradeInAmount = 0.2M; decimal salesTaxRate = 0.1M; Accessories accessoriesChosen = new Accessories(); ExteriorFinish exteriorFinishChosen = new ExteriorFinish(); SalesQuote salesQuote = new SalesQuote(vehicleSalePrice, tradeInAmount, salesTaxRate, accessoriesChosen, exteriorFinishChosen); decimal expectedVehicleSalePrice = 0.1M; decimal expectedTradeInAmount = 0.2M; decimal expectedSalesTaxRate = 0.1M; Accessories expectedAccessoriesChosen = new Accessories(); ExteriorFinish expectedExteriorFinishChosen = new ExteriorFinish(); PrivateObject target = new PrivateObject(salesQuote); decimal actualVehicleSalePrice = (decimal)target.GetField("vehicleSalePrice"); decimal actualTradeInAmount = (decimal)target.GetField("tradeInAmount"); decimal actualSalesTaxRate = (decimal)target.GetField("salesTaxRate"); Accessories actualAccessoriesChosen = (Accessories)target.GetField("accessoriesChosen"); ExteriorFinish actualExteriorFinishChosen = (ExteriorFinish)target.GetField("exteriorFinishChosen"); Assert.AreEqual(expectedSalesTaxRate, actualSalesTaxRate); Assert.AreEqual(expectedTradeInAmount, actualTradeInAmount); Assert.AreEqual(expectedVehicleSalePrice, actualVehicleSalePrice); Assert.AreEqual(expectedAccessoriesChosen, actualAccessoriesChosen); Assert.AreEqual(expectedExteriorFinishChosen, actualExteriorFinishChosen); }
static void Main(string[] args) { // 苹果手机 Phone phone = new ApplePhone(); // 苹果手机贴膜 Decorator applePhoneWithSticker = new Sticker(phone); // 扩展贴膜行为 applePhoneWithSticker.Print(); Console.WriteLine("————————————"); // 苹果手机挂件 Decorator applePhoneWithAccessories = new Accessories(phone); // 扩展手机挂件行为 applePhoneWithAccessories.Print(); Console.WriteLine("————————————"); // 同时贴膜和手机挂件 Sticker sticker = new Sticker(phone); Accessories applePhoneWithAccessoriesAndSticker = new Accessories(sticker); applePhoneWithAccessoriesAndSticker.Print(); Console.ReadLine(); }
public async Task <IActionResult> PutAccessories(int id, Accessories accessories) { if (id != accessories.Id) { return(BadRequest()); } _context.Entry(accessories).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccessoriesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Accessories> > PostAccessories(Accessories accessories) { _context.Accessories.Add(accessories); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAccessories", new { id = accessories.Id }, accessories)); }
public void ResetWithHome(HMHome home) { Accessories.Clear(); Accessories.AddRange(home.Accessories); Accessories.SortByLocalizedName(a => a.Name); Rooms.Clear(); Rooms.AddRange(home.GetAllRooms()); Rooms.SortByLocalizedName(r => r.Name); Zones.Clear(); Zones.AddRange(home.Zones); Zones.SortByLocalizedName(z => z.Name); ActionSets.Clear(); ActionSets.AddRange(home.ActionSets); ActionSets.SortByTypeAndLocalizedName(); Triggers.Clear(); Triggers.AddRange(home.Triggers); Triggers.SortByLocalizedName(t => t.Name); ServiceGroups.Clear(); ServiceGroups.AddRange(home.ServiceGroups); ServiceGroups.SortByLocalizedName(sg => sg.Name); }
public NSIndexPath Remove(HMAccessory accessory) { var indexPath = IndexPathOfObject(accessory); Accessories.RemoveAt(indexPath.Row); return(indexPath); }
public void StartDisplay(TravelOffer lastTravel) { _currentOffer = lastTravel; try { InitializeComponent(); InitList(); var helper = KinectHelper.Instance; helper.ReadyEvent += (s, _) => HelperReady(); GreenScreen.Start(helper.Sensor, false); SetNewHat(); Accessories.Start(helper.Sensor); RectNavigationControl.Start(helper.Sensor); RectNavigationControl.SwipeLeftEvent += SwipeLeft; RectNavigationControl.SwipeRightEvent += SwipeRight; RectNavigationControl.SwipeUpEvent += SwipeUp; RectNavigationControl.SwipeDownEvent += SwipeDown; RectNavigationControl.NoSwipe += NoSwipe; string[] texts = MyTextLoopList.GetNeighbourTexts(); RectNavigationControl.SetTopText(texts[0]); RectNavigationControl.SetBottomText(texts[1]); InitGenderDetection(); } catch (Exception exc) { ExceptionTextBlock.Text = exc.Message + "\r\n" + exc.InnerException + "\r\n" + exc.StackTrace; } }
public CarFacade() { accessories = new Accessories(); body = new Body(); engine = new Engine(); model = new Model(); }
public void VerifyToolbarElementsAccessoryPageAtv() { CPQNavigate.NavigateToAccessoriesPage(Brand.ATV, ModelPageUrl.ATV_450_HO_BASE_TEST); Accessories.WaitForAccessoriesPageToLoad(); Assert.IsTrue(Accessories.Toolbar.IsToolbarDisplayed(), "Toolbar was not displayed"); Accessories.VerifyToolbarIconsAreEnabled(); }
/* * 以手机这个对象,对其实现贴膜和加挂件装饰品 等额外功能的拓展 */ static void Main(string[] args) { Phone phone = new ApplePhone(); //现在想贴膜了 Decorator applePhoneWithSticker = new Sticker(phone); //拓展贴膜行为 applePhoneWithSticker.Print(); Console.WriteLine("---------------------------\n"); //现在我想要挂件了 Decorator applePhoneWithAccessories = new Accessories(phone); //拓展挂件行为 applePhoneWithAccessories.Print(); Console.WriteLine("---------------------------\n"); //现在想贴膜了 Sticker sticker = new Sticker(phone); //现在想要挂件了 Accessories applePhoneWithAccessoriesAndSticker = new Accessories(sticker); //拓展贴膜行为和挂件行为 applePhoneWithAccessoriesAndSticker.Print(); Console.ReadLine(); }
public ActionResult DeleteConfirmed(int id) { Accessories accessories = db.Accessories.Find(id); db.Accessories.Remove(accessories); db.SaveChanges(); return RedirectToAction("Index"); }
public void Constructor_VehicleSalesPrice_TradeInAmount_SalesTaxRate_Accessories_Finish_Test() { //Arrange decimal vehicleSalesPrice = 10000; decimal tradeInAmount = 2000; decimal salesTaxRate = 0.1m; Accessories accessories = Accessories.LeatherInterior; ExteriorFinish finish = ExteriorFinish.Custom; SalesQuote salesQuote = new SalesQuote(vehicleSalesPrice, tradeInAmount, salesTaxRate, accessories, finish); PrivateObject target = new PrivateObject(salesQuote); //Act decimal expectedVehicleSalesPrice = 10000; decimal expectedTradeInAmount = 2000; decimal expectedSalesTaxRate = 0.1m; Accessories expectedAccessories = Accessories.LeatherInterior; ExteriorFinish expectedFinish = ExteriorFinish.Custom; decimal actualVehicleSalesPrice = (decimal)target.GetField("vehicleSalesPrice"); decimal actualTradeInAmount = (decimal)target.GetField("tradeInAmount"); Accessories actualAccessories = (Accessories)target.GetField("accessoriesChosen"); ExteriorFinish actualFinish = (ExteriorFinish)target.GetField("exteriorFinishChosen"); decimal actualSalesRate = 0.1m; //Assert Assert.AreEqual(expectedVehicleSalesPrice, actualVehicleSalesPrice); Assert.AreEqual(expectedTradeInAmount, actualTradeInAmount); Assert.AreEqual(expectedAccessories, actualAccessories); Assert.AreEqual(expectedFinish, actualFinish); Assert.AreEqual(expectedSalesTaxRate, actualSalesRate); }
/// <summary> /// set the accessor chosen /// </summary> private Accessories accessoriesCheckBox() { Accessories accessoriesChoose = Accessories.None; if (chkComputerNavigation.Checked) { accessoriesChoose = Accessories.ComputerNavigation; } if (chkLeatherInterior.Checked) { accessoriesChoose = Accessories.LeatherInterior; } if (chkStereoSystem.Checked) { accessoriesChoose = Accessories.StereoSystem; } if (chkStereoSystem.Checked && chkLeatherInterior.Checked) { accessoriesChoose = Accessories.StereoAndLeather; } if (chkStereoSystem.Checked && chkComputerNavigation.Checked) { accessoriesChoose = Accessories.StereoAndNavigation; } if (chkLeatherInterior.Checked && chkComputerNavigation.Checked) { accessoriesChoose = Accessories.LeatherAndNavigation; } if (chkLeatherInterior.Checked && chkComputerNavigation.Checked && chkStereoSystem.Checked) { accessoriesChoose = Accessories.All; } return(accessoriesChoose); }
public void VerifySnowCheckBuilds() { List <string> snowBuildUrls = ApiDataProvider.GetBuildUrls(Brand.SNO, YEAR, DEALER); var urls = string.Empty; foreach (var item in snowBuildUrls) { urls += item + "\n"; } foreach (var buildUrl in snowBuildUrls) { CPQNavigate.GoToUrl(buildUrl); Colors.WaitForChooseColorTitleToDisplay(); Colors.FooterModule.ClickFooterNextButton(); Options.SelectRandomOptionsUntilAccessories(); Accessories.ClikIamFinishedButton(); Quote.FillQuoteFormDefaultData(); Quote.ClickGetInternetPriceButton(); Confirmation.WaitUntilConfirmationPageLoads(); Assert.IsTrue(Confirmation.IsBuildSummaryHeaderDisplayed(), "Confrimation page header is not displayed"); Assert.IsTrue(Confirmation.IsOptionsSectionDisplayed(), "Accessories/Options section is not displayed"); Confirmation.VerifyConfirmationModelNameMatcUrlModel(buildUrl); } }
/// <summary> /// Generate a CREATE TABLE statement /// </summary> /// <param name="tablename"></param> /// <param name="dt"></param> /// <returns></returns> public string CreateTableStatement(string tablename, System.Data.DataTable dt) { StringBuilder result = new StringBuilder(); string[] primaryColumns = Accessories.GetPrimaryColumns(dt); result.AppendFormat("create table [{1}] ({0}", crlf, tablename); for (int i = 0; i < dt.Columns.Count; i++) { if (i > 0) { result.Append(crlf + ","); } DataColumn c = dt.Columns[i]; result.AppendFormat("{0}", OneDataColumn(c)); if (StringUtil.Search(primaryColumns, c.ColumnName) >= 0) { result.AppendFormat(" identity(1,1)", tablename, c.ColumnName); } } // TODO: insert primary key constraint code here... if (primaryColumns.Length > 0) { result.Append(CreatePrimaryColumn(primaryColumns, tablename)); result.Append(") ON [PRIMARY];"); } else { result.AppendFormat(");"); } return(result.ToString()); }
public Module_Answer_AddServer(Module_Answer m) { mainPageLocation = new Configurable() { Name = "WebPagePath", ReadableName = "Path to webpage for Adding new entries to DB", Parent = m }; port = new Configurable() { Name = "webPort", ReadableName = "Web-server Port", DefaultValue = "80", Parent = m }; m.Configurables.Add(mainPageLocation); m.Configurables.Add(port); mainPage = Accessories.ReadFileToString(mainPageLocation.Value); try { http = new HttpListener(); http.Prefixes.Add("http://*:" + port.Value + "/"); http.Start(); } catch (Exception e) { InformationCollector.Error(http, e.Message); } thread = new Thread(Listen); thread.Start(); dbPath = m.db_filename.Value; }
public void SetTradeInAmountSpecial_Test() { //Arrange decimal vehicleSalesPrice = 10000; decimal tradeInAmount = 2000; decimal salesTaxRate = 0.1m; Accessories accessories = Accessories.LeatherInterior; ExteriorFinish finish = ExteriorFinish.Custom; SalesQuote salesQuote = new SalesQuote(vehicleSalesPrice, tradeInAmount, salesTaxRate, accessories, finish); //Act decimal expcetedTradeInAmount = 2000; //Assert try { salesQuote.TradeInAmount = -1000; Assert.Fail("Did not throw ArgumentOutOfRangeException as expected."); } catch (ArgumentOutOfRangeException) { PrivateObject abc = new PrivateObject(salesQuote); decimal actualTradeInAmount = (decimal)abc.GetField("tradeInAmount"); Assert.AreEqual(expcetedTradeInAmount, actualTradeInAmount); } }
static void Main(string[] args) { { Nomenklatura gitara_nomenklatura = new Nomenklatura("gitara", new DateTime(2018, 02, 05)); Nomenklatura skripka_nomenklatura = new Nomenklatura("skripka", new DateTime(2018, 01, 28)); Nomenklatura mediator_nomenklatura = new Nomenklatura("Mediator", new DateTime(2018, 01, 28)); Nomenklatura baraban_nomenklatura = new Nomenklatura("baraban", new DateTime(2016, 09, 10)); Nomenklatura piano_nomenklatura = new Nomenklatura("piano", new DateTime(2017, 10, 10)); Gitara tovar1 = new Gitara(gitara_nomenklatura, "electric_guitar", "YAMAHA", 15000, new DateTime(2015, 03, 07)); Skripka tovar2 = new Skripka(skripka_nomenklatura, "Crafter", 1, 50000, new DateTime(2017, 05, 08)); Baraban tovar3 = new Baraban(baraban_nomenklatura, "YAMAHA", "wood - leather", 7000, new DateTime(2016, 09, 10)); Piano tovar4 = new Piano(piano_nomenklatura, "C.Bechstein", "wood", 80000, new DateTime(2017, 10, 10)); Accessories tovar5 = new Accessories(mediator_nomenklatura, "Mediator", 100, gitara_nomenklatura); List <Tovar> ListTovar = new List <Tovar>(); ListTovar.Add(tovar1); ListTovar.Add(tovar2); ListTovar.Add(tovar3); ListTovar.Add(tovar4); ListTovar.Add(tovar5); Console.WriteLine("Введите название товара:"); string userChoise = Console.ReadLine(); foreach (Tovar t in ListTovar.Where(i1 => i1.ID.Name == userChoise)) { Console.WriteLine(t.tv()); } Console.ReadLine(); } }
static void Main(string[] args) { Nomenklatura gitara_nomenklatura = new Nomenklatura("gitara", new DateTime(2018, 02, 05)); Nomenklatura skripka_nomenklatura = new Nomenklatura("skripka", new DateTime(2018, 01, 28)); Nomenklatura mediator_nomenklatura = new Nomenklatura("Mediator", new DateTime(2018, 01, 28)); Nomenklatura baraban_nomenklatura = new Nomenklatura("baraban", new DateTime(2016, 09, 10)); Nomenklatura piano_nomenklatura = new Nomenklatura("piano", new DateTime(2017, 10, 10)); Gitara tovar1 = new Gitara(gitara_nomenklatura, "electric_guitar", "YAMAHA", 15000, new DateTime(2015, 03, 07)); Skripka tovar2 = new Skripka(skripka_nomenklatura, "Crafter", 1, 50000, new DateTime(2017, 05, 08)); Baraban tovar3 = new Baraban(baraban_nomenklatura, "YAMAHA", "wood - leather", 7000, new DateTime(2016, 09, 10)); Piano tovar4 = new Piano(piano_nomenklatura, "C.Bechstein", "wood", 80000, new DateTime(2017, 10, 10)); Accessories tovar5 = new Accessories(mediator_nomenklatura, "Mediator", 100, gitara_nomenklatura); List <Tovar> ListTovar = new List <Tovar>(); ListTovar.Add(tovar1); ListTovar.Add(tovar2); ListTovar.Add(tovar3); ListTovar.Add(tovar4); ListTovar.Add(tovar5); // массив для сериализации: Tovar[] tovar = new Tovar[] { tovar1, tovar2, tovar3, tovar4, tovar5 }; BinaryFormatter formatter = new BinaryFormatter(); using (FileStream fs = new FileStream("tovar.dat", FileMode.OpenOrCreate)) { // сериализуем весь массив tovar formatter.Serialize(fs, tovar); Console.WriteLine("Сериализация в поток байтов прошла успешно"); } // десериализация using (FileStream fs = new FileStream("tovar.dat", FileMode.OpenOrCreate)) { Tovar[] deserilizeTovar = (Tovar[])formatter.Deserialize(fs); foreach (Tovar tv in deserilizeTovar) { Console.WriteLine("Товар: {0} ; Цена: {1}", tv.ID, tv.Price); } /*foreach (Tovar t in ListTovar) * { * Console.WriteLine(t.tv()); * } * Console.WriteLine(" "); * Console.WriteLine("Из них аксессуары:"); * foreach (Tovar t in ListTovar.Where(i1 => i1 is IAccessories)) * { * Console.WriteLine(t.tv()); * }*/ Console.ReadLine(); } }
public void AddAccessories(Accessories w) { if (m_lAccessories == null) { m_lAccessories = new List <Accessories>(); } m_lAccessories.Add(w); }
public void VerifyBackNavigationBarGem() { CPQNavigate.NavigateToAccessoriesPage(Brand.GEM, ModelPageUrl.GEM_EL_XD_BASE_TEST); Accessories.NavigationBarModule.WaitForNavigationBarToLoad(); Accessories.NavigationBarModule.ClickModelsNavigation(); Accessories.ClickConfirmationBuildContinueButton(); Assert.IsTrue(Models.IsChooseModelTitleDisplayed(), "Choose Model title is not displayed"); }
public void VerifyAccessoriesUIRandomModelGem() { string modelColor = ApiDataTestBase.GetRandomModelColorFromApi(Brand.GEM, MODELS_YEAR, TEST_DEALER_ID); CPQNavigate.NavigateToAccessoriesPage(Brand.GEM, modelColor); Accessories.WaitForAccessoriesPageToLoad(); Accessories.VerifyAccessoriesPageGEMUIElements(); }
public void VerifySummaryDealerExperienceSno() { CPQNavigate.NavigateToBrandDealerExpAccessoriesPage(Brand.SNO, ModelPageUrl.SNO_SWITCHBACK_600_BASE_TEST, DEALER_ID); Accessories.WaitForAccessoriesPageToLoad(); Accessories.FooterModule.OpenBuildSummary(); Accessories.WaitUntilBuildSummaryIsDisplayed(); Accessories.VerifyIconsAndAdditionalNotesNotPresent(); }
// Use this for initialization void Start () { aud = GetComponent<AudioSource>(); sfx = aud.clip; AddHat(); AddGlass(); AddShoes(); AddClothes(); //Deactive(hats); //Deactive(glass); //Deactive(shoes); Deactive(accessories); hatIndex = PlayerStatistic.instance.hatIndex; glassIndex = PlayerStatistic.instance.glassIndex; shoesIndex = PlayerStatistic.instance.shoesIndex; clothesIndex = PlayerStatistic.instance.clothesIndex; currentHat = FindAccessories(hatIndex); currentHat.go.SetActive(true); currentGlass = FindAccessories(glassIndex); currentGlass.go.SetActive(true); currentShoes = FindAccessories(shoesIndex); if(currentShoes.go.GetComponent<SkinnedMeshRenderer>()) currentShoes.go.GetComponent<SkinnedMeshRenderer>().enabled = true; else currentShoes.go.SetActive(true); currentClothes = FindAccessories(clothesIndex); if(currentClothes.go.GetComponent<SkinnedMeshRenderer>()) currentClothes.go.GetComponent<SkinnedMeshRenderer>().enabled = true; else currentClothes.go.SetActive(true); }
private void button_Save_Click(object sender, RoutedEventArgs e) { try { MessageBoxResult res; res = MessageBox.Show("Вы уверены, что хотите сохранить товар?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { if (textBox_Id.Text == "-1") { if (TypeGoods.SelectedItem == null) { MessageBox.Show("Вы кароч не сделали ниче для того чтобы всё работало", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Question); } else if (TypeGoods.SelectedItem.ToString() == "Оружие") { List<TextBox> s = WeaponGrid.Children.OfType<TextBox>().ToList(); foreach (TextBox q in s) { if (q.Text == "" || q.Text == "0") { MessageBox.Show("Не все поля заполнены"); return; } } Weapon f = new Weapon(); f.Type = textBox_TypeWeap.Text; f.CodeName = textBox_NameWeap.Text; f.Automatic = textBox_Avtomat.Text; f.Сaliber = Convert.ToDouble(textBox_Calibr.Text); f.KillRange = Convert.ToInt32(textBox_KillRange.Text); f.Ammunition = Convert.ToInt32(textBox_Ammunition.Text); f.StartBulletSpeed = Convert.ToInt32(textBox_StartSpeed.Text); f.Optic = checkBox.IsChecked.Value; f.Info = textBox_Info.Text; Goodss god = new Goodss() { Balance = Convert.ToInt32(textBox.Text), PricePurchase = Convert.ToDouble(textBox1.Text), SellPrice = Convert.ToDouble(textBox2.Text), Weapon = f }; db.Goodss.Add(god); db.SaveChanges(); this.Close(); } else if (TypeGoods.SelectedItem.ToString() == "Аксесуар") { List<TextBox> s = AccessoriesGrid.Children.OfType<TextBox>().ToList(); foreach (TextBox q in s) { if (q.Text == "" || q.Text == "0") { MessageBox.Show("Не все поля заполнены"); return; } } Accessories access = new Accessories(); access.Type = textBox_Type.Text; access.Name = textBox_Name.Text; access.Characteristics = textBox_Charact.Text; Goodss god = new Goodss() { Accessories = access }; god.Balance = Convert.ToInt32(textBox.Text); god.PricePurchase = Convert.ToInt32(textBox1.Text); god.SellPrice = Convert.ToInt32(textBox2.Text); db.Goodss.Add(god); db.SaveChanges(); this.Close(); } } else { Goodss f = db.Goodss.Find(Convert.ToInt32(textBox_Id.Text)); if (TypeGoods.SelectedItem.ToString() == "Оружие") { Weapon Weapons = db.Weapons.Find(Convert.ToInt32(textBox_Id.Text)); Weapons.Type = textBox_TypeWeap.Text; Weapons.CodeName = textBox_NameWeap.Text; Weapons.Automatic = textBox_Avtomat.Text; Weapons.Сaliber = Convert.ToDouble(textBox_Calibr.Text); Weapons.KillRange = Convert.ToInt32(textBox_KillRange.Text); Weapons.Ammunition = Convert.ToInt32(textBox_Ammunition.Text); Weapons.StartBulletSpeed = Convert.ToInt32(textBox_StartSpeed.Text); Weapons.Optic = checkBox.IsChecked.Value; Weapons.Info = textBox_Info.Text; f.Balance = Convert.ToInt32(textBox.Text); f.PricePurchase = Convert.ToInt32(textBox1.Text); f.SellPrice = Convert.ToInt32(textBox2.Text); db.SaveChanges(); } else if (TypeGoods.SelectedItem.ToString() == "Аксесуар") { Accessories Accessoriess = db.Accessories.Find(Convert.ToInt32(textBox_Id.Text)); Accessoriess.Type = textBox_Type.Text; Accessoriess.Name = textBox_Name.Text; Accessoriess.Characteristics = textBox_Charact.Text; f.Balance = Convert.ToInt32(textBox.Text); f.PricePurchase = Convert.ToInt32(textBox1.Text); f.SellPrice = Convert.ToInt32(textBox2.Text); db.SaveChanges(); } this.Close(); } } } catch { MessageBox.Show("Error"); } }
public void SelectClothesPrev(){ aud.PlayOneShot(sfx); clothesIndex -= 1; if(clothesIndex <300) clothesIndex = 300 +totalClothes-1; currentClothes = FindAccessories(clothesIndex); if(currentClothes.available){ Deactive(accessories,Type.Clothes); if(currentClothes.go.GetComponent<SkinnedMeshRenderer>()) currentClothes.go.GetComponent<SkinnedMeshRenderer>().enabled = true; else currentClothes.go.SetActive(true); ActiveAcc(); }else{ clothesIndex -= 1; SelectClothesPrev(); } }
public void SelectShoesNext(){ aud.PlayOneShot(sfx); shoesIndex += 1; if(shoesIndex >= 400 + totalShoes) shoesIndex = 400; currentShoes = FindAccessories(shoesIndex); if(currentShoes.available){ Deactive(accessories,Type.Shoes); if(currentShoes.go.GetComponent<SkinnedMeshRenderer>()) currentShoes.go.GetComponent<SkinnedMeshRenderer>().enabled = true; else currentShoes.go.SetActive(true); ActiveAcc(); }else{ shoesIndex += 1; SelectShoesNext(); } }
public void SelectGlassPrev(){ aud.PlayOneShot(sfx); glassIndex -= 1; if(glassIndex <200) glassIndex = 200 + totalGlasses-1; currentGlass = FindAccessories(glassIndex); if(currentGlass.available){ Deactive(accessories,Type.Glass); currentGlass.go.SetActive(true); ActiveAcc(); }else{ glassIndex -= 1; SelectGlassPrev(); } }
public void SelectHatPrev(){ aud.PlayOneShot(sfx); hatIndex -= 1; if(hatIndex <100) hatIndex = 100 + totalHat-1; currentHat = FindAccessories(hatIndex); if(currentHat.available){ Deactive(accessories,Type.Hat); currentHat.go.SetActive(true); ActiveAcc(); }else{ hatIndex -= 1; SelectHatPrev(); } //} }