/// <summary> /// Saves supplier information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSupplierSave_Click(object sender, EventArgs e) { if (txtCompanyName.Text != "" && cboCompanyInfo.SelectedItem != null) { Supplier sup = new Supplier(); if (_supplierId != 0) sup.LoadByPrimaryKey(_supplierId); else sup.AddNew(); sup.CompanyInfo = cboCompanyInfo.SelectedItem.ToString(); sup.CompanyName = txtCompanyName.Text; sup.Address = txtAddress.Text; sup.ContactPerson = txtContactPerson.Text; sup.Telephone = txtTelephone.Text; sup.IsActive = ckIsActive.Checked; sup.Mobile = txtMobile.Text; sup.Email = txtEmail.Text; sup.Save(); sup.LoadAll(); PopulateSupplier(sup); ResetSupplier(); XtraMessageBox.Show("Supplier Record Updated.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { txtCompanyName.BackColor = Color.FromArgb(251, 214, 214); } }