Esempio n. 1
0
        private void pegawaiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormPegawai utama = new FormPegawai();

            utama.ShowDialog();
            this.Close();
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            cleartxt();
            errorProvider1.Clear();
            this.Hide();
            FormPegawai myParent = (FormPegawai)this.Parent;

            myParent.enable();
        }
Esempio n. 3
0
        private void btnTambah_Click(object sender, EventArgs e)
        {
            try{
                if (flagperintah == 1)
                {
                    if (cektxt() == true)
                    {
                        errorProvider1.Clear();

                        int IDRole = Pcontrol.getIDRole(cmbJabatan.Text);
                        int idLast = Pcontrol.getLastIdPegawai() + 1;
                        if (IDRole == 4)
                        {
                            Pcontrol.EntryUserPegawai(IDRole, "Ins" + idLast, "123456");
                        }
                        else
                        {
                            Pcontrol.EntryUserPegawai(IDRole, "Pegawai" + idLast, "123456");
                        }
                        PegawaiEntity pegawai = new PegawaiEntity(IDRole, edNama.Text, edAlamat.Text, edEmail.Text, edNomor.Text, Pcontrol.getLastIdLogin());
                        if (Pcontrol.CekDataDuplikasi(pegawai) != 0)
                        {
                            MessageBox.Show("Maaf, data sudah ada." + Pcontrol.CekDataDuplikasi(pegawai), "Kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        Pcontrol.EntryPegawai(pegawai);
                        cleartxt();
                        this.Hide();
                        FormPegawai myParent = (FormPegawai)this.Parent;
                        myParent.enable();
                    }
                }

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

                        int           IDRole  = Pcontrol.getIDRole(cmbJabatan.Text);
                        PegawaiEntity pegawai = new PegawaiEntity(IDRole, edNama.Text, edAlamat.Text, edEmail.Text, edNomor.Text);
                        //if (Pcontrol.CekDataDuplikasi(pegawai) > 1) //Masih error code pengecekan ini
                        //{
                        //    MessageBox.Show("Maaf, data sudah ada." + Pcontrol.CekDataDuplikasi(pegawai), "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)
                        {
                            Pcontrol.EditPegawai(pegawai, int.Parse(txtID.Text));
                        }
                        cleartxt();
                        this.Hide();
                        FormPegawai myParent = (FormPegawai)this.Parent;
                        myParent.EnableEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Kesalahan", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            user = edUser.Text;
            pass = edPass.Text;

            if (lc.cekLogin(user, pass) == true)
            {
                role         = lc.getRoleUser(user, pass);
                last_id_lama = JC.LastIdBeforeUpdate();

                if (DateTime.Now.DayOfWeek.ToString() == 1.ToString())
                {
                    JC.GenerateOneWeekJadwal();
                    last_id_baru = JC.LastIdBeforeUpdate();
                }

                if (role == 1)
                {
                    this.Hide();
                    FormPegawai utama = new FormPegawai();
                    // utama.setToolStripUser("Pengguna : Admin - " + user);
                    utama.ShowDialog();
                    this.Close();
                }

                else if (role == 2)
                {
                    this.Hide();
                    FormPresensiInstruktur utama = new FormPresensiInstruktur();
                    //utama.setToolStripUser("Pengguna : Manajer Operasional - " + user);
                    utama.ShowDialog();
                    this.Close();
                }

                else if (role == 3)
                {
                    this.Hide();
                    Transaksi utama = new Transaksi();
                    //utama.setToolStripUser("Pengguna : Kasir - " + user);
                    utama.Pegawai      = lc.getIdPegawaiByIdLogin(lc.getIdByUsername(user));
                    utama.Nama_pegawai = lc.getNamaPegawai(lc.getIdByUsername(edUser.Text));
                    utama.ShowDialog();
                    this.Close();
                }

                else
                {
                    MessageBox.Show("Maaf user ini tidak memiliki hak untuk masuk ke sistem");
                }
            }

            else if (edUser.Text == "" || edPass.Text == "")
            {
                MessageBox.Show("Maaf, silahkan lengkapi data username dan password");
                if (edUser.Text == "")
                {
                    edUser.Text = "";
                    edUser.Focus();
                }
                else if (edPass.Text == "")
                {
                    edPass.Text = "";
                    edPass.Focus();
                }
            }

            else
            {
                MessageBox.Show("Maaf, username atau password salah");
                edUser.Text = "";
                edUser.Focus();
            }
        }