Example #1
0
        /// <summary>
        /// Блоки сортировки и поиска данных по тексту
        /// </summary>
        private void NameTxt_TextChanged(object sender, TextChangedEventArgs e)
        {
            var name1 = AccountingForConsumablesEntities.GetContext().OrderedMaterial.Distinct().ToList();
            var name  = AccountingForConsumablesEntities.GetContext().OrderedMaterial.Select(s => s.MaterialCard.id).Distinct().ToArray();

            for (int i = 0; i < name.Count(); i++)
            {
                int             stdasd = name[i];
                int             tbs    = AccountingForConsumablesEntities.GetContext().OrderedMaterial.Where(w => w.FK_MaterialCard == stdasd).Sum(s => s.OrderedQuantity);
                OrderedMaterial tasd   = name1.Where(s => s.FK_MaterialCard == stdasd).FirstOrDefault();
                OrderedMaterial card   = new OrderedMaterial()
                {
                    FK_MaterialCard = tasd.FK_MaterialCard, MaterialCard = tasd.MaterialCard, counter = tbs, Order = tasd.Order
                };
                tbd.Add(card);
            }
            if (NameTxt.Text == "")
            {
                DGridConsumable.ItemsSource = tbd.ToList();
            }
            else if (ManufacturerCmb.SelectedIndex == 0)
            {
                DGridConsumable.ItemsSource = tbd.Where(w => w.MaterialCard.Materials.MaterialName.StartsWith(NameTxt.Text)).ToList();
            }
            else
            {
                DGridConsumable.ItemsSource = tbd.Where(w => w.MaterialCard.Materials.MaterialName.StartsWith(NameTxt.Text) && w.MaterialCard.Materials.Manufacturer.ManufacturerName == ManufacturerCmb.Text).ToList();
            }
        }
Example #2
0
        public ConsumPageAbout()
        {
            InitializeComponent();
            ManufacturerLst = AccountingForConsumablesEntities.GetContext().Manufacturer.ToList();
            ManufacturerLst.Insert(0, new Manufacturer {
                ManufacturerName = "All"
            });
            ManufacturerCmb.ItemsSource = ManufacturerLst;
            var name1 = AccountingForConsumablesEntities.GetContext().OrderedMaterial.Distinct().ToList();
            var name  = AccountingForConsumablesEntities.GetContext().OrderedMaterial.Select(s => s.MaterialCard.id).Distinct().ToArray();

            for (int i = 0; i < name.Count(); i++)
            {
                int             stdasd = name[i];
                int             tbs    = AccountingForConsumablesEntities.GetContext().OrderedMaterial.Where(w => w.FK_MaterialCard == stdasd).Sum(s => s.OrderedQuantity);
                OrderedMaterial tasd   = name1.Where(s => s.FK_MaterialCard == stdasd).FirstOrDefault();
                OrderedMaterial card   = new OrderedMaterial()
                {
                    FK_MaterialCard = tasd.FK_MaterialCard, MaterialCard = tasd.MaterialCard, counter = tbs, FK_Order = 1
                };
                tbd.Add(card);
            }
            DGridConsumable.ItemsSource = tbd;
        }