private void btnSimpanBobot_Click(object sender, EventArgs e) { if (isBatasAtasBawah) { if (String.IsNullOrEmpty(this.edtBobot.Text) || String.IsNullOrEmpty(this.edtBatasAtasBobot.Text) || String.IsNullOrEmpty(this.edtBatasBawahBobot.Text)) { MessageBox.Show("Silahkan isi nominal bobot dan batas atas dan batas bawah untuk bobot yang dimaksud!"); } else { tbl_bobot temp = new tbl_bobot(0, Convert.ToDouble(this.edtBobot.Text), this.edtHeaderBobot.Text, this.edtDesBobot.Text, Convert.ToDouble(this.edtBatasBawahBobot.Text), Convert.ToDouble(this.edtBatasAtasBobot.Text), "Y", refJawabanControl.getIdRefJawabanBasedOnJawaban(this.edtJawaban.Text)); simpanBobotBaru(temp); this.dataGridView1.Refresh(); } } else { if (String.IsNullOrEmpty(this.edtBobot.Text)) { MessageBox.Show("Silahkan isi nomimal bobot terlebih dahulu!"); } else { tbl_bobot temp = new tbl_bobot(0, Convert.ToDouble(this.edtBobot.Text), this.edtHeaderBobot.Text, this.edtDesBobot.Text, 0, 0, "Y", Convert.ToInt32(this.cmbPertanyaan.SelectedValue)); simpanBobotBaru(temp); this.dataGridView1.Refresh(); } } }
private void simpanBobotBaru(tbl_bobot temp) { try { bobotControl.insertBobotBaru(temp); MessageBox.Show("Data jawaban dan bobot baru berhasil di masukan!"); idJawabanBaru = Convert.ToInt32(this.cmbPertanyaan.SelectedValue); clearBobot(); } catch (Exception E) { MessageBox.Show("Terjadi kesalahan pada saat memasukan bobot baru, silahkan hubungi admin dengan error code : " + E.Message); } dataGridView1.Refresh(); }
/// <summary> /// The insertBobotBaru /// </summary> /// <param name="temp">The temp<see cref="tbl_bobot"/></param> /// <returns>The <see cref="int"/></returns> public int insertBobotBaru(tbl_bobot temp) { return(bobotAdapter.insertBobotBaru(this.getLastIndexbobot(), (decimal)temp.bobot, temp.header_bobot, temp.deskripsi_bobot, (decimal)temp.batas_bawah_bobot, (decimal)temp.batas_atas_bobot, temp.is_custom, temp.id_ref_jawaban)); }