private Package packages; // create object Package // get packages from GetPackages method private void GetPackages(int packID) { try { packages = PackagesDB.GetPackages(packID); // gets package object from defined method } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }
private void BtnCreate(object sender, EventArgs e) { List <int> valsOnly = new List <int>(); foreach (KeyValuePair <string, int> v in SelectedList) { valsOnly.Add(v.Value); } PackagesDB.AddPackage(txtPackageName.Text, DTPackageStart.Value, DTPackageEnd.Value, fieldDesc.Text, numBasePrice.Value, numAgentComm.Value, valsOnly.ToArray()); MessageBox.Show("Created new package: \"" + txtPackageName.Text + "\"", "Success"); }