private void Child_DeleteSelf(G06_Country parent) { using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(); OnDeletePre(args); var dal = dalManager.GetProvider <IG07_Country_ChildDal>(); using (BypassPropertyChecks) { dal.Delete(parent.Country_ID); } OnDeletePost(args); } }
private void Child_DeleteSelf(G06_Country parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("DeleteG07_Country_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Country_ID2", parent.Country_ID).DbType = DbType.Int32; var args = new DataPortalHookArgs(cmd); OnDeletePre(args); cmd.ExecuteNonQuery(); OnDeletePost(args); } } }
private void Child_Insert(G06_Country parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG07_Country_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Country_ID1", parent.Country_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Country_Child_Name", ReadProperty(Country_Child_NameProperty)).DbType = DbType.String; var args = new DataPortalHookArgs(cmd); OnInsertPre(args); cmd.ExecuteNonQuery(); OnInsertPost(args); } } }
private void Child_Insert(G06_Country parent) { var dto = new G07_Country_ReChildDto(); dto.Parent_Country_ID = parent.Country_ID; dto.Country_Child_Name = Country_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IG07_Country_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }
private void Child_Insert(G06_Country parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG08_Region", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Parent_Country_ID", parent.Country_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Region_ID", ReadProperty(Region_IDProperty)).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@Region_Name", ReadProperty(Region_NameProperty)).DbType = DbType.String; var args = new DataPortalHookArgs(cmd); OnInsertPre(args); cmd.ExecuteNonQuery(); OnInsertPost(args); LoadProperty(Region_IDProperty, (int)cmd.Parameters["@Region_ID"].Value); } // flushes all pending data operations FieldManager.UpdateChildren(this); } }
private void Child_Update(G06_Country parent) { if (!IsDirty) { return; } using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(); OnUpdatePre(args); var dal = dalManager.GetProvider <IG07_Country_ChildDal>(); using (BypassPropertyChecks) { dal.Update( parent.Country_ID, Country_Child_Name ); } OnUpdatePost(args); } }
private void Child_Insert(G06_Country parent) { using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(); OnInsertPre(args); var dal = dalManager.GetProvider <IG08_RegionDal>(); using (BypassPropertyChecks) { int region_ID = -1; dal.Insert( parent.Country_ID, out region_ID, Region_Name ); LoadProperty(Region_IDProperty, region_ID); } OnInsertPost(args); // flushes all pending data operations FieldManager.UpdateChildren(this); } }
private void Child_Insert(G06_Country parent) { var dto = new G08_RegionDto(); dto.Parent_Country_ID = parent.Country_ID; dto.Region_Name = Region_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IG08_RegionDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); LoadProperty(Region_IDProperty, resultDto.Region_ID); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); // flushes all pending data operations FieldManager.UpdateChildren(this); } }