Exemple #1
0
        private void lbl_hapus_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (lvwAbsen.SelectedItems.Count > 0)
            {
                var konfirmasi = MessageBox.Show("Apakah daftar ini ingin dihapus?", "Konfirmasi",
                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

                if (konfirmasi == DialogResult.Yes)
                {
                    // ambil objek mhs yang mau dihapus dari collection
                    Model.Entity.Absensi absen = listOfAbsensi[lvwAbsen.SelectedIndices[0]];

                    // panggil operasi CRUD
                    var result = controller.Delete(absen);
                    if (result > 0)
                    {
                        LoadDataAbsen();
                    }
                }
            }
            else // data belum dipilih
            {
                MessageBox.Show("Daftar belum dipilih !!!", "Peringatan",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #2
0
        private void bunifuButton5_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_search.Text))
            {
                MessageBox.Show("Kamu belum memasukkan ID karyawan !!!", "Peringatan",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                Model.Entity.Absensi absen = new Model.Entity.Absensi();
                absen.Id_karyawan = Convert.ToInt32(txt_search.Text);
                absen.Tanggal     = Convert.ToDateTime(DateTime.Now.ToLongDateString());
                absen.Jam_masuk   = Convert.ToDateTime(DateTime.Now.ToShortTimeString());

                int result = 0;
                result = controller.Create(absen);
                if (result > 0)
                {
                    LoadDataAbsen();
                    txt_search.Clear();
                }
            }
        }