예제 #1
0
        private bool ItemFind()
        {
            QuickSearch quickSearch = null;
            bool        result      = false;

            try {
                if (!itemIsFindind)
                {
                    itemIsFindind = true;
                    quickSearch   = MyApp.CreateQuickSearch(QuickSearchViews.QSV_Item, MyApp.SystemSettings.StartUpInfo.CacheQuickSearchItem);
                    clsCollection qsParams = new clsCollection();
                    qsParams.add(MyApp.SystemSettings.QuickSearchDefaults.WarehouseID, "@WarehouseID");
                    qsParams.add(MyApp.SystemSettings.QuickSearchDefaults.PriceLineID, "@PriceLineID");
                    qsParams.add(MyApp.SystemSettings.QuickSearchDefaults.LanguageID, "@LanguageID");
                    qsParams.add(MyApp.SystemSettings.QuickSearchDefaults.DisplayDiscontinued, "@Discontinued");
                    if (MyApp.SystemSettings.StartUpInfo.UseItemSearchAlterCurrency)
                    {
                        qsParams.add(MyApp.SystemSettings.AlternativeCurrency.SaleExchange, "@ctxBaseCurrency");
                    }
                    else
                    {
                        qsParams.add(MyApp.SystemSettings.QuickSearchDefaults.EuroConversionRate, "@ctxBaseCurrency");
                    }
                    quickSearch.Parameters = qsParams;

                    if (quickSearch.SelectValue())
                    {
                        result = true;
                        var itemId = quickSearch.ValueSelectedString();
                        //MyApp.ItemGet(itemId);
                    }
                    itemIsFindind = false;
                }
            }
            catch (Exception ex) {
                itemIsFindind = false;
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally {
            }
            quickSearch = null;

            return(result);
        }
예제 #2
0
        // NOTA: QuickSearch NÃO É SUPORTADO EM .NET
        public static QuickSearch CreateQuickSearch(EntityTypeEnum entityType)
        {
            var systemSettings = APIEngine.SystemSettings;
            QuickSearchViews qsvQuickSearchID = QuickSearchViews.QSV_None;
            clsCollection    paramValues      = null;
            QuickSearch      quickSearch      = null;

            if (quickSearch != null)
            {
                if (quickSearch.isFinding)
                {
                    return(quickSearch);
                }
            }

            switch (entityType)
            {
            case EntityTypeEnum.itZone:
                qsvQuickSearchID = QuickSearchViews.QSV_Zone;
                break;

            case EntityTypeEnum.itPayment:
                qsvQuickSearchID = QuickSearchViews.QSV_Payment;
                break;

            case EntityTypeEnum.itTender:
                qsvQuickSearchID = QuickSearchViews.QSV_TenderNames;
                break;

            case EntityTypeEnum.itSalesman:
                qsvQuickSearchID = QuickSearchViews.QSV_Salesman;
                break;

            case EntityTypeEnum.itCustomer:
                qsvQuickSearchID = QuickSearchViews.QSV_Customer;
                break;

            case EntityTypeEnum.itFamily:
                qsvQuickSearchID = QuickSearchViews.QSV_Family;
                break;

            case EntityTypeEnum.itWarehouse:
                qsvQuickSearchID = QuickSearchViews.QSV_Warehouse;
                break;

            case EntityTypeEnum.itItem:
                qsvQuickSearchID = QuickSearchViews.QSV_Item;

                paramValues = new clsCollection();
                paramValues.add(systemSettings.QuickSearchDefaults.WarehouseID, "@WarehouseID");
                paramValues.add(systemSettings.QuickSearchDefaults.PriceLineID, "@PriceLineID");
                paramValues.add(systemSettings.QuickSearchDefaults.LanguageID, "@LanguageID");
                paramValues.add(systemSettings.QuickSearchDefaults.DisplayDiscontinued, "@Discontinued");
                if (systemSettings.StartUpInfo.UseItemSearchAlterCurrency)
                {
                    paramValues.add(systemSettings.AlternativeCurrency.SaleExchange, "@ctxBaseCurrency");
                }
                else
                {
                    paramValues.add(systemSettings.QuickSearchDefaults.EuroConversionRate, "@ctxBaseCurrency");
                }
                break;
            }
            quickSearch = APIEngine.CreateQuickSearch(qsvQuickSearchID, false);

            if (paramValues != null)
            {
                quickSearch.Parameters = paramValues;
            }

            return(quickSearch);
        }