//Method to add package private void btnAdd_Click(object sender, EventArgs e) { frmAddModifyPackages addPackagesForm = new frmAddModifyPackages(); addPackagesForm.addPackages = true; DialogResult result = addPackagesForm.ShowDialog(); if (result == DialogResult.OK) { packages = addPackagesForm.packages; txtPackageId.Text = packages.PackageId.ToString(); this.DisplayPackages(); } }
//Method to modify package private void btnModify_Click(object sender, EventArgs e) { frmAddModifyPackages modifyPackagesForm = new frmAddModifyPackages(); modifyPackagesForm.addPackages = false; modifyPackagesForm.packages = packages; DialogResult result = modifyPackagesForm.ShowDialog(); if (result == DialogResult.OK) { packages = modifyPackagesForm.packages; this.DisplayPackages(); } else if (result == DialogResult.Retry) { this.GetPackages(packages.PackageId); if (packages != null) this.DisplayPackages(); else this.ClearControls(); } }