public frmVendor() { InitializeComponent(); vendors = VendorDB.GetVendors(); PopulateVendors(); this.Text = ("Vendors"); isDataSaved = true; }
/// <summary> /// Saving the information in the vendors list /// </summary> public void SaveVendorsList() { try { if (IsValidData()) { Vendor vendor = vendors[intCurrentVendor]; vendor.Name = txtName.Text; //these pull all the information from the position within the vendor array and put respective data into the text boxes vendor.Address = txtStreetAddress.Text; vendor.City = txtCity.Text; vendor.State = txtState.Text; vendor.Zip = txtZipCode.Text; vendor.YTD = Convert.ToInt32(txtYTDSales.Text); vendor.Contact = txtSalesRep.Text; vendor.Phone = txtPhoneNumber.Text; vendor.Comment = txtComments.Text; if (rdo10Days.Checked == true) //this will set the radio buttons to the proper amount { vendor.DefaultDiscount = 10; } else if (rdo15Days.Checked == true) { vendor.DefaultDiscount = 15; } else if (rdo20Days.Checked == true) { vendor.DefaultDiscount = 20; } else { vendor.DefaultDiscount = Convert.ToInt32(null); } vendors[intCurrentVendor] = vendor; VendorDB.SaveVendors(vendors); } } catch (Exception ex) { MessageBox.Show("Oops! An unexpected error occured." + "\n\n" + ex.ToString()); } }