Ejemplo n.º 1
0
 /// <summary>
 /// Creates or loads a <see cref="InvoiceCreatorGetter"/> unit of objects, based on given criteria.
 /// </summary>
 /// <param name="crit">The create/fetch criteria.</param>
 protected void DataPortal_Fetch(Criteria1 crit)
 {
     if (crit.CreateInvoiceEdit)
     {
         LoadProperty(InvoiceProperty, InvoiceEdit.NewInvoiceEdit());
     }
     else
     {
         LoadProperty(InvoiceProperty, InvoiceEdit.GetInvoiceEdit(crit.InvoiceId));
     }
     LoadProperty(ProductTypesProperty, ProductTypeNVL.GetProductTypeNVL());
 }
Ejemplo n.º 2
0
 private void Child_Insert(InvoiceEdit parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager(Database.InvoicesConnection, false))
     {
         using (var cmd = new SqlCommand("dbo.AddInvoiceLineItem", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@InvoiceId", parent.InvoiceId).DbType = DbType.Guid;
             cmd.Parameters.AddWithValue("@InvoiceLineId", ReadProperty(InvoiceLineIdProperty)).DbType = DbType.Guid;
             cmd.Parameters.AddWithValue("@ProductId", ReadProperty(ProductIdProperty)).DbType         = DbType.Guid;
             cmd.Parameters.AddWithValue("@Cost", ReadProperty(CostProperty)).DbType = DbType.Decimal;
             cmd.Parameters.AddWithValue("@PercentDiscount", ReadProperty(PercentDiscountProperty)).DbType = DbType.Byte;
             var args = new DataPortalHookArgs(cmd);
             OnInsertPre(args);
             cmd.ExecuteNonQuery();
             OnInsertPost(args);
         }
     }
 }
Ejemplo n.º 3
0
 private void Child_Insert(InvoiceEdit parent)
 {
     using (var dalManager = DalFactoryInvoices.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IInvoiceLineItemDal>();
         using (BypassPropertyChecks)
         {
             dal.Insert(
                 parent.InvoiceId,
                 InvoiceLineId,
                 ProductId,
                 Cost,
                 PercentDiscount
                 );
         }
         OnInsertPost(args);
     }
 }
        private void Child_Insert(InvoiceEdit parent)
        {
            var dto = new InvoiceLineItemDto();

            dto.Parent_InvoiceId = parent.InvoiceId;
            dto.InvoiceLineId    = InvoiceLineId;
            dto.ProductId        = ProductId;
            dto.Cost             = Cost;
            dto.PercentDiscount  = PercentDiscount;
            using (var dalManager = DalFactoryInvoices.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IInvoiceLineItemDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }
 /// <summary>
 /// Creates a new <see cref="InvoiceCreator"/> unit of objects.
 /// </summary>
 /// <remarks>
 /// ReadOnlyBase&lt;T&gt; doesn't allow the use of DataPortal_Create and thus DataPortal_Fetch is used.
 /// </remarks>
 protected void DataPortal_Fetch()
 {
     LoadProperty(InvoiceProperty, InvoiceEdit.NewInvoiceEdit());
     LoadProperty(ProductTypesProperty, ProductTypeNVL.GetProductTypeNVL());
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Loads a <see cref="InvoiceGetter"/> unit of objects, based on given criteria.
 /// </summary>
 /// <param name="invoiceId">The fetch criteria.</param>
 protected void DataPortal_Fetch(Guid invoiceId)
 {
     LoadProperty(InvoiceProperty, InvoiceEdit.GetInvoiceEdit(invoiceId));
     LoadProperty(ProductTypesProperty, ProductTypeNVL.GetProductTypeNVL());
 }