private void Simpan_Click(object sender, EventArgs e) { if (!validator.Validate()) { return; } SalesModel sales = (SalesModel)SalesBS.Current; sales.salesheadId = sh_coll.First(sh => sh.id == Convert.ToInt64(salesheadid.EditValue)); sales.createdAt = DateTime.Now; sales.updatedAt = DateTime.Now; sales.Save(); SalesXpCollection.Add(sales); SalesUOW.CommitChanges(); SalesBS.EndEdit(); SetDisabled(); Tambah.Enabled = true; Simpan.Enabled = false; Batal.Enabled = false; Edit.Enabled = true; Hapus.Enabled = true; gridControl1.Enabled = true; }
private void Hapus_Click(object sender, EventArgs e) { DialogResult dialog = MessageBox.Show("Yakin ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialog == DialogResult.Yes) { SalesModel sales = (SalesModel)SalesBS.Current; sales.Delete(); SalesXpCollection.Remove(sales); SalesUOW.CommitChanges(); } }
public DataSales() { InitializeComponent(); SalesBS.PositionChanged += SalesBS_PositionChanged; sh_coll = SalesUOW.Query <SalesheadsModel>(); }