private void Simpan_Click(object sender, EventArgs e) { if (!validator.Validate()) { return; } KaryawansModel karyawans = (KaryawansModel)KaryawanBS.Current; karyawans.divisiId = d_coll.FirstOrDefault(d => d.id == Convert.ToInt64(divisi.EditValue)); karyawans.jabatanId = j_coll.FirstOrDefault(j => j.id == Convert.ToInt64(jabatan.EditValue)); karyawans.branchId = b_coll.FirstOrDefault(b => b.id == Convert.ToInt64(branch.EditValue)); karyawans.createdAt = DateTime.Now; karyawans.updatedAt = DateTime.Now; karyawans.Save(); KaryawanXpCollection.Add(karyawans); KaryawanUnitOfWork.CommitChanges(); KaryawanBS.EndEdit(); Simpan.Enabled = false; Batal.Enabled = false; Tambah.Enabled = true; gridControl1.Enabled = true; nama_karyawan.Properties.ReadOnly = true; alamat.Properties.ReadOnly = true; tanggal_masuk.Properties.ReadOnly = true; tanggal_resign.Properties.ReadOnly = true; keterangan_resign.Properties.ReadOnly = true; divisi.Properties.ReadOnly = true; jabatan.Properties.ReadOnly = true; branch.Properties.ReadOnly = true; }
public DataKaryawan() { InitializeComponent(); KaryawanBS.PositionChanged += KaryawanBS_PositionChanged; d_coll = KaryawanUnitOfWork.Query <DivisisModel>(); j_coll = KaryawanUnitOfWork.Query <JabatansModel>(); b_coll = KaryawanUnitOfWork.Query <BranchesModel>(); }
private void Hapus_Click(object sender, EventArgs e) { DialogResult dialog = MessageBox.Show("Yakin ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialog == DialogResult.Yes) { KaryawansModel karyawansModel = (KaryawansModel)KaryawanBS.Current; KaryawanXpCollection.Remove(karyawansModel); karyawansModel.Delete(); KaryawanUnitOfWork.CommitChanges(); } }