Example #1
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (WithErrors())
            {
                val.validateTextBox(txtKode, errorProvider1, "Kode harus diisi.");
                val.validateTextBox(txtPeran, errorProvider1, "Peran harus diisi.");

                return;
            }

            if (Convert.ToInt32(txtId.Text) == 0)
            {
                var peran = new REF_PERAN();
                peran.KODE_PERAN = txtKode.Text;
                peran.PERAN = txtPeran.Text;
                context.REF_PERANs.InsertOnSubmit(peran);
            }
            else
            {
                var query = from a in context.REF_PERANs
                            where a.ID_PERAN == Convert.ToInt32(txtId.Text)
                            select a;
                foreach (var a in query)
                {
                    a.KODE_PERAN = txtKode.Text;
                    a.PERAN = txtPeran.Text;
                }
            }
            context.SubmitChanges();
            Close();
        }
Example #2
0
 partial void UpdateREF_PERAN(REF_PERAN instance);
Example #3
0
 partial void DeleteREF_PERAN(REF_PERAN instance);
Example #4
0
 partial void InsertREF_PERAN(REF_PERAN instance);