public void CallDataPortalOverrides() { IDataPortal <ParentEntity> dataPortal = _testDIContext.CreateDataPortal <ParentEntity>(); TestResults.Reinitialise(); ParentEntity parent = ParentEntity.NewParentEntity(dataPortal); parent.Data = "something"; Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(true, parent.IsNew); Assert.AreEqual(true, parent.IsDirty); Assert.AreEqual(true, parent.IsSavable); parent = parent.Save(); Assert.AreEqual("Inserted", TestResults.GetResult("ParentEntity")); Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(false, parent.IsNew); Assert.AreEqual(false, parent.IsDirty); Assert.AreEqual(false, parent.IsSavable); parent.Data = "something new"; Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(false, parent.IsNew); Assert.AreEqual(true, parent.IsDirty); Assert.AreEqual(true, parent.IsSavable); parent = parent.Save(); Assert.AreEqual("Updated", TestResults.GetResult("ParentEntity")); parent.Delete(); Assert.AreEqual(true, parent.IsDeleted); parent = parent.Save(); Assert.AreEqual("Deleted Self", TestResults.GetResult("ParentEntity")); ParentEntity.DeleteParentEntity(33, dataPortal); Assert.AreEqual("Deleted", TestResults.GetResult("ParentEntity")); Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(true, parent.IsNew); Assert.AreEqual(true, parent.IsDirty); Assert.AreEqual(true, parent.IsSavable); ParentEntity.GetParentEntity(33, dataPortal); Assert.AreEqual("Fetched", TestResults.GetResult("ParentEntity")); }
public void CallDataPortalOverrides() { Csla.ApplicationContext.GlobalContext.Clear(); ParentEntity parent = ParentEntity.NewParentEntity(); parent.Data = "something"; Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(true, parent.IsNew); Assert.AreEqual(true, parent.IsDirty); Assert.AreEqual(true, parent.IsSavable); parent = parent.Save(); Assert.AreEqual("Inserted", Csla.ApplicationContext.GlobalContext["ParentEntity"]); Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(false, parent.IsNew); Assert.AreEqual(false, parent.IsDirty); Assert.AreEqual(false, parent.IsSavable); parent.Data = "something new"; Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(false, parent.IsNew); Assert.AreEqual(true, parent.IsDirty); Assert.AreEqual(true, parent.IsSavable); parent = parent.Save(); Assert.AreEqual("Updated", Csla.ApplicationContext.GlobalContext["ParentEntity"]); parent.Delete(); Assert.AreEqual(true, parent.IsDeleted); parent = parent.Save(); Assert.AreEqual("Deleted Self", Csla.ApplicationContext.GlobalContext["ParentEntity"]); ParentEntity.DeleteParentEntity(33); Assert.AreEqual("Deleted", Csla.ApplicationContext.GlobalContext["ParentEntity"]); Assert.AreEqual(false, parent.IsDeleted); Assert.AreEqual(true, parent.IsValid); Assert.AreEqual(true, parent.IsNew); Assert.AreEqual(true, parent.IsDirty); Assert.AreEqual(true, parent.IsSavable); ParentEntity.GetParentEntity(33); Assert.AreEqual("Fetched", Csla.ApplicationContext.GlobalContext["ParentEntity"]); }
private void simpleButton1_Click(object sender, EventArgs e) { if (DialogMode) { return; } try { pe.Save(); XtraMessageBox.Show(Text + " sudah Tersimpan !", "Konfirmasi Simpan " + Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { ep.UpdateBinding(); pe.ClearError(); XtraMessageBox.Show(ex.Message, "Error Simpan " + Text, MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = System.Windows.Forms.DialogResult.None; } }
/// <summary> /// Menyimpan Entity Aktif /// </summary> public int Save(bool CallRule, bool CallValidateError) { return(_Entity.Save(Dp, CallRule, CallValidateError)); }