예제 #1
0
        private void pbOpenPluginsStore_Click(object sender, EventArgs e)
        {
            // If the options were not initialized, it means we are using the
            // new plugins store for the first time. Copy values from main
            // options file
            if (!PluginsStore.Options.Instance.IsInitialized)
            {
                PluginsStore.Options.Instance.PluginsStoreShowInstalled    = Options.PluginsStoreShowInstalled;
                PluginsStore.Options.Instance.PluginsStoreShowIncompatible = Options.PluginsStoreShowIncompatible;
                PluginsStore.Options.Instance.PluginsStoreShowNew          = Options.PluginsStoreShowNew;
                PluginsStore.Options.Instance.PluginsStoreShowUpdates      = Options.PluginsStoreShowUpdates;
                PluginsStore.Options.Instance.IsInitialized = true;
            }

            var pc = new StoreForm();

            pc.PluginsUpdated += (storeForm, evt) =>
            {
                // If plugins list gets updated, refresh the list
                ReloadPluginsList();
            };

            // Avoid scanning for new files during Plugins Store usage.
            EnableNewPluginsWatching(false);
            pc.ShowDialog(this);
            EnableNewPluginsWatching(true);

            // Apply option to show Plugins Store on startup on main options
            if (Options.DisplayPluginsStoreOnStartup != PluginsStore.Options.Instance.DisplayPluginsStoreOnStartup)
            {
                Options.DisplayPluginsStoreOnStartup = PluginsStore.Options.Instance.DisplayPluginsStoreOnStartup.HasValue && PluginsStore.Options.Instance.DisplayPluginsStoreOnStartup.Value;
            }
        }
예제 #2
0
        private void editStoreDataButton_Click(object sender, EventArgs e)
        {
            if (storeDataGridView.SelectedRows.Count > 0)
            {
                int  index = storeDataGridView.SelectedRows[0].Index;
                int  number;
                bool converted = int.TryParse(storeDataGridView[0, index].Value.ToString(), out number);
                if (!converted)
                {
                    return;
                }

                var   stores = from t in controller.Elements where int.Parse(t.Number) == number select t;
                Store store  = stores.First();

                StoreForm storeAddForm = new StoreForm();
                storeAddForm.numberTextBox.Text = store.Number;
                storeAddForm.nameTextBox.Text   = store.Name;
                storeAddForm.ownerComboBox.Items.AddRange(companyDataController.Elements.ToArray());
                storeAddForm.ownerComboBox.SelectedItem = store.Owner;
                storeAddForm.trrcTextBox.Text           = store.TRRC;
                storeAddForm.taxCodeTextBox.Text        = store.TaxAuthoritiesCode;

                storeAddForm.codeOfRegionTextBox.Text = store.Address.CodeOfRegion;
                storeAddForm.postcodeTextBox.Text     = store.Address.Postcode;
                storeAddForm.districtTextBox.Text     = store.Address.District;
                storeAddForm.cityTextBox.Text         = store.Address.City;
                storeAddForm.localityTextBox.Text     = store.Address.Locality;
                storeAddForm.streetTextBox.Text       = store.Address.Street;
                storeAddForm.houseTextBox.Text        = store.Address.House;
                storeAddForm.buildingTextBox.Text     = store.Address.Building;
                storeAddForm.flatTextBox.Text         = store.Address.Flat;

                DialogResult dialogResult = storeAddForm.ShowDialog(this);

                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }

                store.Number             = storeAddForm.numberTextBox.Text;
                store.Name               = storeAddForm.nameTextBox.Text;
                store.Owner              = companyDataController.Elements.First(item => item.TIN == ((Company)(storeAddForm.ownerComboBox?.SelectedItem)).TIN);
                store.TRRC               = storeAddForm.trrcTextBox.Text;
                store.TaxAuthoritiesCode = storeAddForm.taxCodeTextBox.Text;

                store.Address.CodeOfRegion = storeAddForm.codeOfRegionTextBox.Text;
                store.Address.Postcode     = storeAddForm.postcodeTextBox.Text;
                store.Address.District     = storeAddForm.districtTextBox.Text;
                store.Address.City         = storeAddForm.cityTextBox.Text;
                store.Address.Locality     = storeAddForm.localityTextBox.Text;
                store.Address.Street       = storeAddForm.streetTextBox.Text;
                store.Address.House        = storeAddForm.houseTextBox.Text;
                store.Address.Building     = storeAddForm.buildingTextBox.Text;
                store.Address.Flat         = storeAddForm.flatTextBox.Text;

                controller.UpdateElement(store);
                storeDataGridView.DataSource = controller.Elements;
            }
        }
예제 #3
0
        private void buttonAddStore_Click(object sender, EventArgs e)
        {
            StoreForm form = new StoreForm(currentOperator);

            if (form.ShowDialog() == DialogResult.OK)
            {
                stores.FillUIElementsFromCollection();
            }
        }
예제 #4
0
        private void addStoreDataButton_Click(object sender, EventArgs e)
        {
            StoreForm storeAddForm = new StoreForm();

            storeAddForm.ownerComboBox.Items.AddRange(companyDataController.Elements.ToArray());
            storeAddForm.ownerComboBox.SelectedItem = storeAddForm.ownerComboBox.Items[0];
            DialogResult dialogResult = storeAddForm.ShowDialog(this);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (!(Regex.IsMatch(storeAddForm.codeOfRegionTextBox.Text, @"^[0-9]{2}$") && storeAddForm.codeOfRegionTextBox.Text.Length == 2))
            {
                MessageBox.Show(Messages.AddressCodeOfRegionFormatError);
                return;
            }
            var address = new Address(storeAddForm.codeOfRegionTextBox.Text,
                                      storeAddForm.postcodeTextBox.Text,
                                      storeAddForm.districtTextBox.Text,
                                      storeAddForm.cityTextBox.Text,
                                      storeAddForm.localityTextBox.Text,
                                      storeAddForm.streetTextBox.Text,
                                      storeAddForm.houseTextBox.Text,
                                      storeAddForm.buildingTextBox.Text,
                                      storeAddForm.flatTextBox.Text);

            var newStore = new Store(storeAddForm.numberTextBox.Text,
                                     storeAddForm.nameTextBox.Text,
                                     (Company)storeAddForm.ownerComboBox.SelectedItem,
                                     storeAddForm.trrcTextBox.Text,
                                     storeAddForm.taxCodeTextBox.Text,
                                     address);

            controller.AddElement(newStore);
            storeDataGridView.DataSource = controller.Elements;
        }