private Utility_class_UserData FillBasicData(Utility_class_UserData newData, Utility_class_UserData baseData)
        {
            newData.iD        = baseData.iD;
            newData.USER_NAME = baseData.USER_NAME;
            newData.PASSWORD  = baseData.PASSWORD;
            newData.USER_KIND = baseData.USER_KIND;

            newData.AIRLINE_ID       = baseData.AIRLINE_ID;
            newData.CUSTOMER_ID      = baseData.CUSTOMER_ID;
            newData.ADMINISTRATOR_ID = baseData.ADMINISTRATOR_ID;

            return(newData);
        }
        private async Task <Utility_class_UserData> Utility_class_UserToData(Utility_class_User registeredUser)
        {
            Utility_class_UserData data = new Utility_class_UserData();

            data.iD = registeredUser.ID;
            try
            {
                data.USER_NAME = Statics.Decrypt(registeredUser.USER_NAME, ENCRIPTION_PHRASE);
            }
            catch
            {
                data.USER_NAME = registeredUser.USER_NAME;
            }
            try
            {
                data.PASSWORD = Statics.Decrypt(registeredUser.PASSWORD, ENCRIPTION_PHRASE);
            }
            catch
            {
                data.PASSWORD = registeredUser.PASSWORD;
            }
            data.USER_KIND = registeredUser.USER_KIND;

            data.ADMINISTRATOR_ID = registeredUser.ADMINISTRATOR_ID;
            data.AIRLINE_ID       = registeredUser.AIRLINE_ID;
            data.CUSTOMER_ID      = registeredUser.CUSTOMER_ID;

            data.customer      = null; //await _dao.GetOneByRegUserId<Customer>(registeredUser.ID);
            data.airline       = null; //await _dao.GetOneByRegUserId<AirlineCompany>();
            data.administrator = null;
            switch (registeredUser.USER_KIND)
            {
            case "Customer":
                data.customer = await _dao.GetOneByRegUserId <Customer>(registeredUser.ID);

                break;

            case "Administrator":
                data.administrator = await _dao.GetOneByRegUserId <Administrator>(registeredUser.ID);

                break;

            case "AirlineCompany":
                data.airline = await _dao.GetOneByRegUserId <AirlineCompany>(registeredUser.ID);

                break;
            }
            return(data);
        }
        public async Task <IBasicData> ConversionSelector(IPoco selector, Type selectionType)
        {
            return(await Task.Run(async() =>
            {
                if (!correlation.ContainsKey(selectionType))
                {
                    if (selector is AirlineCompany)
                    {
                        correlation.Add(selectionType, async(selectorToFunc) => { return await AirlineCompanyToData(selectorToFunc as AirlineCompany); });
                    }
                    if (selector is Country)
                    {
                        correlation.Add(selectionType, async(selectorToFunc) => { return await CountryToData(selectorToFunc as Country); });
                    }
                    if (selector is Customer)
                    {
                        correlation.Add(selectionType, async(selectorToFunc) => { return await CustomerToData(selectorToFunc as Customer); });
                    }
                    if (selector is Administrator)
                    {
                        correlation.Add(selectionType, async(selectorToFunc) => { return await AdministratorToData(selectorToFunc as Administrator); });
                    }

                    if (selector is Utility_class_User)
                    {
                        switch ((selector as Utility_class_User).USER_KIND)
                        {
                        case "Administrator":
                            selectionType = typeof(Utility_class_UserAdministratorData);
                            if (!correlation.ContainsKey(selectionType))
                            {
                                correlation.Add(selectionType, async(selectorToFunc) => { return await Task.Run(async() =>
                                    {
                                        Utility_class_UserData baseData = await Utility_class_UserToData(selectorToFunc as Utility_class_User);
                                        Utility_class_UserAdministratorData adminData = FillBasicData(new Utility_class_UserAdministratorData(), baseData) as Utility_class_UserAdministratorData;
                                        if (baseData.administrator != null)
                                        {
                                            AdministratorData administratorData = await AdministratorToData(baseData.administrator);
                                            adminData.AdministratoriD = administratorData.iD;
                                            adminData.Name = administratorData.Name;
                                        }
                                        return adminData;
                                    }); });
                            }

                            break;

                        case "AirlineCompany":
                            selectionType = typeof(Utility_class_UserAirlineCompanyData);
                            if (!correlation.ContainsKey(selectionType))
                            {
                                correlation.Add(selectionType, async(selectorToFunc) => { return await Task.Run(async() =>
                                    {
                                        Utility_class_UserData baseData = await Utility_class_UserToData(selectorToFunc as Utility_class_User);
                                        Utility_class_UserAirlineCompanyData airlineData = FillBasicData(new Utility_class_UserAirlineCompanyData(), baseData) as Utility_class_UserAirlineCompanyData;
                                        if (baseData.airline != null)
                                        {
                                            AirlineCompanyData airlineCompanyData = await AirlineCompanyToData(baseData.airline);
                                            airlineData.AirlineCompanyiD = airlineCompanyData.iD;
                                            airlineData.Adorning = airlineCompanyData.Adorning;
                                            airlineData.Image = airlineCompanyData.Image;
                                            airlineData.AirlineName = airlineCompanyData.AirlineName;
                                            airlineData.BaseCountryName = airlineCompanyData.BaseCountryName;
                                        }
                                        return airlineData;
                                    }); });
                            }
                            break;

                        case "Customer":
                            selectionType = typeof(Utility_class_UserCustomerData);
                            if (!correlation.ContainsKey(selectionType))
                            {
                                correlation.Add(selectionType, async(selectorToFunc) => { return await Task.Run(async() =>
                                    {
                                        Utility_class_UserData baseData = await Utility_class_UserToData(selectorToFunc as Utility_class_User);
                                        Utility_class_UserCustomerData customerData = FillBasicData(new Utility_class_UserCustomerData(), baseData) as Utility_class_UserCustomerData;
                                        if (baseData.customer != null)
                                        {
                                            CustomerData currentCustomerData = await CustomerToData(baseData.customer);
                                            customerData.CustomeriD = currentCustomerData.iD;
                                            customerData.FirstName = currentCustomerData.FirstName;
                                            customerData.LastName = currentCustomerData.LastName;
                                            customerData.Address = currentCustomerData.Address;
                                            customerData.Phone_Num = currentCustomerData.Phone_Num;
                                            customerData.Credit_Card = currentCustomerData.Credit_Card;
                                            customerData.Image = currentCustomerData.Image;
                                        }
                                        return customerData;
                                    }); });
                            }
                            break;
                        }
                    }
                }

                var retVal = await correlation[selectionType](selector);
                return retVal;//await correlation[selectionType](selector);
            }));
        }