Exemplo n.º 1
0
        private void btnAddPackage_Click(object sender, EventArgs e)
        {
            var addEditPackage = new AddEditPackage(this);

            addEditPackage.MdiParent = this.MdiParent;
            addEditPackage.Show();
        }
        private void addPackagesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var addPackage = new AddEditPackage
            {
                MdiParent = this
            };

            addPackage.Show();
        }
Exemplo n.º 3
0
        private void btnEditPackage_Click(object sender, EventArgs e)
        {
            try
            {
                //which row is selected
                var id = Convert.ToString(gvPackageList.CurrentRow.Cells[0].Value);
                //var id = (int)gvPackageList.CurrentRow.Cells[0].Value; //it is the same

                //query database for record
                var package = _db.Packages.FirstOrDefault(p => p.PkgName == id);

                //launch AddEditProduct window with Data
                var addEditPackage = new AddEditPackage(package, this);
                addEditPackage.MdiParent = this.MdiParent;
                addEditPackage.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error: {ex.Message}");
            }
        }