/// <summary> /// Reads the file and sets values to the fridge class /// </summary> /// <returns>The data about the fridges from the csv file</returns> void ReadData(string fileName, Branch[] branches) { string shopsName = null; using (StreamReader reader = new StreamReader(@fileName)) { string line = null; line = reader.ReadLine(); if (line != null) { shopsName = line; } Branch branch = GetBranchByShopsName(branches, shopsName); //sukuri random brancha if (branch == null) { return; } string address = reader.ReadLine(); string phoneNumber = reader.ReadLine(); while (null != (line = reader.ReadLine())) { string[] values = line.Split(';'); string facturer = values[0]; string model = values[1]; double capacity = double.Parse(values[2]); string energyClass = values[3]; string assemblyType = values[4]; string color = values[5]; string attribute = values[6]; double cost = double.Parse(values[7]); Fridges fridge = new Fridges(facturer, model, capacity, energyClass, assemblyType, color, attribute, cost); branch.fridges.AddFridge(fridge); //tada cia ji pildai ir jo niekur nenusiunti, todel tau neuzsipildo } } }
/// <summary> /// Reads the file and sets values to the fridge class /// </summary> /// <returns>The data about the fridges from the csv file</returns> void ReadData(string fileName, Branch[] branches) { string shopsName = null; using (StreamReader reader = new StreamReader(@fileName)) { string line = null; line = reader.ReadLine(); if (line != null) { shopsName = line; } Branch tempBranches = TempBranch(branches, shopsName); string address = reader.ReadLine(); string phoneNumber = reader.ReadLine(); while (null != (line = reader.ReadLine())) { string[] values = line.Split(';'); string facturer = values[0]; string model = values[1]; double capacity = double.Parse(values[2]); string energyClass = values[3]; string assemblyType = values[4]; string color = values[5]; string attribute = values[6]; double cost = double.Parse(values[7]); Fridges fridge = new Fridges(facturer, model, capacity, energyClass, assemblyType, color, attribute, cost); tempBranches.fridges.AddFridge(fridge); } } }
public void AddFridges(Fridges fridge, int index) { fridges[index] = fridge; }
public bool Contains(Fridges fridge) { return(fridges.Contains(fridge)); }
public void AddFridge(Fridges fridge) { fridges[Count++] = fridge; }