private void ChangeProductButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); //this.productGrid.ItemsSource = db.Products.ToList(); ChangeProductControl change = new ChangeProductControl(); if (this.productGrid.SelectedIndex >= 0) { if (this.productGrid.SelectedItems.Count >= 0) { if (this.productGrid.SelectedItems[0].GetType() == typeof(Product)) { Product product = (Product)this.productGrid.SelectedItems[0]; change.comboBox_Product.Text = product.ProductType; change.textBox_Name.Text = product.ProductName; change.textBox_Price.Text = product.ProductPrice; //product.ProductAvailability = "В наличии"; change.arrivalDate.DisplayDate = product.ArrivalDate; this.changedId = product.ID; } } } Add.Children.Clear(); Add.Children.Add(new ChangeProductControl()); }
private void AddGPUButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); GPU gpu = new GPU() { GPUInterface = textBox_GPUInterface.Text, GPUManufacturer = comboBox_GPUManufacturer.Text, GraphicsProcessor = textBox_GraphicsProcessor.Text, GPUFrequency = textBox_GPUFrequency.Text, GPUTurboFrequency = textBox_GPUTurboFrequency.Text, NumberStreamProcessors = textBox_NumberStreamProcessors.Text, VideoMemory = textBox_VideoMemory.Text, VideoMemoryType = textBox_VideoMemoryType.Text, EffectiveMemoryFrequency = textBox_EffectiveMemoryFrequency.Text, MemoryBandwidth = textBox_MemoryBandwidth.Text, MemoryBusWidth = textBox_MemoryBusWidth.Text, DirectXSupport = textBox_DirectXSupport.Text, PowerConnectors = textBox_PowerConnectors.Text, RecommendedPowerSupply = textBox_RecommendedPowerSupply.Text, Cooling = textBox_Cooling.Text, NumberFans = textBox_NumberFans.Text, VideoCardDimensions = textBox_VideoCardDimensions.Text, Interfaces = textBox_Interfaces.Text }; db.GPUs.Add(gpu); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
private void AddMBButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); Motherboard motherboard = new Motherboard() { ProcessorSupport = comboBox_ProcessorSupport.Text, Socket = textBox_Socket.Text, Chipset = textBox_Chipset.Text, FormFactor = textBox_FormFactor.Text, MemoryType = textBox_MemoryType.Text, NumberMemorySlots = textBox_NumberMemorySlots.Text, MaximumMemorySize = textBox_MaxMemorySize.Text, MemoryMode = textBox_MemoryMode.Text, MaximumMemoryFrequency = textBox_MaxMemoryFrequency.Text, StorageInterfaces = textBox_StorageInterfaces.Text, NetworkAndCommunication = textBox_NetworkAndCommunication.Text, AudioAndVideo = textBox_AudioAndVideo.Text, RearPanelConnectors = textBox_RearPanelConnectors.Text, InternalConnectors = textBox_InternalConnectors.Text, OverallDimensions = textBox_OveralDimensions.Text }; db.Motherboards.Add(motherboard); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
private void AddRAMButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); RAM ram = new RAM() { RAMSet = textBox_RAMSet.Text, RAMVolume = textBox_RAMVolume.Text, RAMType = textBox_RAMType.Text, RAMFrequency = textBox_RAMFrequency.Text, CASLatency = textBox_CASLatency.Text, Timing = textBox_Timing.Text, SupplyVoltage = textBox_SupplyVoltage.Text, ChipLocation = textBox_ChipLocation.Text, NumberMicrocircuits = textBox_NumberMicrocircuits.Text, CapacityMicrocircuits = textBox_CapacityMicrocircuits.Text, TypeMicrocircuits = textBox_TypeMicrocircuits.Text, XMPprofiles = textBox_XMPprofiles.Text, AMPprofiles = textBox_AMPprofiles.Text, Cooling = textBox_Cooling.Text }; db.RAMs.Add(ram); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
public CPUList() { InitializeComponent(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); var products = from ProductName in db.Products select ProductName; this.Name.Text = products.ToString(); }
private void RemoveButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); var r = from d in db.Products select d; int productID = ((Product)productGrid.SelectedItem).ID; var removeEvent = db.Products.Where(ev => ev.ID == productID).Single(); db.Products.Remove(removeEvent); db.SaveChanges(); this.productGrid.ItemsSource = db.Products.ToList(); }
private void AddCPUButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); CPU cpu = new CPU() { CPUManufacturer = comboBox_Manufacturer.Text, Lineup = textBox_LineUp.Text, DeliveryType = textBox_DeliveryType.Text, CoolingIncluded = comboBox_CoolingIncluded.Text, }; db.CPUs.Add(cpu); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = ListViewMenu.SelectedIndex; MoveCursorMenu(index); //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); var cpu = from d in db.Products where d.ProductType == "Процессор" select d; var gpu = from d in db.Products where d.ProductType == "Видеокарта" select d; var ram = from d in db.Products where d.ProductType == "Оперативная память" select d; var mb = from d in db.Products where d.ProductType == "Материнская плата" select d; var ps = from d in db.Products where d.ProductType == "Блок питания" select d; var disk = from d in db.Products where d.ProductType == "HDD/SSD" select d; switch (index) { case 0: this.productGrid.ItemsSource = cpu.ToList(); break; case 1: this.productGrid.ItemsSource = gpu.ToList(); break; case 2: this.productGrid.ItemsSource = ram.ToList(); break; case 3: this.productGrid.ItemsSource = mb.ToList(); break; case 4: this.productGrid.ItemsSource = ps.ToList(); break; case 5: this.productGrid.ItemsSource = disk.ToList(); break; default: break; } }
public void AddProductButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); Product product = new Product() { ProductName = textBox_Name.Text, ProductType = comboBox_Product.Text, ProductPrice = textBox_Price.Text + " руб.", ProductAvailability = "В наличии", ArrivalDate = arrivalDate.DisplayDate }; db.Products.Add(product); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
private void ChangeProductButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); MenuWindow menu = new MenuWindow(); var change = from c in db.Products where c.ID == menu.changedId select c; foreach (var item in change) { item.ProductName = textBox_Name.Text; item.ProductPrice = textBox_Price.Text; item.ArrivalDate = arrivalDate.DisplayDate; item.ProductType = comboBox_Product.Text; } db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
private void AddPSButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); PowerSupply powerSupply = new PowerSupply() { PSPower = textBox_PSPower.Text, PowerSupplyStandard = textBox_PowerSupplyStandart.Text, MaxLineCurrent12V = textBox_MaxLineCurrent12V.Text, PFC = textBox_PFC.Text, PowerSupplyConnectors = textBox_PowerSupplyConnectors.Text, Dimensions = textBox_Dimensions.Text }; db.PowerSupplies.Add(powerSupply); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }
private void BascketProductButton_Click(object sender, RoutedEventArgs e) { //using (AccessoriesStoreDB db = new AccessoriesStoreDB()) //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); Product product = (Product)this.productGrid.SelectedItem; Basket basket = new Basket() { ProductID = product.ID, Products = product.ProductName, TotalAmount = product.ProductPrice }; db.Baskets.Add(basket); db.SaveChanges(); var r = from d in db.Baskets select d; }
private void AddHDDSSDButton_Click(object sender, RoutedEventArgs e) { //AccessoriesStoreDB db = new AccessoriesStoreDB(); AccessoriesEntitiesBD db = new AccessoriesEntitiesBD(); HDDSSD hddssd = new HDDSSD() { DiskType = comboBox_DiskType.Text, Volume = textBox_Vloume.Text, FormFactor = textBox_FormFactor.Text, Interface = textBox_Interface.Text, Bufer = textBox_Bufer.Text, SequentialReadSpeed = textBox_SequentiaReadSpeed.Text, SequentiaWriteSpeed = textBox_SequentiaWriteSpeed.Text }; db.HDDSSDs.Add(hddssd); db.SaveChanges(); (this.Parent as Grid).Children.Remove(this); }