コード例 #1
0
 public void EntryPresensiMember(PresensiMemberEntity input)
 {
     presMember.EntriPresensiMember(input.Id_member, input.Jam_kedatangan, input.Keterangan, input.Id_jadwal);
 }
コード例 #2
0
        private void btnTambah_Click(object sender, EventArgs e)
        {
            string keterangan = "";

            if (flagperintah == 1)
            {
                if (cektxt() == true)
                {
                    errorProvider1.Clear();

                    //int IdMember = con.GetIdMemberByName(cmbMember.Text);
                    if (cmbJadwal.Text == "")
                    {
                        MessageBox.Show("Maaf, harap lengkapi data terlebih dahulu");
                        return;
                    }

                    else if (cmbJadwal.Text != null)
                    {
                        if (cmbJadwal.Text == "Gym")
                        {
                            keterangan = "Mengikuti Jadwal : " + 13;
                        }
                        else
                        {
                            keterangan = "";// "Mengikuti Jadwal : " + cmbJadwal.SelectedValue.ToString();//con.GetIdJadwalByPresensiMember((int)DateTime.Now.DayOfWeek, con.GetIdKelas(cmbJadwal.Text));
                        }
                    }

                    if (con.CekPresensiInstruktur(int.Parse(cmbJadwal.Text)) <= 0)
                    {
                        MessageBox.Show("Maaf, instruktur belum datang,harap presensi setelah instruktur datang. Terima Kasih");
                        return;
                    }

                    PresensiMemberEntity presmem = new PresensiMemberEntity(int.Parse(cmbMember.SelectedValue.ToString()), DateTime.Now, keterangan, int.Parse(cmbJadwal.Text.ToString()));
                    string id_jadwal             = new String(keterangan.Where(Char.IsDigit).ToArray());
                    if (int.Parse(getKolom(dataGridView1, 2)) != 13)
                    {
                        if (con.CekJumlahMember(int.Parse(cmbJadwal.Text)) >= 25)
                        {
                            MessageBox.Show("Maaf, kuota member sudah penuh.", "kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        if (con.CekDepositPertemuanKosong(int.Parse(cmbMember.SelectedValue.ToString()), int.Parse(getKolom(dataGridView1, 2))) > 0)
                        {
                            con.UpdateDepositPertemuan(int.Parse(cmbMember.SelectedValue.ToString()), int.Parse(getKolom(dataGridView1, 2)));
                        }
                        else
                        {
                            if (con.GetDepositUangByIdMember(int.Parse(cmbMember.SelectedValue.ToString())) > con.GetHargaKelasByIdMemberDanIdKelas(int.Parse(cmbJadwal.Text)))
                            {
                                con.KurangiDepositMember(int.Parse(cmbMember.SelectedValue.ToString()), decimal.Parse(con.GetHargaKelasByIdMemberDanIdKelas(int.Parse(cmbJadwal.Text)).ToString()));
                            }
                            else
                            {
                                MessageBox.Show("Maaf, deposit sudah habis", "kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }
                    con.EntryPresensiMember(presmem);

                    //DialogResult dr = MessageBox.Show("Apakah ingin cetak struk ?", "Pertanyaan", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    //if (dr == DialogResult.Yes) {
                    //    PresensiMember form = new PresensiMember();
                    //    form.Show();
                    //}

                    cleartxt();
                    this.Hide();
                    FormPresensiMember myParent = (FormPresensiMember)this.Parent;
                    myParent.enable();
                }
            }
        }