예제 #1
0
        //Add Data From Linked Tables for Display
        public void EditForDisplay(ClientSubUnitClientAccount clientSubUnitClientAccount)
        {
            ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
            ClientAccount           clientAccount           = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(clientSubUnitClientAccount.ClientAccountNumber, clientSubUnitClientAccount.SourceSystemCode);
            if (clientAccount != null)
            {
                clientSubUnitClientAccount.ClientAccountName = clientAccount.ClientAccountName;
            }

            ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
            ClientSubUnit           clientSubUnit           = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientSubUnitClientAccount.ClientSubUnitGuid);
            if (clientSubUnit != null)
            {
                clientSubUnitClientAccount.ClientSubUnitName = clientSubUnit.ClientSubUnitName;
            }

            ConfidenceLevelForLoadRepository confidenceLevelForLoadRepository = new ConfidenceLevelForLoadRepository();
            ConfidenceLevelForLoad           confidenceLevelForLoad           = new ConfidenceLevelForLoad();

            if (clientSubUnitClientAccount.ConfidenceLevelForLoadId != null)
            {
                int confidenceLevelForLoadId = (int)clientSubUnitClientAccount.ConfidenceLevelForLoadId;
                confidenceLevelForLoad = confidenceLevelForLoadRepository.GetConfidenceLevelForLoad(confidenceLevelForLoadId);
                if (confidenceLevelForLoad != null)
                {
                    clientSubUnitClientAccount.ConfidenceLevelForLoadDescription = confidenceLevelForLoad.ConfidenceLevelForLoadDescription;
                }
            }

            LineOfBusinessRepository lineOfBusinessRepository = new LineOfBusinessRepository();
            LineOfBusiness           lineOfBusiness           = new LineOfBusiness();

            if (clientSubUnitClientAccount.ClientAccountLineOfBusinessId != null)
            {
                int lineOfBusinessId = (int)clientSubUnitClientAccount.ClientAccountLineOfBusinessId;
                lineOfBusiness = lineOfBusinessRepository.GetLineOfBusiness(lineOfBusinessId);
                if (lineOfBusiness != null)
                {
                    clientSubUnitClientAccount.LineOfBusiness = lineOfBusiness;
                }
            }
        }
예제 #2
0
        //Add Data From Linked Tables for Display
        //type is optional to letus know if it is a TopUnit card, which has no links to other tables
        public void EditForDisplay(CreditCardEditable creditCard)
        {
            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(creditCard.ClientTopUnitGuid);
            if (clientTopUnit != null)
            {
                creditCard.ClientTopUnitName = clientTopUnit.ClientTopUnitName;
            }

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();
            CreditCardVendor           creditCardVendor           = new CreditCardVendor();

            creditCardVendor = creditCardVendorRepository.GetCreditCardVendor(creditCard.CreditCardVendorCode);
            if (creditCardVendor != null)
            {
                creditCard.CreditCardVendorName = creditCardVendor.CreditCardVendorName;
            }

            if (creditCard.CreditCardTypeId != null)
            {
                int creditCardTypeId = (int)creditCard.CreditCardTypeId;
                CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();
                CreditCardType           creditCardType           = new CreditCardType();
                creditCardType = creditCardTypeRepository.GetCreditCardType(creditCardTypeId);
                if (creditCardType != null)
                {
                    creditCard.CreditCardTypeDescription = creditCardType.CreditCardTypeDescription;
                }
            }

            //If Linked to ClientSubUnit
            CreditCardClientSubUnit           creditCardClientSubUnit           = new CreditCardClientSubUnit();
            CreditCardClientSubUnitRepository creditCardClientSubUnitRepository = new CreditCardClientSubUnitRepository();

            creditCardClientSubUnit = creditCardClientSubUnitRepository.GetCreditCardClientSubUnit(creditCard.CreditCardId);

            if (creditCardClientSubUnit != null)
            {
                ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = new ClientSubUnit();
                clientSubUnit = clientSubUnitRepository.GetClientSubUnit(creditCardClientSubUnit.ClientSubUnitGuid);
                if (clientSubUnit != null)
                {
                    creditCard.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid;
                    creditCard.ClientSubUnitName = clientSubUnit.ClientSubUnitName;
                    creditCard.ClientTopUnitGuid = clientSubUnit.ClientTopUnit.ClientTopUnitGuid;
                    creditCard.ClientTopUnitName = clientSubUnit.ClientTopUnit.ClientTopUnitName;
                }
            }

            //If Linked to ClientAccount
            CreditCardClientAccount           creditCardClientAccount           = new CreditCardClientAccount();
            CreditCardClientAccountRepository creditCardClientAccountRepository = new CreditCardClientAccountRepository();

            creditCardClientAccount = creditCardClientAccountRepository.GetCreditCardClientAccount(creditCard.CreditCardId);

            if (creditCardClientAccount != null)
            {
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                ClientAccount           clientAccount           = new ClientAccount();
                clientAccount = clientAccountRepository.GetClientAccount(creditCardClientAccount.ClientAccountNumber, creditCardClientAccount.SourceSystemCode);
                if (clientAccount != null)
                {
                    creditCard.ClientAccountNumber = clientAccount.ClientAccountNumber;
                    creditCard.ClientAccountName   = clientAccount.ClientAccountName;
                    creditCard.SourceSystemCode    = clientAccount.SourceSystemCode;
                }
            }


            HierarchyRepository hierarchyRepository = new HierarchyRepository();

            fnDesktopDataAdmin_SelectCreditCardHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectCreditCardHierarchy_v1Result();

            hierarchy = GetGroupHierarchy(creditCard.CreditCardId);

            if (hierarchy == null)
            {
            }
            else
            {
                creditCard.HierarchyType = hierarchy.HierarchyType;
                creditCard.HierarchyCode = hierarchy.HierarchyCode.ToString();
                creditCard.HierarchyItem = hierarchy.HierarchyName.Trim();

                if (hierarchy.HierarchyType == "ClientSubUnitTravelerType")
                {
                    creditCard.ClientSubUnitGuid = hierarchy.HierarchyCode.ToString();
                    creditCard.ClientSubUnitName = hierarchy.HierarchyName.Trim();
                    creditCard.TravelerTypeGuid  = hierarchy.TravelerTypeGuid;
                    creditCard.TravelerTypeName  = hierarchy.TravelerTypeName.Trim();
                }
            }
        }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ServiceFund serviceFund)
        {
            //ClientTopUnit
            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = clientTopUnitRepository.GetClientTopUnit(serviceFund.ClientTopUnitGuid);

            if (clientTopUnit != null)
            {
                serviceFund.ClientTopUnitName = clientTopUnit.ClientTopUnitName;
            }

            //ClientAccount
            ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
            ClientAccount           clientAccount           = clientAccountRepository.GetClientAccount(serviceFund.ClientAccountNumber, serviceFund.SourceSystemCode);

            if (clientAccount != null)
            {
                serviceFund.ClientAccountName = clientAccount.ClientAccountName;
            }

            //Supplier
            SupplierRepository supplierRepository = new SupplierRepository();
            Supplier           supplier           = supplierRepository.GetSupplier(serviceFund.SupplierCode, serviceFund.ProductId);

            if (supplier != null)
            {
                serviceFund.SupplierName = supplier.SupplierName;
            }

            //Product
            ProductRepository productRepository = new ProductRepository();
            Product           product           = productRepository.GetProduct(serviceFund.ProductId);

            if (product != null)
            {
                serviceFund.ProductName = product.ProductName;
            }

            //Times

            string serviceFundStartTime;

            if (serviceFund.ServiceFundStartTime.Hour < 10)
            {
                serviceFundStartTime = String.Concat("0", serviceFund.ServiceFundStartTime.Hour, ":");
            }
            else
            {
                serviceFundStartTime = String.Concat(serviceFund.ServiceFundStartTime.Hour, ":");
            }

            if (serviceFund.ServiceFundStartTime.Minute < 10)
            {
                serviceFundStartTime = String.Concat(serviceFundStartTime, "0", serviceFund.ServiceFundStartTime.Minute);
            }
            else
            {
                serviceFundStartTime = String.Concat(serviceFundStartTime, serviceFund.ServiceFundStartTime.Minute);
            }

            if (serviceFund.ServiceFundStartTime.Second != 0)
            {
                if (serviceFund.ServiceFundStartTime.Second < 10)
                {
                    serviceFundStartTime = String.Concat(serviceFundStartTime, ":0", serviceFund.ServiceFundStartTime.Second);
                }
                else
                {
                    serviceFundStartTime = String.Concat(serviceFundStartTime, ":", serviceFund.ServiceFundStartTime.Second);
                }
            }

            serviceFund.ServiceFundStartTimeString = serviceFundStartTime;

            string serviceFundEndTime;

            if (serviceFund.ServiceFundEndTime.Hour < 10)
            {
                serviceFundEndTime = String.Concat("0", serviceFund.ServiceFundEndTime.Hour, ":");
            }
            else
            {
                serviceFundEndTime = String.Concat(serviceFund.ServiceFundEndTime.Hour, ":");
            }

            if (serviceFund.ServiceFundEndTime.Minute < 10)
            {
                serviceFundEndTime = String.Concat(serviceFundEndTime, "0", serviceFund.ServiceFundEndTime.Minute);
            }
            else
            {
                serviceFundEndTime = String.Concat(serviceFundEndTime, serviceFund.ServiceFundEndTime.Minute);
            }

            if (serviceFund.ServiceFundEndTime.Second != 0)
            {
                if (serviceFund.ServiceFundEndTime.Second < 10)
                {
                    serviceFundEndTime = String.Concat(serviceFundEndTime, ":0", serviceFund.ServiceFundEndTime.Second);
                }
                else
                {
                    serviceFundEndTime = String.Concat(serviceFundEndTime, ":", serviceFund.ServiceFundEndTime.Second);
                }
            }

            serviceFund.ServiceFundEndTimeString = serviceFundEndTime;
        }