private void SaveSalesman() { if (txtSalesmanName.Text == "") { MessageBox.Show("Nama harus diisi", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtSalesmanName.Focus(); } else if (formMode == FormMode.Add && salesmanRepository.IsSalesmanNameExisted(txtSalesmanName.Text)) { MessageBox.Show("Salesman : " + txtSalesmanName.Text + "\n\n" + "sudah ada ", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtPhone1.Text == "") { MessageBox.Show("Telepon 1 harus diisi", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPhone1.Focus(); } else { Salesman salesman = new Salesman(); salesman.Name = txtSalesmanName.Text; salesman.Phone1 = txtPhone1.Text; salesman.Phone2 = txtPhone2.Text; salesman.Address = txtAddress.Text; salesman.Notes = txtNotes.Text; salesman.IsActive = chkIsActive.Checked; if (formMode == FormMode.Add) { salesmanRepository.Save(salesman); GetLastSalesman(); } else if (formMode == FormMode.Edit) { salesman.ID = new Guid(txtID.Text); salesmanRepository.Update(salesman); } LoadSalesmen(); DisableForm(); formMode = FormMode.View; this.Text = "Salesman"; } }