//Add Data From Linked Tables for Display
        public void EditForDisplay(ClientTelephony clientTelephony)
        {
            //Hierarchy
            if (clientTelephony.HierarchyType == "ClientTopUnit")
            {
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = clientTopUnitRepository.GetClientTopUnit(clientTelephony.HierarchyItem);
                if (clientTopUnit != null)
                {
                    clientTelephony.HierarchyName = clientTopUnit.ClientTopUnitName;
                }
            }
            else if (clientTelephony.HierarchyType == "ClientSubUnit")
            {
                ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = clientSubUnitRepository.GetClientSubUnit(clientTelephony.HierarchyItem);
                if (clientSubUnit != null)
                {
                    clientTelephony.HierarchyName = clientSubUnit.ClientSubUnitName;
                }
            }

            //MainNumberFlag
            clientTelephony.MainNumberFlagNullable = (clientTelephony.MainNumberFlag == true) ? true : false;
        }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ClientSubUnit clientSubUnit)
        {
            //PortraitStatusRepository portraitStatusRepository = new PortraitStatusRepository();
            //PortraitStatus portraitStatus = new PortraitStatus();
            //portraitStatus = portraitStatusRepository.GetPortraitStatus(clientSubUnit.PortraitStatusId);
            //if (portraitStatus != null)
            //{
            // clientSubUnit.PortraitStatus = portraitStatus.PortraitStatusDescription;
            //}

            CountryRepository countryRepository = new CountryRepository();
            Country           country           = new Country();

            country = countryRepository.GetCountry(clientSubUnit.CountryCode);
            if (country != null)
            {
                clientSubUnit.CountryName = country.CountryName;
            }

            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid);
            if (clientTopUnit != null)
            {
                clientSubUnit.ClientTopUnitName = clientTopUnit.ClientTopUnitName;
            }
        }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ClientProfileGroup clientProfileGroup)
        {
            //Set Hierarchy if ClientTopUnit
            ClientProfileGroupClientTopUnit clientProfileGroupClientTopUnit = clientProfileGroup.ClientProfileGroupClientTopUnits.SingleOrDefault();

            if (clientProfileGroupClientTopUnit != null)
            {
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = new ClientTopUnit();
                clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientProfileGroupClientTopUnit.ClientTopUnitGuid);
                if (clientTopUnit != null)
                {
                    clientProfileGroup.HierarchyItem = clientTopUnit.ClientTopUnitName;
                    clientProfileGroup.HierarchyCode = clientTopUnit.ClientTopUnitGuid;
                    clientProfileGroup.HierarchyType = "ClientTopUnit";
                }
            }

            //Set Hierarchy if ClientSubUnit
            ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault();

            if (clientProfileGroupClientSubUnit != null)
            {
                ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = new ClientSubUnit();
                clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid);
                if (clientSubUnit != null)
                {
                    clientProfileGroup.HierarchyItem = clientSubUnit.ClientSubUnitName;
                    clientProfileGroup.HierarchyCode = clientSubUnit.ClientSubUnitGuid;
                    clientProfileGroup.HierarchyType = "ClientSubUnit";
                }
            }
        }
        //Add Data From Linked Tables for Display
        public void EditForDisplay(GSTIdentificationNumber gstIdentificationNumber)
        {
            CountryRepository countryRepository = new CountryRepository();
            Country           country           = new Country();

            country = countryRepository.GetCountry(gstIdentificationNumber.CountryCode);
            if (country != null)
            {
                gstIdentificationNumber.CountryName = country.CountryName;
            }

            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = clientTopUnitRepository.GetClientTopUnit(gstIdentificationNumber.ClientTopUnitGuid);

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

            StateProvinceRepository stateProvinceRepository = new StateProvinceRepository();
            StateProvince           stateProvince           = stateProvinceRepository.GetStateProvinceByCountry(gstIdentificationNumber.CountryCode, gstIdentificationNumber.StateProvinceCode);

            if (stateProvince != null)
            {
                gstIdentificationNumber.StateProvinceName = stateProvince.Name;
            }
        }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(PointOfSaleFeeLoad pointOfSaleFeeLoad)
        {
            //ClientTopUnit
            if (pointOfSaleFeeLoad.ClientTopUnitGuid != null)
            {
                ClientTopUnitRepository ClientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = ClientTopUnitRepository.GetClientTopUnit(pointOfSaleFeeLoad.ClientTopUnitGuid);
                if (clientTopUnit != null)
                {
                    pointOfSaleFeeLoad.ClientTopUnitName = clientTopUnit.ClientTopUnitName;
                }
            }

            //ClientSubUnit
            if (pointOfSaleFeeLoad.ClientSubUnitGuid != null)
            {
                ClientSubUnitRepository ClientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = ClientSubUnitRepository.GetClientSubUnit(pointOfSaleFeeLoad.ClientSubUnitGuid);
                if (clientSubUnit != null)
                {
                    pointOfSaleFeeLoad.ClientSubUnitName = clientSubUnit.ClientSubUnitName;
                }
            }

            //TravelerType
            if (pointOfSaleFeeLoad.TravelerTypeGuid != null)
            {
                TravelerTypeRepository TravelerTypeRepository = new TravelerTypeRepository();
                TravelerType           TravelerType           = TravelerTypeRepository.GetTravelerType(pointOfSaleFeeLoad.TravelerTypeGuid);
                if (TravelerType != null)
                {
                    pointOfSaleFeeLoad.TravelerTypeName = TravelerType.TravelerTypeName;
                }
            }

            //Product
            if (pointOfSaleFeeLoad.ProductId > 0)
            {
                ProductRepository productRepository = new ProductRepository();
                Product           product           = productRepository.GetProduct(pointOfSaleFeeLoad.ProductId);
                if (product != null)
                {
                    pointOfSaleFeeLoad.Product = product;
                }
            }
        }
Esempio n. 6
0
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(Meeting group)
        {
            if (group.ClientTopUnitGuid != "")
            {
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = clientTopUnitRepository.GetClientTopUnit(group.ClientTopUnitGuid);
                if (clientTopUnit != null)
                {
                    group.ClientTopUnit = clientTopUnit;

                    group.HierarchyType = "ClientTopUnit";
                    group.HierarchyCode = clientTopUnit.ClientTopUnitGuid;
                    group.HierarchyItem = clientTopUnit.ClientTopUnitName;
                }
            }

            if (group.CityCode != "")
            {
                CityRepository cityRepository = new CityRepository();
                City           city           = cityRepository.GetCity(group.CityCode);
                if (city != null)
                {
                    group.City = city;
                }
            }

            //Set MeetingArriveByDateTime from date
            if (group.MeetingArriveByDateTime != null)
            {
                group.MeetingArriveByTime = group.MeetingArriveByDateTime.Value.ToString("HH:mm tt");
            }

            //Set MeetingArriveByDateTime from date
            if (group.MeetingLeaveAfterDateTime != null)
            {
                group.MeetingLeaveAfterTime = group.MeetingLeaveAfterDateTime.Value.ToString("HH:mm tt");
            }
        }
Esempio n. 7
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;
        }