void SetItemSource(QueryAPI api)
        {
            var prCache = api.GetCache(typeof(Uniconta.DataModel.PrCategory)) ?? api.LoadCache(typeof(Uniconta.DataModel.PrCategory)).GetAwaiter().GetResult();
            var cache   = new PrCategoryRevenueFilter(prCache);

            cmbCategory.cacheFilter = new PrCategoryRevenueFilter(prCache);
        }
        async void SetItemSource(QueryAPI api)
        {
            var prCache = api.GetCache(typeof(Uniconta.DataModel.PrCategory)) ?? await api.LoadCache(typeof(Uniconta.DataModel.PrCategory));

            //  cmbCategory.ItemsSource = new PrCategoryRevenueFilter(prCache);
            cmbRegCategory.ItemsSource = new PrCategoryRegulationFilter(prCache);
        }
Exemple #3
0
        async Task LoadBaseData(QueryAPI api)
        {
            this.comp = api.CompanyEntity;

            payrollCategoryCache = api.GetCache <Uniconta.DataModel.EmpPayrollCategory>() ?? await api.LoadCache <Uniconta.DataModel.EmpPayrollCategory>().ConfigureAwait(false);

            projectCache = comp.GetCache(typeof(Uniconta.DataModel.Project)) ?? await api.LoadCache(typeof(Uniconta.DataModel.Project)).ConfigureAwait(false);

            employeeCache = comp.GetCache(typeof(Uniconta.DataModel.Employee)) ?? await api.LoadCache(typeof(Uniconta.DataModel.Employee)).ConfigureAwait(false);

            projectGrpCache = comp.GetCache(typeof(Uniconta.DataModel.ProjectGroup)) ?? await api.LoadCache(typeof(Uniconta.DataModel.ProjectGroup)).ConfigureAwait(false);

            prCategoryCache = comp.GetCache(typeof(Uniconta.DataModel.PrCategory)) ?? await api.LoadCache(typeof(Uniconta.DataModel.PrCategory)).ConfigureAwait(false);

            prTaskCache = comp.GetCache(typeof(Uniconta.DataModel.ProjectTask)) ?? await api.LoadCache(typeof(Uniconta.DataModel.ProjectTask)).ConfigureAwait(false);

            LoadingTask = null; // we are done
        }
        static public void SetDeliveryAdress(DCInvoice InvClient, DCAccount client, QueryAPI api)
        {
            SetGLNnumber(InvClient, client, api);

            if (InvClient._DeliveryAddress1 != null)
            {
                return;
            }

            if (InvClient._Installation != null)
            {
                var wInsCache    = api.GetCache(typeof(WorkInstallation)) ?? api.LoadCache(typeof(WorkInstallation)).GetAwaiter().GetResult();
                var installation = (WorkInstallation)wInsCache.Get(InvClient._Installation);
                if (installation == null)
                {
                    wInsCache    = api.LoadCache(typeof(WorkInstallation), true).GetAwaiter().GetResult();
                    installation = (WorkInstallation)wInsCache.Get(InvClient._Installation);
                }
                if (installation != null)
                {
                    InvClient._DeliveryName     = installation._Name;
                    InvClient._DeliveryAddress1 = installation._Address1;
                    InvClient._DeliveryAddress2 = installation._Address2;
                    InvClient._DeliveryAddress3 = installation._Address3;
                    InvClient._DeliveryZipCode  = installation._ZipCode;
                    InvClient._DeliveryCity     = installation._City;
                    if (api.CompanyEntity._Country != (byte)installation._Country)
                    {
                        InvClient._DeliveryCountry = installation._Country;
                    }
                }
            }
            else
            {
                DCAccount deb = null;
                string    ac;
                bool      UseDebAddress;
                if (InvClient._DeliveryAccount != null)
                {
                    ac            = InvClient._DeliveryAccount;
                    UseDebAddress = true;
                }
                else
                {
                    UseDebAddress = false;
                    if (client != null)
                    {
                        deb = client;
                        ac  = null;
                    }
                    else
                    {
                        ac = InvClient._DCAccount;
                    }
                }
                if (ac != null)
                {
                    var dctype  = InvClient.__DCType();
                    var t       = (dctype == 2 || dctype == 9) ? typeof(Uniconta.DataModel.Creditor) : typeof(Uniconta.DataModel.Debtor);
                    var dcCache = api.GetCache(t) ?? api.LoadCache(t).GetAwaiter().GetResult();
                    deb = (DCAccount)dcCache.Get(ac);
                    if (deb == null)
                    {
                        dcCache = api.LoadCache(t, true).GetAwaiter().GetResult();
                        deb     = (DCAccount)dcCache.Get(ac);
                    }
                }
                if (deb != null)
                {
                    if (deb._DeliveryAddress1 != null)
                    {
                        InvClient._DeliveryName     = deb._DeliveryName;
                        InvClient._DeliveryAddress1 = deb._DeliveryAddress1;
                        InvClient._DeliveryAddress2 = deb._DeliveryAddress2;
                        InvClient._DeliveryAddress3 = deb._DeliveryAddress3;
                        InvClient._DeliveryZipCode  = deb._DeliveryZipCode;
                        InvClient._DeliveryCity     = deb._DeliveryCity;
                        InvClient._DeliveryCountry  = deb._DeliveryCountry;
                    }
                    else if (UseDebAddress)
                    {
                        InvClient._DeliveryName     = deb._Name;
                        InvClient._DeliveryAddress1 = deb._Address1;
                        InvClient._DeliveryAddress2 = deb._Address2;
                        InvClient._DeliveryAddress3 = deb._Address3;
                        InvClient._DeliveryZipCode  = deb._ZipCode;
                        InvClient._DeliveryCity     = deb._City;
                        if (api.CompanyEntity._Country != (byte)deb._Country)
                        {
                            InvClient._DeliveryCountry = deb._Country;
                        }
                    }
                }
            }
        }