/// <summary>
        /// Set Value Mapper
        /// </summary>
        /// <param name="model">Clear Statistics Model</param>
        /// <param name="entity">Clear Statistics Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            if (model.ClearCustomerStatistics == ClearCustomerStatistics.Yes)
            {
                entity.SetValue(ClearStatistics.Index.ClearCustomerStatistics,
                                model.ClearCustomerStatistics);
                entity.SetValue(ClearStatistics.Index.FromCustomerNo, model.FromCustomerNo);
                entity.SetValue(ClearStatistics.Index.ToCustomerNo, model.ToCustomerNo);
                entity.SetValue(ClearStatistics.Index.ThroughCustomerYear, model.ThroughCustomerYear);
                entity.SetValue(ClearStatistics.Index.ThroughCustomerPeriod, model.ThroughCustomerPeriod);
            }

            if (model.ClearGroupStatistics == ClearGroupStatistics.Yes)
            {
                entity.SetValue(ClearStatistics.Index.ClearGroupStatistics,
                                model.ClearGroupStatistics);
                entity.SetValue(ClearStatistics.Index.FromGroupCode, model.FromGroupCode);
                entity.SetValue(ClearStatistics.Index.ToGroupCode, model.ToGroupCode);
                entity.SetValue(ClearStatistics.Index.ThroughGroupYear, model.ThroughGroupYear);
                entity.SetValue(ClearStatistics.Index.ThroughGroupPeriod,
                                model.ThroughGroupPeriod);
            }

            if (model.ClearNationalAcctStatistics == ClearNationalAccountStatistics.Yes)
            {
                entity.SetValue(ClearStatistics.Index.ClearNationalAcctStatistics,
                                model.ClearNationalAcctStatistics);
                entity.SetValue(ClearStatistics.Index.FromNationalAccount, model.FromNationalAccount);
                entity.SetValue(ClearStatistics.Index.ToNationalAccount, model.ToNationalAccount);
                entity.SetValue(ClearStatistics.Index.ThroughNationalAcctYear, model.ThroughNationalAcctYear);
                entity.SetValue(ClearStatistics.Index.ThroughNationalAcctPeriod,
                                model.ThroughNationalAcctPeriod);
            }

            if (model.ClearSalesPersonStatistics == ClearSalespersonStatistics.Yes)
            {
                entity.SetValue(ClearStatistics.Index.ClearSalesPersonStatistics,
                                model.ClearSalesPersonStatistics);
                entity.SetValue(ClearStatistics.Index.FromSalesPerson, model.FromSalesPerson);
                entity.SetValue(ClearStatistics.Index.ToSalesPerson, model.ToSalesPerson);
                entity.SetValue(ClearStatistics.Index.ThroughSalesPersonYear, model.ThroughSalesPersonYear);
                entity.SetValue(ClearStatistics.Index.ThroughSalesPersonPeriod,
                                model.ThroughSalesPersonPeriod);
            }
            if (model.ClearItemStatistics == ClearItemStatistics.Yes)
            {
                entity.SetValue(ClearStatistics.Index.ClearItemStatistics,
                                model.ClearItemStatistics);
                entity.SetValue(ClearStatistics.Index.FromItemNumber, model.FromItemNumber);
                entity.SetValue(ClearStatistics.Index.ToItemNumber, model.ToItemNumber);
                entity.SetValue(ClearStatistics.Index.ThroughItemYear, model.ThroughItemYear);
                entity.SetValue(ClearStatistics.Index.ThroughItemPeriod,
                                model.ThroughItemPeriod);
            }
        }
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Clear Statistics Business Entity</param>
        /// <returns>Clear Statistics Mapped Model</returns>
        public override T Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            model.FromCustomerNo              = entity.GetValue <string>(ClearStatistics.Index.FromCustomerNo);
            model.ToCustomerNo                = entity.GetValue <string>(ClearStatistics.Index.ToCustomerNo);
            model.FromGroupCode               = entity.GetValue <string>(ClearStatistics.Index.FromGroupCode);
            model.ToGroupCode                 = entity.GetValue <string>(ClearStatistics.Index.ToGroupCode);
            model.FromNationalAccount         = entity.GetValue <string>(ClearStatistics.Index.FromNationalAccount);
            model.ToNationalAccount           = entity.GetValue <string>(ClearStatistics.Index.ToNationalAccount);
            model.FromSalesPerson             = entity.GetValue <string>(ClearStatistics.Index.FromSalesPerson);
            model.ToSalesPerson               = entity.GetValue <string>(ClearStatistics.Index.ToSalesPerson);
            model.FromItemNumber              = entity.GetValue <string>(ClearStatistics.Index.FromItemNumber);
            model.ToItemNumber                = entity.GetValue <string>(ClearStatistics.Index.ToItemNumber);
            model.ClearCustomerStatistics     = (ClearCustomerStatistics)(entity.GetValue <int>(ClearStatistics.Index.ClearCustomerStatistics));
            model.ClearGroupStatistics        = (ClearGroupStatistics)(entity.GetValue <int>(ClearStatistics.Index.ClearGroupStatistics));
            model.ClearNationalAcctStatistics = (ClearNationalAccountStatistics)(entity.GetValue <int>(ClearStatistics.Index.ClearNationalAcctStatistics));
            model.ClearSalesPersonStatistics  = (ClearSalespersonStatistics)(entity.GetValue <int>(ClearStatistics.Index.ClearSalesPersonStatistics));
            model.ClearItemStatistics         = (ClearItemStatistics)(entity.GetValue <int>(ClearStatistics.Index.ClearItemStatistics));
            model.ThroughCustomerYear         = entity.GetValue <string>(ClearStatistics.Index.ThroughCustomerYear);
            model.ThroughCustomerPeriod       = entity.GetValue <string>(ClearStatistics.Index.ThroughCustomerPeriod);
            model.ThroughNationalAcctYear     = entity.GetValue <string>(ClearStatistics.Index.ThroughNationalAcctYear);
            model.ThroughNationalAcctPeriod   = entity.GetValue <string>(ClearStatistics.Index.ThroughNationalAcctPeriod);
            model.ThroughGroupYear            = entity.GetValue <string>(ClearStatistics.Index.ThroughGroupYear);
            model.ThroughGroupPeriod          = entity.GetValue <string>(ClearStatistics.Index.ThroughGroupPeriod);
            model.ThroughSalesPersonYear      = entity.GetValue <string>(ClearStatistics.Index.ThroughSalesPersonYear);
            model.ThroughSalesPersonPeriod    = entity.GetValue <string>(ClearStatistics.Index.ThroughSalesPersonPeriod);
            model.ThroughItemYear             = entity.GetValue <string>(ClearStatistics.Index.ThroughItemYear);
            model.ThroughItemPeriod           = entity.GetValue <string>(ClearStatistics.Index.ThroughItemPeriod);
            return(model);
        }
 /// <summary>
 /// CheckSourceCode
 /// </summary>
 /// <param name="sourceLedger">Source Ledger</param>
 /// <param name="sourceType">Source Type</param>
 /// <returns>True/False</returns>
 public bool CheckValidSourceCode(string sourceLedger, string sourceType)
 {
     _businessEntity = CreateBusinessEntities();
     _businessEntity.SetValue(SourceJournalProfile.Fields.SourceCodeID01, sourceLedger);
     _businessEntity.SetValue(SourceJournalProfile.Fields.SourceType01, sourceType, true);
     return(true);
 }
Esempio n. 4
0
        /// <summary>
        /// Set Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(TaxAuthorities.Index.TaxAuthority, model.TaxAuthority);
            entity.SetValue(TaxAuthorities.Index.Description, model.Description);
            entity.SetValue(TaxAuthorities.Index.TaxReportingCurrency, model.TaxReportingCurrency);
            entity.SetValue(TaxAuthorities.Index.MaximumTaxAllowable, model.MaximumTaxAllowable);
            entity.SetValue(TaxAuthorities.Index.NoTaxChargedBelow, model.NoTaxChargedBelow);
            entity.SetValue(TaxAuthorities.Index.TaxBase, model.TaxBase);
            entity.SetValue(TaxAuthorities.Index.AllowTaxInPrice, model.AllowTaxInPrice);
            entity.SetValue(TaxAuthorities.Index.TaxLiabilityAccount, model.TaxLiabilityAccount);
            entity.SetValue(TaxAuthorities.Index.ReportLevel, model.ReportLevel);
            entity.SetValue(TaxAuthorities.Index.TaxRecoverable, model.TaxRecoverable);
            entity.SetValue(TaxAuthorities.Index.RecoverableRate, model.RecoverableRate);
            entity.SetValue(TaxAuthorities.Index.RecoverableTaxAccount, model.RecoverableTaxAccount);
            entity.SetValue(TaxAuthorities.Index.ExpenseSeparately, model.ExpenseSeparately);
            entity.SetValue(TaxAuthorities.Index.ExpenseAccount, model.ExpenseAccount);
            // entity.SetValue(TaxAuthorities.Index.LastMaintained, model.LastMaintained);
            entity.SetValue(TaxAuthorities.Index.TaxType, model.TaxType);
            entity.SetValue(TaxAuthorities.Index.ReportTaxonRetainageDocument, model.ReportTaxonRetainageDocument);
        }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="parentEntity">Parent Entity</param>
 /// <param name="primaryKeyField">The primary key field name. (Example: pk_LineItems)</param>
 /// <param name="foreignKeyField">The foreign key field name. (Example: fk_Invoice)</param>
 /// <param name="parentTableName">Name of the parent table. (Example: Invoice)</param>
 /// <param name="parentTablePrimaryKeyField">The parent table primary key field name. (Example: pk_Invoice)</param>
 /// <remarks>
 ///     These types of collections are used to create 1:n collections, such as
 ///     the line items of an invoice
 /// </remarks>
 public GenericEntitySubItemCollection(IBusinessEntity parentEntity, string primaryKeyField, string foreignKeyField, string parentTableName, string parentTablePrimaryKeyField) : base(parentEntity)
 {
     PrimaryKeyField            = primaryKeyField;
     ForeignKeyField            = foreignKeyField;
     ParentTableName            = parentTableName;
     ParentTablePrimaryKeyField = parentTablePrimaryKeyField;
 }
Esempio n. 6
0
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Business Entity</param>
        /// <returns>Mapped Model</returns>
        public override ReceiptOptionalField Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            model.SequenceNumber           = entity.GetValue <long>(ReceiptOptionalField.Index.SequenceNumber);
            model.OptionalField            = entity.GetValue <string>(ReceiptOptionalField.Index.OptionalField);
            model.Value                    = entity.GetValue <string>(ReceiptOptionalField.Index.Value);
            model.Type                     = EnumUtility.GetEnum <Enums.Type>(entity.GetValue <string>(ReceiptOptionalField.Index.Type));
            model.Length                   = entity.GetValue <int>(ReceiptOptionalField.Index.Length);
            model.Decimals                 = entity.GetValue <int>(ReceiptOptionalField.Index.Decimals);
            model.AllowBlank               = (entity.GetValue <string>(ReceiptOptionalField.Index.AllowBlank) == "False") ? Enums.AllowBlank.No : Enums.AllowBlank.Yes;
            model.Validate                 = (entity.GetValue <string>(ReceiptOptionalField.Index.Validate) == "False") ? Enums.Validate.No : Enums.Validate.Yes;
            model.ValueSet                 = EnumUtility.GetEnum <Enums.ValueSet>(entity.GetValue <string>(ReceiptOptionalField.Index.ValueSet));
            model.TypedValueFieldIndex     = entity.GetValue <long>(ReceiptOptionalField.Index.TypedValueFieldIndex);
            model.TextValue                = entity.GetValue <string>(ReceiptOptionalField.Index.TextValue);
            model.AmountValue              = entity.GetValue <decimal>(ReceiptOptionalField.Index.AmountValue);
            model.NumberValue              = entity.GetValue <decimal>(ReceiptOptionalField.Index.NumberValue);
            model.IntegerValue             = entity.GetValue <long>(ReceiptOptionalField.Index.IntegerValue);
            model.YesNoValue               = (entity.GetValue <string>(ReceiptOptionalField.Index.YesNoValue) == "False") ? Enums.YesNoValue.No : Enums.YesNoValue.Yes;
            model.DateValue                = entity.GetValue <DateTime>(ReceiptOptionalField.Index.DateValue);
            model.TimeValue                = entity.GetValue <DateTime>(ReceiptOptionalField.Index.TimeValue);
            model.OptionalFieldDescription = entity.GetValue <string>(ReceiptOptionalField.Index.OptionalFieldDescription);
            model.ValueDescription         = entity.GetValue <string>(ReceiptOptionalField.Index.ValueDescription);

            return(model);
        }
Esempio n. 7
0
 /// <summary>
 /// Open entity views
 /// </summary>
 /// <returns></returns>
 protected override IBusinessEntity CreateBusinessEntities()
 {
     _header = OpenEntity(HeaderEntityName, true);
     _detail = OpenEntity(DetailEntityName);
     _header.Compose(new[] { _detail.View });
     return(_header);
 }
 internal IQueryable<Address> AddressesFor(IBusinessEntity entity, string ofType = null) {
     int id = entity.BusinessEntityID;
     var baes = Container.Instances<BusinessEntityAddress>().Where(bae => bae.BusinessEntityID == id);
     if (ofType != null) {
         baes = baes.Where(bae => bae.AddressType.Name == ofType);
     }
     return baes.Select(bae => bae.Address);
 }
        /// <summary>
        /// Creates the business entities
        /// </summary>
        private void CreateBusinessEntitiesInternal()
        {
            _businessEntity = OpenEntity(TaxAuthorities.EntityName);
            _taxClasses     = OpenEntity("TX0001", true);

            _businessEntity.Compose(new[] { _taxClasses.View });
            _taxClasses.Compose(new[] { _businessEntity.View });
        }
Esempio n. 10
0
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Business Entity</param>
        /// <returns>Mapped Model</returns>
        public override T Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            model.SourceLedger = entity.GetValue <string>(SourceCode.Index.SourceLedger);
            model.SourceType   = entity.GetValue <string>(SourceCode.Index.SourceType);
            model.Description  = entity.GetValue <string>(SourceCode.Index.Description);
            return(model);
        }
Esempio n. 11
0
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Business Entity</param>
        /// <returns>Mapped Model</returns>
        public override T Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            //model.SegmentNumber = EnumUtility.GetEnum<SegmentNumber>(entity.GetValue<string>(SegmentCodes.Index.SegmentNumber));
            model.SegmentNumber = entity.GetValue <string>(SegmentCodes.Index.SegmentNumber);
            model.SegmentCode   = entity.GetValue <string>(SegmentCodes.Index.SegmentCode);
            model.Description   = entity.GetValue <string>(SegmentCodes.Index.Description);
            return(model);
        }
Esempio n. 12
0
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Business Entity</param>
        /// <returns>Mapped Model</returns>
        public override ReceiptHeader Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            model.SequenceNumber               = entity.GetValue <long>(ReceiptHeader.Index.SequenceNumber);
            model.Description                  = entity.GetValue <string>(ReceiptHeader.Index.Description);
            model.ReceiptDate                  = entity.GetValue <DateTime>(ReceiptHeader.Index.ReceiptDate);
            model.FiscalYear                   = entity.GetValue <string>(ReceiptHeader.Index.FiscalYear);
            model.FiscalPeriod                 = (Models.Enums.FiscalPeriod)(entity.GetValue <int>(ReceiptHeader.Index.FiscalPeriod));
            model.PurchaseOrderNumber          = entity.GetValue <string>(ReceiptHeader.Index.PurchaseOrderNumber);
            model.Reference                    = entity.GetValue <string>(ReceiptHeader.Index.Reference);
            model.ReceiptType                  = (ReceiptType)(entity.GetValue <int>(ReceiptHeader.Index.ReceiptType));
            model.RateOperation                = (RateOperation)(entity.GetValue <int>(ReceiptHeader.Index.RateOperation));
            model.VendorNumber                 = entity.GetValue <string>(ReceiptHeader.Index.VendorNumber);
            model.ReceiptCurrency              = entity.GetValue <string>(ReceiptHeader.Index.ReceiptCurrency);
            model.ExchangeRate                 = entity.GetValue <decimal>(ReceiptHeader.Index.ExchangeRate);
            model.RateType                     = entity.GetValue <string>(ReceiptHeader.Index.RateType);
            model.RateDate                     = entity.GetValue <DateTime>(ReceiptHeader.Index.RateDate);
            model.RateOverride                 = (RateOverride)(entity.GetValue <int>(ReceiptHeader.Index.RateOverride));
            model.AdditionalCost               = entity.GetValue <decimal>(ReceiptHeader.Index.AdditionalCost);
            model.OrigAdditionalCostFunc       = entity.GetValue <decimal>(ReceiptHeader.Index.OrigAdditionalCostFunc);
            model.OrigAdditionalCostSource     = entity.GetValue <decimal>(ReceiptHeader.Index.OrigAdditionalCostSource);
            model.AdditionalCostCurrency       = entity.GetValue <string>(ReceiptHeader.Index.AdditionalCostCurrency);
            model.TotalExtendedCostFunctional  = entity.GetValue <decimal>(ReceiptHeader.Index.TotalExtendedCostFunctional);
            model.TotalExtendedCostSource      = entity.GetValue <decimal>(ReceiptHeader.Index.TotalExtendedCostSource);
            model.TotalExtendedCostAdjusted    = entity.GetValue <decimal>(ReceiptHeader.Index.TotalExtendedCostAdjusted);
            model.TotalAdjustedCostFunctional  = entity.GetValue <decimal>(ReceiptHeader.Index.TotalAdjustedCostFunctional);
            model.TotalReturnCost              = entity.GetValue <decimal>(ReceiptHeader.Index.TotalReturnCost);
            model.NumberOfDetailswithCost      = entity.GetValue <int>(ReceiptHeader.Index.NumberOfDetailswithCost);
            model.RequireLabels                = (RequireLabels)(entity.GetValue <int>(ReceiptHeader.Index.RequireLabels));
            model.AdditionalCostAllocationType = (AddlCostonRcptReturns)(entity.GetValue <int>(ReceiptHeader.Index.AdditionalCostAllocationType));
            model.Complete                     = (Complete)(entity.GetValue <int>(ReceiptHeader.Index.Complete));
            model.OriginalTotalCostSource      = entity.GetValue <decimal>(ReceiptHeader.Index.OriginalTotalCostSource);
            model.OriginalTotalCostFunctional  = entity.GetValue <decimal>(ReceiptHeader.Index.OriginalTotalCostFunctional);
            model.AdditionalCostFunctional     = entity.GetValue <decimal>(ReceiptHeader.Index.AdditionalCostFunctional);
            model.TotalCostReceiptAdditional   = entity.GetValue <decimal>(ReceiptHeader.Index.TotalCostReceiptAdditional);
            model.TotalAdjCostReceiptAddl      = entity.GetValue <decimal>(ReceiptHeader.Index.TotalAdjCostReceiptAddl);
            model.ReceiptCurrencyDecimals      = entity.GetValue <int>(ReceiptHeader.Index.ReceiptCurrencyDecimals);
            model.VendorShortName              = entity.GetValue <string>(ReceiptHeader.Index.VendorShortName);
            model.ICUniqueDocumentNumber       = entity.GetValue <decimal>(ReceiptHeader.Index.ICUniqueDocumentNumber);
            model.VendorExists                 = (VendorExists)(entity.GetValue <int>(ReceiptHeader.Index.VendorExists));
            model.RecordDeleted                = (RecordDeleted)(entity.GetValue <int>(ReceiptHeader.Index.RecordDeleted));
            model.TransactionNumber            = entity.GetValue <decimal>(ReceiptHeader.Index.TransactionNumber);
            model.RecordStatus                 = (RecordStatus)(entity.GetValue <int>(ReceiptHeader.Index.RecordStatus));
            model.ReceiptNumber                = entity.GetValue <string>(ReceiptHeader.Index.ReceiptNumber);
            model.NextDetailLineNumber         = entity.GetValue <int>(ReceiptHeader.Index.NextDetailLineNumber);
            model.RecordPrinted                = (RecordPrinted)(entity.GetValue <int>(ReceiptHeader.Index.RecordPrinted));
            model.PostSequenceNumber           = entity.GetValue <long>(ReceiptHeader.Index.PostSequenceNumber);
            model.OptionalFields               = entity.GetValue <long>(ReceiptHeader.Index.OptionalFields);
            model.ProcessCommand               = (ProcessCommand)(entity.GetValue <int>(ReceiptHeader.Index.ProcessCommand));
            model.VendorName                   = entity.GetValue <string>(ReceiptHeader.Index.VendorName);
            model.EnteredBy                    = entity.GetValue <string>(ReceiptHeader.Index.EnteredBy);
            model.PostingDate                  = entity.GetValue <DateTime>(ReceiptHeader.Index.PostingDate);
            return(model);
        }
Esempio n. 13
0
        internal static IQueryable <Address> AddressesFor(IBusinessEntity entity, IQueryable <BusinessEntityAddress> allBaes, string ofType = null)
        {
            int id   = entity.BusinessEntityID;
            var baes = allBaes.Where(bae => bae.BusinessEntityID == id);

            if (ofType != null)
            {
                baes = baes.Where(bae => bae.AddressType.Name == ofType);
            }
            return(baes.Select(bae => bae.Address));
        }
Esempio n. 14
0
        public void Remove(IBusinessEntity entity)
        {
            var result = Context.BusinessEntityList.FirstOrDefault(x => x.Number == entity.Number);

            if (result == null)
            {
                return;
            }

            Context.BusinessEntityList.Remove(result);
        }
Esempio n. 15
0
        /// <summary>
        /// Set Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(SegmentCodes.Index.SegmentNumber, model.SegmentNumber);
            entity.SetValue(SegmentCodes.Index.SegmentCode, model.SegmentCode);
            entity.SetValue(SegmentCodes.Index.Description, model.Description);
        }
Esempio n. 16
0
 /// <summary>
 /// Map model fields to business entity view fields
 /// </summary>
 /// <param name="model"></param>
 /// <param name="entity"></param>
 public override void Map(T model, IBusinessEntity entity)
 {
     entity.SetValue(FieldsIndex.CustomerNumber, model.CustomerNumber);
     entity.SetValue(FieldsIndex.OptionalField, model.OptionalField);
     entity.SetValue(FieldsIndex.OptionalFieldDescription, model.OptionalFieldDescription);
     entity.SetValue(FieldsIndex.Value, model.Value);
     entity.SetValue(FieldsIndex.ValueDescription, model.ValueDescription);
     entity.SetValue(FieldsIndex.ValueSet, model.ValueSet);
     entity.SetValue(FieldsIndex.Decimals, model.Decimals);
     entity.SetValue(FieldsIndex.Validate, model.Validate);
 }
        internal IQueryable <Address> AddressesFor(IBusinessEntity entity, string ofType = null)
        {
            int id   = entity.BusinessEntityID;
            var baes = Container.Instances <BusinessEntityAddress>().Where(bae => bae.BusinessEntityID == id);

            if (ofType != null)
            {
                baes = baes.Where(bae => bae.AddressType.Name == ofType);
            }
            return(baes.Select(bae => bae.Address));
        }
Esempio n. 18
0
        /// <summary>
        /// Set Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(SourceCode.Index.SourceLedger, model.SourceLedger);
            entity.SetValue(SourceCode.Index.SourceType, model.SourceType);
            entity.SetValue(SourceCode.Index.Description, model.Description);
        }
Esempio n. 19
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="parentEntity">Parent entity</param>
 /// <param name="primaryKeyField">The primary key field name. (Example: pk_CategoryAssignment)</param>
 /// <param name="foreignKeyField">The foreign key field name. (Example: fk_Names)</param>
 /// <param name="parentTableName">Name of the parent table name. (Example: Names)</param>
 /// <param name="parentTablePrimaryKeyField">The parent table primary key field name. (Example: pk_Names)</param>
 /// <param name="targetForeignKeyField">The target foreign key field. (Example: fk_Category)</param>
 /// <param name="targetPrimaryKeyField">The target primary key field. (Example: pk_Category)</param>
 /// <param name="targetTextField">The target text field name. (Example: CategoryName)</param>
 /// <param name="xlinkTable">The xlink table. (Example: CategoryAssignment)</param>
 /// <param name="targetTable">The target table. (Example: Categories)</param>
 /// <remarks>
 ///     This type of collection can be used to create a cross-link relationship between two
 ///     tables by means of an intermediary table.
 ///     For instance, names could be linked to categories by means of a category assignment table.
 /// </remarks>
 public GenericEntityXlinkSubItemCollection(IBusinessEntity parentEntity, string primaryKeyField, string foreignKeyField, string parentTableName, string parentTablePrimaryKeyField, string targetForeignKeyField, string targetPrimaryKeyField, string targetTextField, DataTable xlinkTable, DataTable targetTable) : base(parentEntity)
 {
     PrimaryKeyField            = primaryKeyField;
     ForeignKeyField            = foreignKeyField;
     ParentTableName            = parentTableName;
     ParentTablePrimaryKeyField = parentTablePrimaryKeyField;
     TargetTextField            = targetTextField;
     TargetForeignKeyField      = targetForeignKeyField;
     TargetPrimaryKeyField      = targetPrimaryKeyField;
     AutoAddTarget = false;
     SetTable(xlinkTable, targetTable);
 }
Esempio n. 20
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="parentEntity">Parent entity</param>
 /// <param name="primaryKeyField">The primary key field name. (Example: pk_CategoryAssignment)</param>
 /// <param name="foreignKeyField">The foreign key field name. (Example: fk_Names)</param>
 /// <param name="parentTableName">Name of the parent table name. (Example: Names)</param>
 /// <param name="parentTablePrimaryKeyField">The parent table primary key field name. (Example: pk_Names)</param>
 /// <param name="targetForeignKeyField">The target foreign key field. (Example: fk_Category)</param>
 /// <param name="targetPrimaryKeyField">The target primary key field. (Example: pk_Category)</param>
 /// <param name="targetTextField">The target text field name. (Example: CategoryName)</param>
 /// <param name="autoAddTarget">
 ///     Specifies whether target records are automatically added if they do not yet exist (such as
 ///     adding a new category on the fly).
 /// </param>
 /// <remarks>
 ///     This type of collection can be used to create a cross-link relationship between two
 ///     tables by means of an intermediary table.
 ///     For instance, names could be linked to categories by means of a category assignment table.
 /// </remarks>
 public GenericEntityXlinkSubItemCollection(IBusinessEntity parentEntity, string primaryKeyField, string foreignKeyField, string parentTableName, string parentTablePrimaryKeyField, string targetForeignKeyField, string targetPrimaryKeyField, string targetTextField, bool autoAddTarget)
     : base(parentEntity)
 {
     PrimaryKeyField            = primaryKeyField;
     ForeignKeyField            = foreignKeyField;
     ParentTableName            = parentTableName;
     ParentTablePrimaryKeyField = parentTablePrimaryKeyField;
     TargetTextField            = targetTextField;
     TargetForeignKeyField      = targetForeignKeyField;
     TargetPrimaryKeyField      = targetPrimaryKeyField;
     AutoAddTarget = autoAddTarget;
 }
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Business Entity</param>
        /// <returns>Mapped Model</returns>
        public override T Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            model.SequenceNumber         = entity.GetValue <long>(ReceiptDetailSerialNumber.Index.SequenceNumber);
            model.LineNumber             = entity.GetValue <int>(ReceiptDetailSerialNumber.Index.LineNumber);
            model.SerialNumber           = entity.GetValue <string>(ReceiptDetailSerialNumber.Index.SerialNumber);
            model.SerialReturned         = entity.GetValue <bool>(ReceiptDetailSerialNumber.Index.SerialReturned);
            model.TransactionQuantity    = entity.GetValue <long>(ReceiptDetailSerialNumber.Index.TransactionQuantity);
            model.SerialQuantityReturned = entity.GetValue <long>(ReceiptDetailSerialNumber.Index.SerialQuantityReturned);

            return(model);
        }
        /// <summary>
        /// SetValue Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(ReceiptDetailOptionalField model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(ReceiptDetailOptionalField.Index.SequenceNumber, model.SequenceNumber);
            entity.SetValue(ReceiptDetailOptionalField.Index.LineNumber, model.LineNumber);
            entity.SetValue(ReceiptDetailOptionalField.Index.OptionalField, model.OptionalField);

            if (model.ValueSet == TypeEnum.ValueSet.No)
            {
                return;
            }
            switch (model.Type)
            {
            case Models.Enums.Type.Text:
                entity.SetValue(ReceiptDetailOptionalField.Index.TextValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;

            case Models.Enums.Type.Integer:
                entity.SetValue(ReceiptDetailOptionalField.Index.IntegerValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;

            case Models.Enums.Type.Amount:
                entity.SetValue(ReceiptDetailOptionalField.Index.AmountValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;

            case Models.Enums.Type.Number:
                entity.SetValue(ReceiptDetailOptionalField.Index.NumberValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;

            case Models.Enums.Type.Date:
                if (string.IsNullOrEmpty(model.Value))
                {
                    model.Value = null;
                }
                entity.SetValue(ReceiptDetailOptionalField.Index.DateValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;

            case Models.Enums.Type.Time:
                entity.SetValue(ReceiptDetailOptionalField.Index.TimeValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;

            case Models.Enums.Type.YesOrNo:
                entity.SetValue(ReceiptDetailOptionalField.Index.YesNoValue, model.Value, model.Validate == TypeEnum.Validate.Yes);
                break;
            }
        }
Esempio n. 23
0
        public virtual bool Equals(IBusinessEntity other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Equals(Id, other.Id));
        }
        /// <summary>
        /// SetValue Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(ReceiptDetailSerialNumber.Index.SequenceNumber, model.SequenceNumber);
            entity.SetValue(ReceiptDetailSerialNumber.Index.LineNumber, model.LineNumber);
            entity.SetValue(ReceiptDetailSerialNumber.Index.SerialNumber, model.SerialNumber);
            entity.SetValue(ReceiptDetailSerialNumber.Index.SerialReturned, model.SerialReturned);
            entity.SetValue(ReceiptDetailSerialNumber.Index.TransactionQuantity, model.TransactionQuantity);
            entity.SetValue(ReceiptDetailSerialNumber.Index.SerialQuantityReturned, model.SerialQuantityReturned);
        }
        /// <summary>
        /// SetValue Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(ReceiptOptionalField.Index.SequenceNumber, model.SequenceNumber);
            entity.SetValue(ReceiptOptionalField.Index.OptionalField, model.OptionalField);

            if (model.ValueSet == Enums.ValueSet.No)
            {
                return;
            }
            switch (model.Type)
            {
            case Enums.Type.Text:
                entity.SetValue(ReceiptOptionalField.Index.TextValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;

            case Enums.Type.Integer:
                entity.SetValue(ReceiptOptionalField.Index.IntegerValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;

            case Enums.Type.Amount:
                entity.SetValue(ReceiptOptionalField.Index.AmountValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;

            case Enums.Type.Number:
                entity.SetValue(ReceiptOptionalField.Index.NumberValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;

            case Enums.Type.Date:
                if (model.Value == "")
                {
                    model.Value = null;
                }
                entity.SetValue(ReceiptOptionalField.Index.DateValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;

            case Enums.Type.Time:
                entity.SetValue(ReceiptOptionalField.Index.TimeValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;

            case Enums.Type.YesOrNo:
                entity.SetValue(ReceiptOptionalField.Index.YesNoValue, model.Value, model.Validate == Enums.Validate.Yes);
                break;
            }
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <typeparam name="TKey">Key</typeparam>
        /// <param name="id">Id</param>
        /// <returns>T</returns>
        public override T GetById <TKey>(TKey id)
        {
            _businessEntity = CreateBusinessEntities();
            CheckRights(_businessEntity, SecurityType.Inquire);

            _businessEntity.SetValue(SourceJournalProfile.Fields.SourceJournalName, id);
            var exist = _businessEntity.Read(false);

            return(new T
            {
                SourceJournalName = _businessEntity.GetValue <string>(SourceJournalProfile.Index.SourceJournalName),
                ETag = _businessEntity.ETag,
                Exist = exist
            });
        }
        /// <summary>
        /// Get Mapper
        /// </summary>
        /// <param name="entity">Business Entity</param>
        /// <returns>Mapped Model</returns>
        public override T Map(IBusinessEntity entity)
        {
            var model = base.Map(entity);

            model.SequenceNumber              = entity.GetValue <long>(ReceiptDetailLotNumber.Index.SequenceNumber);
            model.LineNumber                  = entity.GetValue <int>(ReceiptDetailLotNumber.Index.LineNumber);
            model.LotNumber                   = entity.GetValue <string>(ReceiptDetailLotNumber.Index.LotNumber);
            model.ExpiryDate                  = entity.GetValue <DateTime>(ReceiptDetailLotNumber.Index.ExpiryDate);
            model.TransactionQuantity         = entity.GetValue <decimal>(ReceiptDetailLotNumber.Index.TransactionQuantity);
            model.LotQuantityInStockingUOM    = entity.GetValue <decimal>(ReceiptDetailLotNumber.Index.LotQuantityInStockingUOM);
            model.LotQuantityReturned         = entity.GetValue <decimal>(ReceiptDetailLotNumber.Index.LotQuantityReturned);
            model.LotQtyReturnedInStockingUOM = entity.GetValue <decimal>(ReceiptDetailLotNumber.Index.LotQtyReturnedInStockingUOM);

            return(model);
        }
Esempio n. 28
0
        /// <summary>
        /// Map fields from entity view to model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override T Map(IBusinessEntity entity)
        {
            T model = base.Map(entity);

            model.CustomerNumber           = entity.GetValue <string>(FieldsIndex.CustomerNumber);
            model.OptionalField            = entity.GetValue <string>(FieldsIndex.OptionalField);
            model.OptionalFieldDescription = entity.GetValue <string>(FieldsIndex.OptionalFieldDescription);
            model.Value            = entity.GetValue <string>(FieldsIndex.Value);
            model.ValueDescription = entity.GetValue <string>(FieldsIndex.ValueDescription);
            model.ValueSet         = entity.GetValue <string>(FieldsIndex.AddressLine1);
            model.Decimals         = entity.GetValue <Int16>(FieldsIndex.Decimals);
            model.Validate         = entity.GetValue <Int16>(FieldsIndex.Validate);

            return(model);
        }
Esempio n. 29
0
        /// <summary>
        /// Get the source code based on primary key
        /// </summary>
        /// <param name="sourceLedger">Source Ledger</param>
        /// <param name="sourceType">Source Type</param>
        /// <returns>Source Code</returns>
        public T GetByIds(string sourceLedger, string sourceType)
        {
            _businessEntity = CreateBusinessEntities();
            CheckRights(_businessEntity, SecurityType.Inquire);

            _businessEntity.SetValue(SourceCode.Fields.SourceLedger, sourceLedger);
            _businessEntity.SetValue(SourceCode.Fields.SourceType, sourceType);
            if (!_businessEntity.Read(false))
            {
                return(null);
            }
            var sourceCodeMapper = new SourceCodeMapper <T>(Context);

            return(sourceCodeMapper.Map(_businessEntity));
        }
        /// <summary>
        /// Se tValue Mapper
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="entity">Business Entity</param>
        public override void Map(T model, IBusinessEntity entity)
        {
            if (model == null)
            {
                return;
            }

            entity.SetValue(ReceiptDetailLotNumber.Index.SequenceNumber, model.SequenceNumber);
            entity.SetValue(ReceiptDetailLotNumber.Index.LineNumber, model.LineNumber);
            entity.SetValue(ReceiptDetailLotNumber.Index.LotNumber, model.LotNumber);
            entity.SetValue(ReceiptDetailLotNumber.Index.ExpiryDate, model.ExpiryDate);
            entity.SetValue(ReceiptDetailLotNumber.Index.TransactionQuantity, model.TransactionQuantity);
            entity.SetValue(ReceiptDetailLotNumber.Index.LotQuantityInStockingUOM, model.LotQuantityInStockingUOM);
            entity.SetValue(ReceiptDetailLotNumber.Index.LotQuantityReturned, model.LotQuantityReturned);
            entity.SetValue(ReceiptDetailLotNumber.Index.LotQtyReturnedInStockingUOM, model.LotQtyReturnedInStockingUOM);
        }
Esempio n. 31
0
 /// <summary>
 /// Map model fields to business entity view fields
 /// </summary>
 /// <param name="model"></param>
 /// <param name="entity"></param>
 public override void Map(T model, IBusinessEntity entity)
 {
     entity.SetValue(FieldsIndex.CustomerNumber, model.CustomerNumber);
     entity.SetValue(FieldsIndex.ShortName, model.ShortName);
     entity.SetValue(FieldsIndex.GroupCode, model.GroupCode);
     entity.SetValue(FieldsIndex.CustomerName, model.CustomerName);
     entity.SetValue(FieldsIndex.AddressLine1, model.AddressLine1);
     entity.SetValue(FieldsIndex.City, model.City);
     entity.SetValue(FieldsIndex.StateOrProv, model.StateOrProv);
     entity.SetValue(FieldsIndex.ZipOrPostalCode, model.ZipOrPostalCode);
     entity.SetValue(FieldsIndex.Country, model.Country);
     entity.SetValue(FieldsIndex.ContactName, model.ContactName);
     entity.SetValue(FieldsIndex.PhoneNumber, model.PhoneNumber);
     entity.SetValue(FieldsIndex.FaxNumber, model.FaxNumber);
     entity.SetValue(FieldsIndex.Email, model.Email);
 }
Esempio n. 32
0
        public static void SelectedBusinessEntity(this ComboBox comboBox, IBusinessEntity entity)
        {
            IEnumerable<IBusinessEntity> enumerator = (IEnumerable<IBusinessEntity>) comboBox.DataSource;
            int i = 0;

            foreach (IBusinessEntity item in enumerator)
            {
                if (item.Id == entity.Id)
                {
                    comboBox.SelectedIndex = i;

                    break;
                }

                i++;
            }
        }
Esempio n. 33
0
        public static void MarkAsChecked(this DataGridView dataGridView, IBusinessEntity[] entities)
        {
            IEnumerable<IBusinessEntity> enumerator = dataGridView.DataSource as IEnumerable<IBusinessEntity>;

            foreach (IBusinessEntity entityInGrid in enumerator)
            {
                foreach (IBusinessEntity entityInList in entities)
                {
                    if (entityInGrid.Id == entityInList.Id)
                    {
                        entityInGrid.Seleccionado = true;

                        break;
                    }
                }
            }
        }