public DataSalesHead() { InitializeComponent(); SHBS.PositionChanged += SHBS_PositionChanged; k_coll = SHUOW.Query <KaryawansModel>(); b_coll = SHUOW.Query <BranchmanagersModel>(); }
private void Hapus_Click(object sender, EventArgs e) { DialogResult dialog = MessageBox.Show("Yakin ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialog == DialogResult.Yes) { SalesheadsModel salesheads = (SalesheadsModel)SHBS.Current; SHXpCollection.Remove(salesheads); salesheads.Delete(); SHUOW.CommitChanges(); } }
private void Simpan_Click(object sender, EventArgs e) { if (!validator.Validate()) { return; } SalesheadsModel salesheads = (SalesheadsModel)SHBS.Current; salesheads.karyawanId = k_coll.FirstOrDefault(k => k.id == Convert.ToInt64(karyawanid.EditValue)); salesheads.branchManagerId = b_coll.FirstOrDefault(b => b.id == Convert.ToInt64(branchmanagerid.EditValue)); if (salesheads.createdAt == null) { salesheads.createdAt = DateTime.Now; } salesheads.updatedAt = DateTime.Now; salesheads.Save(); SHXpCollection.Add(salesheads); SHUOW.CommitChanges(); SHBS.EndEdit(); ViewState(); }