Example #1
0
        private void ResolveType(string operation)
        {
            storeManager.Entities.Location location = ListType as storeManager.Entities.Location;
            Brand       brand       = ListType as Brand;
            Category    category    = ListType as Category;
            Measurement measurement = ListType as Measurement;

            //Tax tax = ListType as Tax;

            if (location != null)
            {
                PerformLocationOperation(location, operation);
                return;
            }

            if (brand != null)
            {
                PerformBrandOperation(brand, operation);
                return;
            }

            if (category != null)
            {
                PerformCategoryOperation(category, operation);
                return;
            }

            if (measurement != null)
            {
                PerformMeasurementOperation(measurement, operation);
                return;
            }
        }
Example #2
0
        void PerformLocationOperation(storeManager.Entities.Location location, string operation)
        {
            frmAddLocation frmlocation = new frmAddLocation(EntityState.Dirty);
            int            locationID  = dgvList.SelectedRows[0].Cells["id"].Value.ToInt();

            switch (operation)
            {
            case "Modify":
                frmlocation.LocationID = locationID;
                frmlocation.ShowDialog();
                break;

            case "Add":
                frmlocation = new frmAddLocation();
                frmlocation.ShowDialog();
                break;

            case "Delete":
                if (!(DialogResult.Yes == Helper.ShowMessage("Are you sure you want to delete this location?",
                                                             "Delete Seleted Location", MessageBoxButtons.YesNo, MessageBoxIcon.Question)))
                {
                    return;
                }

                new LocationService().Remove(new Location {
                    Id = locationID
                });
                LoadGridWithDataDatasource(() => new LocationService().GetAll());
                break;
            }
        }
Example #3
0
        void ConfigureGrid()
        {
            storeManager.Entities.Location location = ListType as storeManager.Entities.Location;
            Brand       brand       = ListType as Brand;
            Category    category    = ListType as Category;
            Tax         tax         = ListType as Tax;
            Measurement measurement = ListType as Measurement;

            if (location != null)
            {
                dgvList.Columns["Name"].Width    = 300;
                dgvList.Columns["Comment"].Width = 350;

                dgvList.Columns["id"].IsVisible               = false;
                dgvList.Columns["IsDefault"].IsVisible        = false;
                dgvList.Columns["ProductLocations"].IsVisible = false;
                return;
            }

            if (brand != null)
            {
                dgvList.Columns["BrandName"].HeaderText = "Brand Name";

                dgvList.Columns["BrandName"].Width   = 300;
                dgvList.Columns["Description"].Width = 350;

                dgvList.Columns["BrandID"].IsVisible     = false;
                dgvList.Columns["ID"].IsVisible          = false;
                dgvList.Columns["DisplayName"].IsVisible = false;
                dgvList.Columns["Products"].IsVisible    = false;
                return;
            }

            if (category != null)
            {
                dgvList.Columns["Name"].Width    = 300;
                dgvList.Columns["Comment"].Width = 350;

                dgvList.Columns["CategoryID"].IsVisible  = false;
                dgvList.Columns["ID"].IsVisible          = false;
                dgvList.Columns["DisplayName"].IsVisible = false;
                dgvList.Columns["Products"].IsVisible    = false;
                return;
            }

            if (tax != null)
            {
                dgvList.Columns["TaxName"].HeaderText   = "Tax Name";
                dgvList.Columns["TaxRate"].HeaderText   = "Tax Rate";
                dgvList.Columns["TaxNumber"].HeaderText = "Tax Number";

                dgvList.Columns["TaxName"].Width   = 300;
                dgvList.Columns["TaxRate"].Width   = 120;
                dgvList.Columns["TaxNumber"].Width = 120;

                dgvList.Columns["TaxID"].IsVisible       = false;
                dgvList.Columns["ID"].IsVisible          = false;
                dgvList.Columns["DisplayName"].IsVisible = false;
                return;
            }

            if (measurement != null)
            {
                dgvList.Columns["Name"].Width        = 300;
                dgvList.Columns["Description"].Width = 350;

                dgvList.Columns["id"].IsVisible       = false;
                dgvList.Columns["Products"].IsVisible = false;
                return;
            }
        }