Example #1
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (WithErrors())
            {
                val.validateTextBox(txtGolongan, errorProvider1, "Golongan harus diisi.");
                val.validateTextBox(txtTarif, errorProvider1, "Tarif harus diisi.");

                return;
            }

            if (Convert.ToInt32(txtId.Text) == 0)
            {
                var tarif = new ADM_TARIF();
                tarif.GOLONGAN = txtGolongan.Text;
                tarif.TARIF = Convert.ToDecimal(txtTarif.Text);
                context.ADM_TARIFs.InsertOnSubmit(tarif);
            }
            else
            {
                var query = from a in context.ADM_TARIFs
                            where a.ID_TARIF == Convert.ToInt32(txtId.Text)
                            select a;
                foreach (var a in query)
                {
                    a.GOLONGAN = txtGolongan.Text;
                    a.TARIF = Convert.ToDecimal(txtTarif.Text);
                }
            }
            context.SubmitChanges();
            Close();
        }
Example #2
0
 partial void UpdateADM_TARIF(ADM_TARIF instance);
Example #3
0
 partial void DeleteADM_TARIF(ADM_TARIF instance);
Example #4
0
 partial void InsertADM_TARIF(ADM_TARIF instance);