private void Child_Insert(ProductEdit parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("Invoices"))
     {
         using (var cmd = new SqlCommand("dbo.AddProductSupplierItem", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@ProductId", parent.ProductId).DbType = DbType.Guid;
             cmd.Parameters.AddWithValue("@ProductSupplierId", ReadProperty(ProductSupplierIdProperty)).Direction = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@SupplierId", ReadProperty(SupplierIdProperty)).DbType = DbType.Int32;
             var args = new DataPortalHookArgs(cmd);
             OnInsertPre(args);
             cmd.ExecuteNonQuery();
             OnInsertPost(args);
             LoadProperty(ProductSupplierIdProperty, (int)cmd.Parameters["@ProductSupplierId"].Value);
         }
     }
 }
 private void Child_Insert(ProductEdit parent)
 {
     using (var dalManager = DalFactoryInvoices.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IProductSupplierItemDal>();
         using (BypassPropertyChecks)
         {
             int productSupplierId = -1;
             dal.Insert(
                 parent.ProductId,
                 out productSupplierId,
                 SupplierId
                 );
             LoadProperty(ProductSupplierIdProperty, productSupplierId);
         }
         OnInsertPost(args);
     }
 }
        private void Child_Insert(ProductEdit parent)
        {
            var dto = new ProductSupplierItemDto();

            dto.Parent_ProductId = parent.ProductId;
            dto.SupplierId       = SupplierId;
            using (var dalManager = DalFactoryInvoices.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IProductSupplierItemDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    LoadProperty(ProductSupplierIdProperty, resultDto.ProductSupplierId);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }