private void Child_DeleteSelf(G08_Region parent) { using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(); OnDeletePre(args); var dal = dalManager.GetProvider <IG09_Region_ChildDal>(); using (BypassPropertyChecks) { dal.Delete(parent.Region_ID); } OnDeletePost(args); } }
private void Child_DeleteSelf(G08_Region parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("DeleteG09_Region_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Region_ID1", parent.Region_ID).DbType = DbType.Int32; var args = new DataPortalHookArgs(cmd); OnDeletePre(args); cmd.ExecuteNonQuery(); OnDeletePost(args); } } }
private void Child_Insert(G08_Region parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG09_Region_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Region_ID2", parent.Region_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Region_Child_Name", ReadProperty(Region_Child_NameProperty)).DbType = DbType.String; var args = new DataPortalHookArgs(cmd); OnInsertPre(args); cmd.ExecuteNonQuery(); OnInsertPost(args); } } }
private void Child_Insert(G08_Region parent) { var dto = new G09_Region_ReChildDto(); dto.Parent_Region_ID = parent.Region_ID; dto.Region_Child_Name = Region_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IG09_Region_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }
private void Child_Insert(G08_Region parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG10_City", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Parent_Region_ID", parent.Region_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@City_ID", ReadProperty(City_IDProperty)).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@City_Name", ReadProperty(City_NameProperty)).DbType = DbType.String; var args = new DataPortalHookArgs(cmd); OnInsertPre(args); cmd.ExecuteNonQuery(); OnInsertPost(args); LoadProperty(City_IDProperty, (int)cmd.Parameters["@City_ID"].Value); } // flushes all pending data operations FieldManager.UpdateChildren(this); } }
private void Child_Update(G08_Region parent) { if (!IsDirty) { return; } using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(); OnUpdatePre(args); var dal = dalManager.GetProvider <IG09_Region_ChildDal>(); using (BypassPropertyChecks) { dal.Update( parent.Region_ID, Region_Child_Name ); } OnUpdatePost(args); } }
private void Child_Insert(G08_Region parent) { using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(); OnInsertPre(args); var dal = dalManager.GetProvider <IG10_CityDal>(); using (BypassPropertyChecks) { int city_ID = -1; dal.Insert( parent.Region_ID, out city_ID, City_Name ); LoadProperty(City_IDProperty, city_ID); } OnInsertPost(args); // flushes all pending data operations FieldManager.UpdateChildren(this); } }
private void Child_Insert(G08_Region parent) { var dto = new G10_CityDto(); dto.Parent_Region_ID = parent.Region_ID; dto.City_Name = City_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IG10_CityDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); LoadProperty(City_IDProperty, resultDto.City_ID); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); // flushes all pending data operations FieldManager.UpdateChildren(this); } }