Beispiel #1
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (WithErrors())
            {
                val.validateComboBox(cbJenisIdentitas, errorProvider1, "Jenis identitas harus dipilih.");
                val.validateTextBox(txtNoIdentitas, errorProvider1, "No identitas harus diisi.");
                val.validateTextBox(txtAlamat, errorProvider1, "Alamat harus diisi.");
                val.validateTextBox(txtTelp, errorProvider1, "Telp harus diisi.");

                return;
            }

            if (Convert.ToInt32(txtId.Text) == 0)
            {
                var konsumen = new ADM_KONSUMEN();
                konsumen.ID_JENIS_IDENTITAS = Convert.ToInt32(cbJenisIdentitas.SelectedValue);
                konsumen.NO_IDENTITAS = txtNoIdentitas.Text;
                konsumen.NAMA = txtNama.Text;
                konsumen.ALAMAT = txtAlamat.Text;
                konsumen.TELP = txtTelp.Text;
                context.ADM_KONSUMENs.InsertOnSubmit(konsumen);
            }
            else
            {
                var query = from a in context.ADM_KONSUMENs
                            where a.ID_KONSUMEN == Convert.ToInt32(txtId.Text)
                            select a;
                foreach (var a in query)
                {
                    a.ID_JENIS_IDENTITAS = Convert.ToInt32(cbJenisIdentitas.SelectedValue);
                    a.NO_IDENTITAS = txtNoIdentitas.Text;
                    a.NAMA = txtNama.Text;
                    a.ALAMAT = txtAlamat.Text;
                    a.TELP = txtTelp.Text;
                }
            }
            context.SubmitChanges();
            Close();
        }
Beispiel #2
0
		private void detach_ADM_KONSUMENs(ADM_KONSUMEN entity)
		{
			this.SendPropertyChanging();
			entity.ADM_JENIS_IDENTITAS = null;
		}
Beispiel #3
0
 partial void DeleteADM_KONSUMEN(ADM_KONSUMEN instance);
Beispiel #4
0
 partial void UpdateADM_KONSUMEN(ADM_KONSUMEN instance);
Beispiel #5
0
 partial void InsertADM_KONSUMEN(ADM_KONSUMEN instance);