private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (WithErrors())
            {
                val.validateTextBox(txtKode, errorProvider1, "Kode harus diisi.");
                val.validateTextBox(txtStatus, errorProvider1, "Status harus diisi.");

                return;
            }

            if (Convert.ToInt32(txtId.Text) == 0)
            {
                var status = new REF_STATUS();
                status.KODE_STATUS = txtKode.Text;
                status.STATUS = txtStatus.Text;
                context.REF_STATUS.InsertOnSubmit(status);
            }
            else
            {
                var query = from a in context.REF_STATUS
                            where a.ID_STATUS == Convert.ToInt32(txtId.Text)
                            select a;
                foreach (var a in query)
                {
                    a.KODE_STATUS = txtKode.Text;
                    a.STATUS = txtStatus.Text;
                }
            }
            context.SubmitChanges();
            Close();
        }
Beispiel #2
0
 partial void DeleteREF_STATUS(REF_STATUS instance);
Beispiel #3
0
 partial void UpdateREF_STATUS(REF_STATUS instance);
Beispiel #4
0
 partial void InsertREF_STATUS(REF_STATUS instance);