Ejemplo n.º 1
0
        public static PriceListVO ToPriceListVo(this StockPricelists stockPricelist)
        {
            if (stockPricelist == null)
            {
                return(null);
            }

            return(new PriceListVO()
            {
                CompanyCode = stockPricelist.CompanyCode,
                CurrencyCode = stockPricelist.CurrencyCode,
                CurrencyName = stockPricelist.CurrencyName,
                CurrencySymbol = stockPricelist.CurrencySymbol,
                DateCreated = stockPricelist.Created,
                DateLastModified = stockPricelist.Modified ?? stockPricelist.Created,
                DisplayIndex = stockPricelist.DisplayIndex,
                DisplayName = stockPricelist.DisplayName,
                HostId = stockPricelist.XfxHostId,
                Id = stockPricelist.Id,
                PastelLookup = stockPricelist.PastelLookup,
                DisplayFormat = stockPricelist.DisplayFormat,
                Flags = (PriceListFlags)stockPricelist.Flags
            });
        }
Ejemplo n.º 2
0
        public static ValueObjects.Accounts.AccountMasterVO ToAccountMasterVO(this Accounts account, StockPricelists priceList,
                                                                              Accounts masterAccount, StockPricelists masterAccountPriceList)
        {
            var accountAccountManagers = account.AccountAccountManagers;

            var voAccount = new AccountMasterVO
            {
                Id               = account.Id,
                DateCreated      = account.Created,
                DateLastModified = account.Modified,
                //AccountFacilitator = dbAccount.Facilitator(),
                //AreaCode = dbAccount.AreaCode(),
                BranchCode   = account.BranchCode,
                CompanyCode  = account.CompanyCode,
                CustomerCode = account.Number,
                //DefNumber = dbAccount.DefNumber(),
                Name                  = account.Name,
                PaymentType           = (Enumeration.AccountPaymentType)account.PaymentType,
                PrimaryEmailAddresses = account.Email?.Split(',', ';', ' '),
                //RegestrationNumber = dbAccount.RegistrationNumber(),
                Flags = (Enumeration.AccountFlags)account.Flags,
                //TaxNumber = dbAccount.VatNumber(),
                WebUrl = account.WebAddress,
                AccountAccountManagers = accountAccountManagers.Select(s => s.ToAccountAccountManagerVO()).ToList(),
                MasterAccount          = masterAccount?.ToAccountMasterVO(masterAccountPriceList, null, null)
            };

            voAccount.TaxRate = new TaxRateVO
            {
                CompanyCode      = account.TaxRate.CompanyCode,
                DateCreated      = account.TaxRate.Created,
                DateLastModified = account.TaxRate.Modified,
                Id           = account.TaxRate.Id,
                PastelLookup = account.TaxRate.PastelLookup,
                Rate         = account.TaxRate.Rate,
                Flags        = (Enumeration.TaxRateFlags)account.TaxRate.Flags,
                HostId       = account.TaxRate.XfxHostId
            };

            if (priceList != null)
            {
                voAccount.PriceList = new ValueObjects.OrderEntry.PriceListVO
                {
                    CompanyCode      = priceList.CompanyCode,
                    CurrencyCode     = priceList.CurrencyCode,
                    CurrencyName     = priceList.CurrencyName,
                    CurrencySymbol   = priceList.CurrencySymbol,
                    DateCreated      = priceList.Created,
                    DateLastModified = priceList.Modified ?? priceList.Created,
                    DisplayIndex     = priceList.DisplayIndex,
                    DisplayName      = priceList.DisplayName,
                    HostId           = priceList.XfxHostId,
                    Id            = priceList.Id,
                    PastelLookup  = priceList.PastelLookup,
                    DisplayFormat = priceList.DisplayFormat,
                    Flags         = (PriceListFlags)priceList.Flags
                };
            }

            return(voAccount);
        }