/// <summary> /// Existing <see cref="SupplierInfo"/> object is updated by <see cref="SupplierEdit"/> Saved event. /// </summary> internal static SupplierInfo LoadInfo(SupplierEdit supplierEdit) { var info = new SupplierInfo(); info.UpdatePropertiesOnSaved(supplierEdit); return(info); }
private void Child_Insert(SupplierEdit parent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager(Database.InvoicesConnection, false)) { using (var cmd = new SqlCommand("dbo.AddSupplierProductItem", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SupplierId", parent.SupplierId).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@ProductSupplierId", ReadProperty(ProductSupplierIdProperty)).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@ProductId", ReadProperty(ProductIdProperty)).DbType = DbType.Guid; var args = new DataPortalHookArgs(cmd); OnInsertPre(args); cmd.ExecuteNonQuery(); OnInsertPost(args); LoadProperty(ProductSupplierIdProperty, (int)cmd.Parameters["@ProductSupplierId"].Value); } } }
private void Child_Insert(SupplierEdit parent) { using (var dalManager = DalFactoryInvoices.GetManager()) { var args = new DataPortalHookArgs(); OnInsertPre(args); var dal = dalManager.GetProvider <ISupplierProductItemDal>(); using (BypassPropertyChecks) { int productSupplierId = -1; dal.Insert( parent.SupplierId, out productSupplierId, ProductId ); LoadProperty(ProductSupplierIdProperty, productSupplierId); } OnInsertPost(args); } }
private void Child_Insert(SupplierEdit parent) { var dto = new SupplierProductItemDto(); dto.Parent_SupplierId = parent.SupplierId; dto.ProductId = ProductId; using (var dalManager = DalFactoryInvoices.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <ISupplierProductItemDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); LoadProperty(ProductSupplierIdProperty, resultDto.ProductSupplierId); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }
/// <summary> /// Properties on <see cref="SupplierInfo"/> object are updated by <see cref="SupplierEdit"/> Saved event. /// </summary> internal void UpdatePropertiesOnSaved(SupplierEdit supplierEdit) { LoadProperty(SupplierIdProperty, supplierEdit.SupplierId); LoadProperty(NameProperty, supplierEdit.Name); }