Exemplo n.º 1
0
        private bool SearchProduct()
        {
            errSearch.SetError(mtxtSearch, string.Empty);
            if (string.IsNullOrEmpty(this.SearchText) || string.IsNullOrWhiteSpace(this.SearchText))
            {
                return(false);
            }

            string kundenNr;

            if (this.SearchText.StartsWith("*", StringComparison.CurrentCulture))
            {
                var filterArray = this.SearchText.Split();
                if (filterArray.Length == 2)
                {
                    kundenNr               = string.Format("{0}00000", filterArray[0].Substring(1, 5));
                    this.SearchText        = filterArray[1];
                    this.myProductCustomer = ModelManager.CustomerService.GetKunde(kundenNr, true);
                }
            }
            if (this.myProductCustomer != null)
            {
                this.AddRecentCustomer(this.myProductCustomer);
            }
            else
            {
                this.myProductCustomer = ModelManager.CustomerService.GetCPM();
            }
            var list = ModelManager.ProductService.GetProductList(this.myProductCustomer, this.SearchText);

            if (list.Count == 1)
            {
                this.AddRecentProduct(list[0]);
                ModelManager.ProductService.CurrentProduct = list[0];
                var adv = new ArtikelDetailView(list[0], this.myProductCustomer);
                adv.Show();
            }
            else if (list.Count > 1)
            {
                var psv = new ProductSearchView(list);
                psv.ProductChosen += Psv_ProductChosen;
                psv.Show();
            }
            else
            {
                var msg = string.Format("Die Suche nach '{0}' ergab leider garnichts.", this.SearchText);
                errSearch.SetError(this.mtxtSearch, msg);
            }
            return(true);
        }
Exemplo n.º 2
0
        void ShowProduct()
        {
            if (this.mySelectedProduct == null)
            {
                return;
            }
            ModelManager.ProductService.CurrentProduct = this.mySelectedProduct;
            var adv = new ArtikelDetailView(this.mySelectedProduct, Model.ModelManager.CustomerService.GetCPM());

            adv.Show();
            if (!this.mchkDontClose.Checked)
            {
                this.Close();
            }
        }
Exemplo n.º 3
0
        private void Psv_ProductChosen(object sender, EventArgs e)
        {
            var               psv   = sender as ProductSearchView;
            Kunde             kunde = this.myProductCustomer;
            ArtikelDetailView adv   = null;

            if (kunde != null)
            {
                this.AddRecentProduct(psv.SelectedProduct);
                ModelManager.ProductService.CurrentProduct = psv.SelectedProduct;
                adv = new ArtikelDetailView(psv.SelectedProduct, kunde);
            }
            else
            {
                this.AddRecentProduct(psv.SelectedProduct);
                ModelManager.ProductService.CurrentProduct = psv.SelectedProduct;
                adv = new ArtikelDetailView(psv.SelectedProduct, ModelManager.CustomerService.GetCPM());
            }
            adv.Show();
        }
Exemplo n.º 4
0
        private void mlnkCurrentCustomer_Click(object sender, EventArgs e)
        {
            switch (this.mradioArtikel.Checked)
            {
            case true:
                var product = this.mlnkCurrentElement.Tag as Product;
                if (product != null)
                {
                    var adv = new ArtikelDetailView(product, ModelManager.CustomerService.GetCPM());
                    adv.Show();
                }
                break;

            case false:
                var kunde = this.mlnkCurrentElement.Tag as Kunde;
                if (kunde != null)
                {
                    var kmv = new KundeMainView(kunde);
                    kmv.Show();
                }
                break;
            }
        }