Exemplo n.º 1
0
 public static AccountingEquipmentEntities GetContext()
 {
     if (_context == null)
     {
         _context = new AccountingEquipmentEntities();
     }
     return(_context);
 }
Exemplo n.º 2
0
 private void Page_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (Visibility == Visibility.Visible)
     {
         AccountingEquipmentEntities.GetContext().ChangeTracker.Entries().ToList().ForEach(p => p.Reload());
         DgridMyPage.ItemsSource = AccountingEquipmentEntities.GetContext().EquipmentCard.ToList();
     }
 }
Exemplo n.º 3
0
 public EquipmentPage()
 {
     InitializeComponent();
     DataContext   = _CurrentEquipment;
     manufacturers = AccountingEquipmentEntities.GetContext().Manufacturer.ToList();
     manufacturers.Insert(0, new Manufacturer {
         ManufacturerName = "All"
     });
     FilteCmb.ItemsSource = manufacturers;
 }
        public void loadWorker()
        {
            Worker Wrk = AccountingEquipmentEntities.GetContext().Worker.Where(w => w.id == SenderMail.IntId).FirstOrDefault();

            UIasd.FioTxt.Text      = Wrk.FIO;
            UIasd.PositionTxt.Text = Wrk.Position.PostionName;
            UIasd.ImageByte        = LoadImage(Wrk.Photo);
            if (Wrk.CheckFirstVisit == true)
            {
                PasswordWindow psd = new PasswordWindow();
                psd.ShowDialog();
            }
        }
Exemplo n.º 5
0
 private void FilteCmb_DropDownClosed(object sender, EventArgs e)
 {
     if (FilteCmb.SelectedIndex == 0)
     {
         DgridMyPage.ItemsSource = AccountingEquipmentEntities.GetContext().EquipmentCard.ToList();
     }
     else if (SearchTxt.Text == "")
     {
         DgridMyPage.ItemsSource = AccountingEquipmentEntities.GetContext().EquipmentCard.Where(w => w.Equipment.Manufacturer.ManufacturerName == FilteCmb.Text).ToList();
     }
     else
     {
         DgridMyPage.ItemsSource = AccountingEquipmentEntities.GetContext().
                                   EquipmentCard.Where(w => w.SerialNumber.StartsWith(SearchTxt.Text) && w.Equipment.Manufacturer.ManufacturerName == FilteCmb.Text).ToList();
     }
 }
Exemplo n.º 6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var WorkerFPs = AccountingEquipmentEntities.GetContext().Worker.Where(w => w.id == SenderMail.IntId).FirstOrDefault();

            if (FirstEnterPass.Text != SecondEnterPass.Text)
            {
                MessageBox.Show("Введеные пароли не совпадают", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                WorkerFPs.Password        = FirstEnterPass.Text;
                WorkerFPs.CheckFirstVisit = false;
                AccountingEquipmentEntities.GetContext().SaveChanges();
                this.Close();
            }
        }
Exemplo n.º 7
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            var EquipmentForRemoving = DgridMyPage.SelectedItems.Cast <EquipmentCard>().ToList();

            if (MessageBox.Show($"Вы точно хотите удалить следующие {EquipmentForRemoving.Count} элементов?", "Внимание",
                                MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                try
                {
                    AccountingEquipmentEntities.GetContext().EquipmentCard.RemoveRange(EquipmentForRemoving);
                    AccountingEquipmentEntities.GetContext().SaveChanges();
                    MessageBox.Show("Данные удалены");
                    DgridMyPage.ItemsSource = AccountingEquipmentEntities.GetContext().EquipmentCard.ToList();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
        }