Пример #1
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (WithErrors())
            {
                val.validateTextBox(txtNama, errorProvider1, "Nama harus diisi.");
                val.validateTextBox(txtAlamat, errorProvider1, "Alamat harus diisi.");
                val.validateTextBox(txtTelp, errorProvider1, "Telepon harus diisi.");
                val.validateTextBox(txtNoSIM, errorProvider1, "No. SIM harus diisi.");

                return;
            }

            if (Convert.ToInt32(txtId.Text) == 0)
            {
                var supir = new REF_SUPIR();
                supir.NAMA = txtNama.Text;
                supir.ALAMAT = txtAlamat.Text;
                supir.TELP = txtTelp.Text;
                supir.NO_SIM = Convert.ToInt32(txtNoSIM.Text);
                context.REF_SUPIRs.InsertOnSubmit(supir);
            }
            else
            {
                var query = from a in context.REF_SUPIRs
                            where a.ID_SUPIR == Convert.ToInt32(txtId.Text)
                            select a;
                foreach (var a in query)
                {
                    a.NAMA = txtNama.Text;
                    a.ALAMAT = txtAlamat.Text;
                    a.TELP = txtTelp.Text;
                    a.NO_SIM = Convert.ToInt32(txtNoSIM.Text);
                }
            }
            context.SubmitChanges();
            Close();
        }
Пример #2
0
 partial void DeleteREF_SUPIR(REF_SUPIR instance);
Пример #3
0
 partial void UpdateREF_SUPIR(REF_SUPIR instance);
Пример #4
0
 partial void InsertREF_SUPIR(REF_SUPIR instance);