public List <StoreStructure> ReadAssortment() { assortment = new List <StoreStructure>(); string[] lines = File.ReadAllLines("Products.txt"); foreach (string line in lines) { try { string[] parts = line.Split(','); string category = parts[0]; string item = parts[1]; StoreStructure product = new StoreStructure { Category = category, Item = item }; assortment.Add(product); } catch { Console.WriteLine("Invalid line in product file"); } } return(assortment); //CreateMaxiSortimentOrder(assortment); }
public static List <string> SortInWillysOrder(List <string> ShoppingCart, List <StoreStructure> assortment) { List <string> assortmentWillys = StoreStructure.CreateWillysSortimentOrder(assortment); var willysList = new List <string>(); foreach (string m in assortmentWillys) { foreach (string s in ShoppingCart) { if (s == m) { willysList.Add(s); } } } return(willysList); }
public static List <string> SortInCityGrossOrder(List <string> ShoppingCart, List <StoreStructure> assortment) { List <string> assortmentCity = StoreStructure.CreateCityGrossSortimentOrder(assortment); var cityGrossList = new List <string>(); foreach (string m in assortmentCity) { foreach (string s in ShoppingCart) { if (s == m) { cityGrossList.Add(s); } } } return(cityGrossList); }
public static List <string> SortInMaxiOrder(List <string> ShoppingCart, List <StoreStructure> assortment) { List <string> assortmentMax = StoreStructure.CreateMaxiSortimentOrder(assortment); var maxiList = new List <string>(); foreach (string m in assortmentMax) { foreach (string s in ShoppingCart) { if (s == m) { maxiList.Add(s); } } } return(maxiList); }
public MyForm() { Size = new Size(1000, 800); AutoSizeMode = AutoSizeMode; TableLayoutPanel panel = new TableLayoutPanel { RowCount = 7, ColumnCount = 2, Dock = DockStyle.Fill, BackColor = Color.Gold }; Controls.Add(panel); panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60)); panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 5)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 2)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 10)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 10)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 10)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 40)); panel.RowStyles.Add(new ColumnStyle(SizeType.Percent, 10)); var headerLabel = new Label { Text = "Inköpslista", BackColor = Color.AntiqueWhite, Font = new Font("Impact", 17F), Anchor = AnchorStyles.Bottom, Dock = DockStyle.Fill }; panel.Controls.Add(headerLabel); panel.SetColumnSpan(headerLabel, 2); var fyllPa = new Label { Text = "Fyll på:", BackColor = Color.AntiqueWhite, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill }; panel.Controls.Add(fyllPa); panel.SetColumnSpan(fyllPa, 2); varuInput = new TextBox { Dock = DockStyle.Fill, Anchor = AnchorStyles.Left, Height = 350, Width = 550 }; panel.Controls.Add(varuInput); varuInput.KeyDown += new KeyEventHandler(VaruInput_KeyDown); var button1 = new Button { Dock = DockStyle.Fill, Font = new Font("Impact", 12F), Text = "Maxi, Kungälv" }; panel.Controls.Add(button1); button1.Click += Button1_Click; varuDisplay = new ListBox { Dock = DockStyle.Fill, Font = new Font("Liberation Sans", 9F) }; panel.Controls.Add(varuDisplay); panel.SetRowSpan(varuDisplay, 3); varuDisplay.Items.Add("Din lista: \n"); var button2 = new Button { Dock = DockStyle.Fill, Font = new Font("Impact", 12F), Text = "City Gross, Ytterby" }; panel.Controls.Add(button2); button2.Click += Button2_Click; var button3 = new Button { Dock = DockStyle.Fill, Font = new Font("Impact", 12F), Text = "Willys, Stenungsund" }; panel.Controls.Add(button3); button3.Click += Button3_Click; var empty = new Label { Anchor = AnchorStyles.Left, Dock = DockStyle.Fill }; panel.Controls.Add(empty); var mejlaTill = new Label { Text = "Mejla till:", BackColor = Color.AntiqueWhite, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill }; panel.Controls.Add(mejlaTill); var mejlInput = new TextBox { Dock = DockStyle.Fill }; panel.Controls.Add(mejlInput); this.ShoppingCart = new Shop(); this.Assortment = new StoreStructure(); }