Пример #1
0
        public void HandleNotification(object sender, EventArgs e)
        {
            try {
                InventoryService.EventDataType eventData = (InventoryService.EventDataType)sender;

                WindowInventory windowInventory = new WindowInventory(eventData);
                windowInventory.Show();
            } catch (Exception ex) {
                LoggingSystem.LogMessageToFile(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Пример #2
0
        public WindowInventory(InventoryService.EventDataType eventData)
        {
            InitializeComponent();

            DoctorName     = eventData.DoctorName;
            ClientName     = eventData.ClientName;
            TitleText      = "Лечение от " + eventData.CreateDate;
            CreateDateTime = eventData.CreateDate;

            ServiceItems = new ObservableCollection <ServiceItem>();
            foreach (InventoryService.EventDataType.Service service in eventData.Services)
            {
                if (service.Materials.Length == 0)
                {
                    ServiceItems.Add(new ServiceItem()
                    {
                        Name        = "Сведения о материалах из технологических карт отсутствуют",
                        ServiceName = service.Name + " (" + service.Count + " шт.)"
                    });
                }

                foreach (InventoryService.EventDataType.Service.Material material in service.Materials)
                {
                    ServiceItems.Add(new ServiceItem()
                    {
                        Id1C          = material.Id1C,
                        IdMis         = material.IdMis,
                        ServiceCount  = service.Count,
                        CountStandard = material.Count,
                        CountFact     = material.Count * service.Count,
                        Name          = material.Name,
                        ServiceName   = service.Name + " (" + service.Count + " шт.)",
                        Unit          = material.Unit
                    });
                }
            }

            DataContext = this;
            listViewServices.DataContext = this;
            listViewServices.ItemsSource = ServiceItems;

            CollectionView           view             = (CollectionView)CollectionViewSource.GetDefaultView(listViewServices.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("ServiceName");

            view.GroupDescriptions.Add(groupDescription);
        }