Ejemplo n.º 1
0
        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            var tv  = (TreeView)sender;
            var tvi = (TreeViewItem)tv.SelectedItem;

            Cursor = System.Windows.Input.Cursors.Wait;


            MainTreeView.GetTreeViewExpandedState("Gruppe");

            if (tvi != null && tvi.Tag != null)
            {
                switch (tvi.Tag.ToString())
                {
                case "Kundendaten":
                {
                    var p = new Kundendaten();
                    NavigationService.Navigate(p);

                    break;
                }

                default:
                    Cursor = System.Windows.Input.Cursors.Arrow;
                    if (tvi.Tag.ToString() != "Gruppe")
                    {
                        MessageBox.Show("Diese Ansicht wurde nocht nicht implementiert");
                    }
                    break;
                }
            }

            Cursor = System.Windows.Input.Cursors.Arrow;
        }
Ejemplo n.º 2
0
        public Kundendaten GetCustomerProductInformation(string username, string password, string InternalId)
        {
            Kundendaten knd = new Kundendaten();
            List<Guid> allowedCustomers = new List<Guid>();
            try
            {
                allowedCustomers = CheckLogin.CheckUser(username, password, InternalId);
                if (allowedCustomers.Count > 0)
                {
                    using (DataClasses1DataContext dbContext = new DataClasses1DataContext(new Guid(ConfigurationManager.AppSettings["currentUser"])))
                    {
                        dbContext.WriteLogItem("Zugriff von der IP Adresse: " + this.Context.Request.UserHostAddress + "Webservice GetCustomerInformation()", LogTypes.INFO);
                        ValidateOrderType.GetCutomerInformation(out knd, allowedCustomers, dbContext);
                    }
                }
                else
                {
                    throw new Exception("Für Ihre Daten konnten keine Kunden gefunden werden!");
                }
            }
            catch(Exception ex)
            {
                throw new Exception("Fehler beim verabeiten der Daten, bitte wiederholen Sie den Vorgang" + Environment.NewLine + "Fehlermeldung: " + ex.Message);
            }

            return knd;
        }
Ejemplo n.º 3
0
        public static Kundendaten GetCutomerInformation(out Kundendaten _object, List<Guid> allowedCustomers, DataClasses1DataContext dbContext)
        {
            _object = new Kundendaten();
            var queryCustomer = from cust in dbContext.Customer
                                where allowedCustomers.Contains(cust.Id)
                                select new { cust.Id, cust.Name };

            _object.Customer = new KundendatenCustomer[queryCustomer.Count()];

            int countCustomer = 0;

            foreach (var custItem in queryCustomer)
            {
                int countLocation = 0;
                _object.Customer[countCustomer] = new KundendatenCustomer();

                _object.Customer[countCustomer].Informationen = new KundendatenCustomerInformationen();

                var currentCustomerLocations = from cl in dbContext.Location where cl.CustomerId == custItem.Id select new { cl.Id, cl.Name };
                _object.Customer[countCustomer].Informationen.CustomerLocations = new KundendatenCustomerInformationenCustomerLocations[currentCustomerLocations.Count()];
                _object.Customer[countCustomer].Informationen.CustomerId = custItem.Id.ToString();
                _object.Customer[countCustomer].Informationen.CustomerName = custItem.Name.ToString();

                foreach (var locItems in currentCustomerLocations)
                {
                    _object.Customer[countCustomer].Informationen.CustomerLocations[countLocation] = new KundendatenCustomerInformationenCustomerLocations();
                    _object.Customer[countCustomer].Informationen.CustomerLocations[countLocation].LocationId = locItems.Id.ToString();
                    _object.Customer[countCustomer].Informationen.CustomerLocations[countLocation].LocationName = locItems.Name.ToString();
                    countLocation++;
                }

                int countCostCenter = 0;

                var currentCustomerCostCenter = from cl in dbContext.CostCenter where cl.CustomerId == custItem.Id select new { cl.Id, cl.Name };
                _object.Customer[countCustomer].Informationen.CustomerCostCenter= new KundendatenCustomerInformationenCustomerCostCenter[currentCustomerCostCenter.Count()];

                foreach (var costItems in currentCustomerCostCenter)
                {
                    _object.Customer[countCustomer].Informationen.CustomerCostCenter[countCostCenter] = new KundendatenCustomerInformationenCustomerCostCenter();
                    _object.Customer[countCustomer].Informationen.CustomerCostCenter[countCostCenter].CostCenterId = costItems.Id.ToString();
                    _object.Customer[countCustomer].Informationen.CustomerCostCenter[countCostCenter].CostCenterName = costItems.Name.ToString();
                    countCostCenter++;
                }

                countCustomer++;
            }

            var queryProducts = from pr in dbContext.Product select new { pr.Id, pr.Name, pr.ItemNumber };
            _object.Produkte = new KundendatenProdukte[queryProducts.Count()];

            int countProducts = 0;

            foreach (var productItem in queryProducts)
            {
                _object.Produkte[countProducts] = new KundendatenProdukte();
                _object.Produkte[countProducts].Informationen = new KundendatenProdukteInformationen();
                _object.Produkte[countProducts].Informationen.ProductId = productItem.Id.ToString();
                _object.Produkte[countProducts].Informationen.ProductName = productItem.Name;
                _object.Produkte[countProducts].Informationen.ProductId = productItem.Id.ToString();
                countProducts++;
            }

            return _object;
        }