private void btnSimpan_Click(object sender, EventArgs e)
        {
            try
            {
                fingerprintEntities fp     = new fingerprintEntities();
                upload_download     upload = new upload_download();
                upload.upload_download_keterangan = "Data " + dtTanggal1.Value.ToString("dd MMMM yyyy") + " s/d " + dtTanggal2.Value.ToString("dd MMMM yyyy");
                upload.upload_download_jenis      = "Upload Absen";
                upload.upload_download_tanggal    = DateTime.Now;
                fp.upload_download.Add(upload);
                fp.SaveChanges();

                FormProsesUploadAbsensiKeWeb proses = new FormProsesUploadAbsensiKeWeb();
                proses.tgl1          = dtTanggal1.Value;
                proses.tgl2          = dtTanggal2.Value;
                proses.StartPosition = FormStartPosition.CenterParent;
                proses.ShowDialog(this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                fingerprintEntities fp = new fingerprintEntities();
                fp.Database.ExecuteSqlCommand("delete from aturan");

                aturan senin = new aturan();
                senin.aturan_hari              = 2;
                senin.aturan_kegiatan          = cbHariSenin.Checked;
                senin.aturan_jam_masuk         = dtMasukSenin.Value.TimeOfDay;
                senin.aturan_jam_pulang        = dtPulangSenin.Value.TimeOfDay;
                senin.aturan_jam_masuk_khusus  = dtMasukKhususSenin.Value.TimeOfDay;
                senin.aturan_jam_pulang_khusus = dtPulangKhususSenin.Value.TimeOfDay;
                fp.aturans.Add(senin);

                aturan selasa = new aturan();
                selasa.aturan_hari              = 3;
                selasa.aturan_kegiatan          = cbHariSelasa.Checked;
                selasa.aturan_jam_masuk         = dtMasukSelasa.Value.TimeOfDay;
                selasa.aturan_jam_pulang        = dtPulangSelasa.Value.TimeOfDay;
                selasa.aturan_jam_masuk_khusus  = dtMasukKhususSelasa.Value.TimeOfDay;
                selasa.aturan_jam_pulang_khusus = dtPulangKhususSelasa.Value.TimeOfDay;
                fp.aturans.Add(selasa);

                aturan rabu = new aturan();
                rabu.aturan_hari              = 4;
                rabu.aturan_kegiatan          = cbHariRabu.Checked;
                rabu.aturan_jam_masuk         = dtMasukRabu.Value.TimeOfDay;
                rabu.aturan_jam_pulang        = dtPulangRabu.Value.TimeOfDay;
                rabu.aturan_jam_masuk_khusus  = dtMasukKhususRabu.Value.TimeOfDay;
                rabu.aturan_jam_pulang_khusus = dtPulangKhususRabu.Value.TimeOfDay;
                fp.aturans.Add(rabu);

                aturan kamis = new aturan();
                kamis.aturan_hari              = 5;
                kamis.aturan_kegiatan          = cbHariKamis.Checked;
                kamis.aturan_jam_masuk         = dtMasukKamis.Value.TimeOfDay;
                kamis.aturan_jam_pulang        = dtPulangKamis.Value.TimeOfDay;
                kamis.aturan_jam_masuk_khusus  = dtMasukKhususKamis.Value.TimeOfDay;
                kamis.aturan_jam_pulang_khusus = dtPulangKhususKamis.Value.TimeOfDay;
                fp.aturans.Add(kamis);

                aturan jumat = new aturan();
                jumat.aturan_hari              = 6;
                jumat.aturan_kegiatan          = cbHariJumat.Checked;
                jumat.aturan_jam_masuk         = dtMasukJumat.Value.TimeOfDay;
                jumat.aturan_jam_pulang        = dtPulangJumat.Value.TimeOfDay;
                jumat.aturan_jam_masuk_khusus  = dtMasukKhususJumat.Value.TimeOfDay;
                jumat.aturan_jam_pulang_khusus = dtPulangKhususJumat.Value.TimeOfDay;
                fp.aturans.Add(jumat);

                aturan sabtu = new aturan();
                sabtu.aturan_hari              = 7;
                sabtu.aturan_kegiatan          = cbHariSabtu.Checked;
                sabtu.aturan_jam_masuk         = dtMasukSabtu.Value.TimeOfDay;
                sabtu.aturan_jam_pulang        = dtPulangSabtu.Value.TimeOfDay;
                sabtu.aturan_jam_masuk_khusus  = dtMasukKhususSabtu.Value.TimeOfDay;
                sabtu.aturan_jam_pulang_khusus = dtPulangKhususSabtu.Value.TimeOfDay;
                fp.aturans.Add(sabtu);

                aturan minggu = new aturan();
                minggu.aturan_hari              = 1;
                minggu.aturan_kegiatan          = cbHariMinggu.Checked;
                minggu.aturan_jam_masuk         = dtMasukMinggu.Value.TimeOfDay;
                minggu.aturan_jam_pulang        = dtPulangMinggu.Value.TimeOfDay;
                minggu.aturan_jam_masuk_khusus  = dtMasukKhususMinggu.Value.TimeOfDay;
                minggu.aturan_jam_pulang_khusus = dtPulangKhususMinggu.Value.TimeOfDay;
                fp.aturans.Add(minggu);

                fp.SaveChanges();
                MessageBox.Show("Berhasil menyimpan data aturan");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public FormUploadAbsensiKeWeb(fingerprintEntities db)
 {
     InitializeComponent();
     dtTanggal1.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
     dtTanggal2.Value = DateTime.Now;
 }