Esempio n. 1
0
        private void cmdDataAdd_ItemClick(object sender, ItemClickEventArgs e)
        {
            switch (this.CurrentFileType)
            {
            case FileType.Categories:
                FrmCategoryEditor formCategory = new FrmCategoryEditor();
                formCategory.ShowDialog();
                break;

            case FileType.Manufacturers:
                FrmManufacturerEditor formManufacturer = new FrmManufacturerEditor();
                formManufacturer.ShowDialog();
                break;

            case FileType.Stores:
                FrmStoreEditor formStore = new FrmStoreEditor();
                formStore.ShowDialog();
                break;

            case FileType.Scales:
                FrmScaleEditor formScale = new FrmScaleEditor();
                formScale.ShowDialog();
                break;

            case FileType.Decoders:
                FrmDecoderEditor formDecoder = new FrmDecoderEditor();
                formDecoder.ShowDialog();
                break;

            case FileType.Administrations:
                FrmAdministrationEditor formAdmin = new FrmAdministrationEditor();
                formAdmin.ShowDialog();
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        private void cmdDataEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (grdDataView.SelectedRowsCount <= 0)
            {
                MessageBox.Show("You must select the row you want to edit.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // Get the current row
            int[]       rows = grdDataView.GetSelectedRows();
            DataRowView row  = grdDataView.GetRow(rows[0]) as DataRowView;

            if (row == null)
            {
                return;
            }

            switch (this.CurrentFileType)
            {
            case FileType.Categories:
                Category category = CollectionContext.CategoryDAO.GetByID((Int64)row.Row[0]);
                if (category != null)
                {
                    FrmCategoryEditor formCategoryEditor = new FrmCategoryEditor(category);
                    formCategoryEditor.ShowDialog();
                }
                break;

            case FileType.Manufacturers:
                Manufacturer manufacturer = CollectionContext.ManufacturerDAO.GetByID((Int64)row.Row[0]);
                if (manufacturer != null)
                {
                    FrmManufacturerEditor formStore = new FrmManufacturerEditor(manufacturer);
                    formStore.ShowDialog();
                }
                break;

            case FileType.Stores:
                Store store = CollectionContext.StoreDAO.GetByID((Int64)row.Row[0]);
                if (store != null)
                {
                    FrmStoreEditor formStore = new FrmStoreEditor(store);
                    formStore.ShowDialog();
                }
                break;

            case FileType.Scales:
                Scale scale = CollectionContext.ScaleDAO.GetByID((Int64)row.Row[0]);
                if (scale != null)
                {
                    FrmScaleEditor formScale = new FrmScaleEditor(scale);
                    formScale.ShowDialog();
                }
                break;

            case FileType.Decoders:
                Decoder decoder = CollectionContext.DecoderDAO.GetByID((Int64)row.Row[0]);
                if (decoder != null)
                {
                    FrmDecoderEditor formDecoder = new FrmDecoderEditor(decoder);
                    formDecoder.ShowDialog();
                }
                break;

            case FileType.Administrations:
                Administration admin = CollectionContext.AdministrationDAO.GetByID((Int64)row.Row[0]);
                if (admin != null)
                {
                    FrmAdministrationEditor formAdmin = new FrmAdministrationEditor(admin);
                    formAdmin.ShowDialog();
                }
                break;

            default:
                break;
            }
        }