private void btnSimpan_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); bool IsPass = true; if (string.IsNullOrEmpty(textBoxNamaPelanggan.Text)) { IsPass = false; sb.Append("- Nama Pelanggan harus diisi \n"); } if (string.IsNullOrEmpty(textBoxNomorKtp.Text)) { IsPass = false; sb.Append("- Nomor KTP harus diisi \n"); } if (string.IsNullOrEmpty(textBoxAlamat.Text)) { IsPass = false; sb.Append("- Alamat harus diisi \n"); } if (string.IsNullOrEmpty(textBoxNomorTelepon.Text)) { IsPass = false; sb.Append("- Nomor Telepon harus diisi \n"); } if (comboBoxMember.SelectedValue == null) { IsPass = false; sb.Append("- Member harus diisi \n"); } if (!IsPass) { MessageBox.Show(sb.ToString(), "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var member = memberService.Get(int.Parse(comboBoxMember.SelectedValue.ToString())); var pelanggan = new Pelanggan() { NamaPelanggan = textBoxNamaPelanggan.Text, NomorKtp = textBoxNomorKtp.Text, Alamat = textBoxAlamat.Text, NoTelepon = textBoxNomorTelepon.Text, MemberId = member.Id }; pelangganService.Post(pelanggan); this.ParentForm.dataGridViewPelanggan.DataSource = pelangganService.Get(); this.Dispose(); }