Пример #1
0
        private void memberToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormMember form = new FormMember();

            form.ShowDialog();
            this.Close();
        }
Пример #2
0
        private void btnBatal_Click(object sender, EventArgs e)
        {
            cleartxt();
            errorProvider1.Clear();
            this.Hide();
            FormMember myParent = (FormMember)this.Parent;

            myParent.enable();
        }
Пример #3
0
        private void registerMemberToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormMember utama = new FormMember();

            utama.Pegawai = "Kasir";
            utama.ShowDialog();
            this.Close();
        }
Пример #4
0
        private void btnTambah_Click(object sender, EventArgs e)
        {
            try
            {
                if (flagperintah == 1)
                {
                    if (cektxt() == true)
                    {
                        errorProvider1.Clear();

                        //cekTanggalLahir tidak boleh kurang dari tanggal sekarang
                        if (dateTimePicker1.Value >= DateTime.Now)
                        {
                            MessageBox.Show("Maaf, tanggal lahir anda salah");
                            return;
                        }

                        if (Mcontrol.CekMemberUnik(edNama.Text, edAlamat.Text, edEmail.Text) != 0)
                        {
                            MessageBox.Show("Maaf, data sudah ada. " + Mcontrol.CekMemberUnik(edNama.Text, edAlamat.Text, edEmail.Text), "Kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        Mcontrol.EntryMember(edNama.Text, edEmail.Text, edAlamat.Text, dateTimePicker1.Value.ToString("dd/MM"), dateTimePicker1.Value.ToString("yy"));
                        if (Mcontrol.cekAdaTidakRecordMember(DateTime.Now.Month.ToString(), DateTime.Now.Year.ToString()) == 0)
                        {
                            Mcontrol.InsertRecordMemberBaru(DateTime.Now.Month.ToString(), DateTime.Now.Year.ToString(), Mcontrol.totalMemberAktif(), Mcontrol.totalMemberNonAktif(),
                                                            Mcontrol.totalMemberAktif() + Mcontrol.totalMemberNonAktif());
                        }
                        else
                        {
                            Mcontrol.TambahNonAktifMember(DateTime.Now.Month.ToString(), DateTime.Now.Year.ToString());
                        }

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

                else
                {
                    if (cektxt() == true)
                    {
                        errorProvider1.Clear();

                        //if (Mcontrol.CekMemberUnik(edNama.Text, edAlamat.Text, edEmail.Text) > 1) // masih error, salah harusnya ga masuk sini saat edit
                        //{
                        //    MessageBox.Show("Maaf, data sudah ada. " + Mcontrol.CekMemberUnik(edNama.Text, edAlamat.Text, edEmail.Text), "Kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //    return;
                        //}
                        DialogResult dr = MessageBox.Show("Apakah Anda yakin akan mengupdate pegawai ini ?", "Pertanyaan",
                                                          MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (dr == DialogResult.Yes)
                        {
                            Mcontrol.EditMember(edNama.Text, edAlamat.Text, edEmail.Text, int.Parse(txtID.Text));
                        }
                        cleartxt();
                        this.Hide();
                        FormMember myParent = (FormMember)this.Parent;
                        myParent.EnableEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }