//Using same window form for Add Edit. Titles will be different depending on if it was add or edit
 public AddEditProduct(ManageProductListing manageProductListing = null)
 {
     InitializeComponent();
     lblTitle.Text         = "Add New Product";
     this.Text             = "Add New Product";
     isEditMode            = false;
     _manageProductListing = manageProductListing;
     _db = new TravelExpertsEntities();
 }
Example #2
0
        private void manageProductsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var productlist = new ManageProductListing
            {
                MdiParent = this
            };

            productlist.Show();
        }
        public AddEditProduct(Product productToEdit, ManageProductListing manageProductListing = null)
        {
            InitializeComponent();
            lblTitle.Text         = "Edit Products";
            this.Text             = "Edit Products";
            _manageProductListing = manageProductListing;

            if (productToEdit == null)
            {
                MessageBox.Show("Please ensure you selected a valid Product to edit");
                Close();
            }
            else
            {
                isEditMode = true;
                _db        = new TravelExpertsEntities();
                PopulateFields(productToEdit);
            }
        }