private async void AddProductItemsToCBox(FileIdentifiers fileIdentifiers) { var items = await _storeFileManager.GetItemsOfStore(fileIdentifiers); _items.Items.Clear(); _items.Items.AddRange(items.ToArray <object>()); }
private void AddStoreNamesToCBox(FileIdentifiers fileIdentifiers, string optionalAeraFilter) { var storeNames = _storeFileManager.GetStoresNames(fileIdentifiers, optionalAeraFilter); _cBoxStores.Items.Clear(); _cBoxStores.Items.AddRange(storeNames.ToArray <object>()); }
private void Compare_Click(object sender, EventArgs e) { if (_shoppingCart.Items.Count == 0) { ShowWarning("Please select items to compare"); } else if (_cBoxStores.SelectedItem == null || _cBoxChain.SelectedItem == null || _cBoxStoresToCompare.Items.Count == 0) { ShowWarning("Please select at list 1 chain and 1 branch"); } else { List <FileIdentifiers> stores = new List <FileIdentifiers>(); foreach (string chainAndBranchName in _cBoxStoresToCompare.Items) { string[] chainAndBranch = chainAndBranchName.Split(_spliter); var store = new FileIdentifiers() { DirName = chainAndBranch[0], PartialFileName = chainAndBranch[1] }; stores.Add(store); } var fullReportOfStores = _storeFileManager.FullReportOfStores(stores, _databaseOfShoppingCart); var reportForm = new Report(fullReportOfStores); reportForm.Show(); } }
private void CBoxChains_SelectedIndexChanged(object sender, EventArgs e) { if ((sender as ComboBox).SelectedItem != null) { var fileIdentifiers = new FileIdentifiers() { DirName = (string)(sender as ComboBox).SelectedItem, PartialFileName = "Stores" }; AddStoreNamesToCBox(fileIdentifiers, null); } }
private void Filter_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(_filterTextBox.Text) && _cBoxChain.SelectedItem != null) { var fileIdentifiers = new FileIdentifiers(); fileIdentifiers.DirName = (string)_cBoxChain.SelectedItem; fileIdentifiers.PartialFileName = "Stores"; AddStoreNamesToCBox(fileIdentifiers, _filterTextBox.Text); } else { ShowWarning("Please enter City name"); } }
private void CBoxStores_SelectedIndexChanged(object sender, EventArgs e) { if ((string)(_cBoxChain.SelectedItem) != null && (string)(sender as ComboBox).SelectedItem != null) { var fileIdentifiers = new FileIdentifiers() { DirName = (string)(_cBoxChain.SelectedItem), PartialFileName = (string)(sender as ComboBox).SelectedItem }; AddProductItemsToCBox(fileIdentifiers); var selectedBranch = $"{fileIdentifiers.DirName}{_spliter}{fileIdentifiers.PartialFileName}"; if (_checkBoxSelectStoresToCompare.Checked && !_cBoxStoresToCompare.Items.Contains(selectedBranch)) { _cBoxStoresToCompare.Items.Add(selectedBranch); } } else { ShowWarning("Please select 1 chain and 1 branch"); } }