private void btnAddOrder_Click_1(object sender, RoutedEventArgs e)
        {
            AddWindow win = new AddWindow();
            AddOrder addOrderUc = new AddOrder();

            win.Title = "Orders: " + WorkerId;
            addOrderUc.ParentWin = win;
            win.AddGrid.Children.Add(addOrderUc);
            win.SizeToContent = SizeToContent.WidthAndHeight;

            bool? resDiag = win.ShowDialog();
            if (resDiag.HasValue && resDiag.Value)
            {
                Order toAdd = addOrderUc.newOrder;
                toAdd.WorkerId = WorkerId;
                try
                {
                    MainWindow._repo.AddOrders(toAdd);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message , "Show Orders");
                }
                MainWindow._orders = MainWindow._repo.GetOrder(WorkerId);
                dgShowOrders.ItemsSource = MainWindow._orders;
                dgShowOrders.Items.Refresh();
            }
        }
Ejemplo n.º 2
0
        public static Person AddPerson()
        {
            AddWindow aw = new AddWindow();

            aw.ShowDialog();
            return(CurrentPerson);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reakcja na komendę BaseCommand
        /// nawiązuje połączenie z bazą danych oraz wyświetla
        /// dialog dodawania nowej osoby
        /// </summary>
        public void AddContact_Clicked()
        {
            using var db = new MyDatabaseContext();

            var addWindow = new AddWindow();

            if (addWindow.ShowDialog() == true)
            {
                var person = new Person
                {
                    FirstName = addWindow.Firstname.Text.ToUpper(),
                    LastName  = addWindow.Surname.Text.ToUpper(),
                    Age       = Convert.ToInt32(addWindow.Age.Text),

                    Contact = new Contact
                    {
                        City       = addWindow.City.Text.ToUpper(),
                        Street     = addWindow.Street.Text.ToUpper(),
                        HomeNumber = addWindow.HomeNumer.Text.ToUpper(),
                        PostCode   = addWindow.PostCode.Text,
                        PostOffice = addWindow.PostOffice.Text.ToUpper(),
                        Phone      = addWindow.Phone.Text,
                        Email      = addWindow.Email.Text
                    }
                };

                // dodaje użytkownika do bazy oraz zapsiuje zmainy
                db.Persons.Add(addWindow.Person);
                db.SaveChanges();

                // ponowne wczytanie osób z bazy
                mainWindow.personDataModel.Get();
            }
        }
Ejemplo n.º 4
0
        private void AddPhone()
        {
            AddWindow addWindow = new AddWindow();

            addWindow.ShowDialog();
            if (PhoneMediator.IsApply)
            {
                Db.Phones.Add(PhoneMediator.Phone);
                Db.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        private void Add_Click(object sender, MouseButtonEventArgs e)
        {
            this.Hide();
            var screen = new AddWindow();

            screen.ShowDialog();
            if (screen.DialogResult == true)
            {
                _list.ResetBindings();
            }
            this.Show();
        }
Ejemplo n.º 6
0
        private void AddButt_Click(object sender, RoutedEventArgs e)
        {
            Window addWindow = new AddWindow();

            addWindow.ShowDialog();
            MesurementsDataGrid.Items.Refresh();

            if (MesurementsDataGrid.Items.Count == 0)
            {
                return;
            }
        }
Ejemplo n.º 7
0
        private void AddDebtor()
        {
            var dlg = new AddWindow();  //Creating a new window. This windows is getting a debtor as DataContext

            debtor          = new Debtor();
            dlg.DataContext = debtor;
            if (dlg.ShowDialog() == true)
            {
                debtorList.Add(debtor);
                CurrentIndex  = debtorList.Count - 1;
                CurrentDebtor = debtor;
            }
        }
Ejemplo n.º 8
0
        private void UpdatePhone()
        {
            PhoneMediator.Phone = (SelectedPhone.Clone()) as Phone;
            AddWindow addWindow = new AddWindow();

            addWindow.ShowDialog();
            if (PhoneMediator.IsApply)
            {
                Db.Update(PhoneMediator.Phone);
                Db.SaveChanges();
            }
            PhoneMediator.Phone = null;
        }
        private void AddGoodsCommandEv(object parametr)
        {
            AddGoodsViewModel addGoodsViewModel = new AddGoodsViewModel(_mainDataContext);
            AddWindow         DialogWin         = new AddWindow();

            DialogWin.DataContext = addGoodsViewModel;
            if (addGoodsViewModel.CloseAct == null)
            {
                addGoodsViewModel.CloseAct = new Action(() => DialogWin.Close());
            }

            DialogWin.ShowDialog();
        }
Ejemplo n.º 10
0
        private async void AddMenuItem_OnClick(object sender, RoutedEventArgs e)
        {
            var adder = new AddWindow()
            {
                Owner = this.TryFindParent <Window>()
            };

            adder.ShowDialog();
            if (adder.IsCommited)
            {
                await this.ViewModel.ReloadIfInitializedAsync();
            }
        }
        private void EditGoodsCommandEv(object parametr)
        {
            Goods goodsSel = parametr as Goods;
            EditeGoodsViewModel editGoodsViewModel = new EditeGoodsViewModel(goodsSel, _mainDataContext);
            AddWindow           DialogWin          = new AddWindow();

            DialogWin.DataContext = editGoodsViewModel;
            if (editGoodsViewModel.CloseAct == null)
            {
                editGoodsViewModel.CloseAct = new Action(() => DialogWin.Close());
            }

            DialogWin.ShowDialog();
        }
Ejemplo n.º 12
0
        private void btnADD_Click(object sender, RoutedEventArgs e)
        {
            var Pop = new AddWindow((int)udColumn.Value, (int)udRow.Value);

            Pop.Owner = this;
            if ((bool)Pop.ShowDialog())
            {
                //Add the word to the list of words to draw
                Puzzle.Add(Pop.Word);
            }

            mnuSave.IsEnabled = lbClues.Items.Count > 0;

            ReDrawGrid();
        }
        private void AddOrderMI_Click_1(object sender, RoutedEventArgs e)
        {
            AddWindow addWin = new AddWindow();
            AddOrder addOrder = new AddOrder();

            addWin.SizeToContent = SizeToContent.WidthAndHeight;

            addOrder.ParentWin = addWin;
            addWin.AddGrid.Children.Add(addOrder);
            addWin.ShowDialog();
            bool? resDiag = addWin.DialogResult;
            if (resDiag.HasValue && resDiag.Value)
            {
                _repo.AddOrders(addOrder.newOrder);
            }
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            AddWindow addWin = new AddWindow();
            AddView addView = new AddView();

            addWin.SizeToContent = SizeToContent.WidthAndHeight;
            addView.ParentWin = addWin;
            addWin.AddGrid.Children.Add(addView);

            bool? resDiag = addWin.ShowDialog();
            if (resDiag.HasValue && resDiag.Value)
            {
                _repo.Add(addView.newWorker);
                _workers = _repo.GetAll();
                dgWorkers.ItemsSource = _workers;
                dgWorkers.Items.Refresh();
            }
        }
Ejemplo n.º 15
0
        public void OpenAddWindow()
        {
            AddWindow addWindow = new AddWindow();

            if (addWindow.ShowDialog() == false)
            {
                if (addWindow.addNewPhone == null)
                {
                    return;
                }
                else
                {
                    addWindow.addNewPhone.Seller = connectUser.Id;
                    ApplicationContext db = new ApplicationContext();
                    db.Phones.Local.Add(addWindow.addNewPhone);
                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 16
0
        public MainWindowViewModel()
        {
            FriendServer friendServer = new FriendServer();
            DataTable    table        = friendServer.GetTable();

            foreach (DataRow item in table.Rows)
            {
                using (MemoryStream memory = new MemoryStream((byte[])item["Head"]))
                {
                    Bitmap       bitmap = (Bitmap)System.Drawing.Image.FromStream(memory);
                    BitmapSource source = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                    friends.Add(new Friend()
                    {
                        Nickname = item["Nickname"].ToString(), Head = source
                    });
                }
            }
            CloseCommand = new DelegateCommand(() => {
                Application.Current.Shutdown();
            });

            SelectItemChangedCommand = new DelegateCommand <object>((p) => {
                ListView lv = p as ListView;
                friend      = lv.SelectedItem as Friend;

                //Head= friend.Head;
                //Nickname = friend.Nickname;
            });
            AddCommand = new DelegateCommand(() =>
            {
                addWindow = new AddWindow();
                addWindow.ShowDialog();
            });
            ClickCommand = new DelegateCommand(() =>
            {
                MessageBox.Show("你好");
            });
            CaptureCommand = new DelegateCommand(() =>
            {
                CaptureWindow captureWindow = new CaptureWindow();
                captureWindow.ShowDialog();
            });
        }
Ejemplo n.º 17
0
        public Customer AddCustomer()
        {
            vm = new AddWindowViewModel
            {
                CancelCommand = new RelayCommand(o => window.Close()),
                OkCommand     = new RelayCommand(o => { window.DialogResult = true; window.Close(); })
            };

            window = new AddWindow
            {
                DataContext = vm
            };

            var result = window.ShowDialog() ?? false;

            return(!string.IsNullOrEmpty(vm.FirstName) || !string.IsNullOrEmpty(vm.LastName)
                ? result ? vm.Customer : null
                : null);
        }
        public void AddWidget(object parameter)
        {
            //
            // create WidgetOperation object to pass
            // open add window
            //
            WidgetOperation widgetOperation = new WidgetOperation()
            {
                Status = WidgetOperation.OperationStatus.CANCEL,
                Widget = new Widget()
            };
            Window addWdigetWindow = new AddWindow(widgetOperation);

            addWdigetWindow.ShowDialog();

            if (widgetOperation.Status != WidgetOperation.OperationStatus.CANCEL)
            {
                Widgets.Add(widgetOperation.Widget);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// obsługa zdarzenia podwójnego kliknięcia myszką na kontrolce ListView
        /// które wyzwala możliwość edycji rekordu występującego pod kursorem myszy
        /// </summary>
        /// <param name="sender">obiekt wysyłający zdarzenie</param>
        /// <param name="e">dodatkowe argumenty</param>
        private void personListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var row = (DatabaseLibrary.Models.Person)personListView.SelectedItem;

            if (row != null)
            {
                var addWindow = new AddWindow(row.ID);
                if (addWindow.ShowDialog() == true)
                {
                    var p = (from person in _context.Persons
                             join contact in _context.Contacts
                             on person.ID equals contact.PersonID
                             where person.ID == row.ID
                             select person).ToList().First();

                    var c = (from contact in _context.Contacts
                             where contact.PersonID == row.ID
                             select contact).ToList().First();

                    p.FirstName  = addWindow.Firstname.Text.ToUpper();
                    p.LastName   = addWindow.Surname.Text.ToUpper();
                    p.Age        = Convert.ToInt32(addWindow.Age.Text);
                    c.City       = addWindow.City.Text.ToUpper();
                    c.Street     = addWindow.Street.Text.ToUpper();
                    c.HomeNumber = addWindow.HomeNumer.Text.ToUpper();
                    c.PostCode   = addWindow.PostCode.Text.ToUpper();
                    c.PostOffice = addWindow.PostOffice.Text.ToUpper();
                    c.Email      = addWindow.Email.Text.ToUpper();
                    c.Phone      = addWindow.Phone.Text.ToUpper();

                    p.Contact = c;

                    // zapisa danych w bazie
                    _context.Update(p);
                    _context.SaveChanges();

                    // odświerzenie listy głównej
                    personDataModel.Get();
                }
            }
        }
Ejemplo n.º 20
0
        private void EditDebtor()
        {
            var dlg = new AddWindow();

            dlg.Title = "Edit debitor";


            Debtor temp = new Debtor(); //Creating a temporary debtor to edit

            temp.Name       = CurrentDebtor.Name;
            temp.Amount     = CurrentDebtor.Amount;
            temp.Note       = CurrentDebtor.Note;
            dlg.DataContext = temp;
            if (dlg.ShowDialog() == true) //If confirm is pressed, the temporary debtor is copied to the current debtor

            {
                currentDebtor.Name   = temp.Name;
                currentDebtor.Amount = temp.Amount;
                currentDebtor.Note   = temp.Note;
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Add new sender.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbSenderSelect_btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (cbSenderSelect.ComboBoxText == "")
            {
                System.Windows.MessageBox.Show("Email address is empty."); return;
            }
            AddWindow childWindow = new AddWindow();

            childWindow.Owner = this;
            childWindow.ShowDialog();

            try
            {
                VariableClass.Senders.Add(cbSenderSelect.ComboBoxText, CodePassword.getCodPassword(childWindow.Password));
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("User with such address is already exist.");
                return;
            }
            cbSenderSelect.UpdateComboBox();
        }
Ejemplo n.º 22
0
        private void Menu_NewItem_Click(object sender, RoutedEventArgs e)
        {
            //create Window to prompt user for data.
            var createItemWindow = new AddWindow();

            //if 'OK' pressed
            if (createItemWindow.ShowDialog() == true)
            {
                //Get data from create-window.
                string Name            = createItemWindow.Name;
                string Street          = createItemWindow.Street;
                int    StreetNum       = createItemWindow.StreetNum;
                int    ZipCode         = createItemWindow.ZipCode;
                string City            = createItemWindow.City;
                string TreeMonitorList = createItemWindow.TreeMonitorList;


                Location item = new Location(Name, Street, StreetNum, ZipCode, City, TreeMonitorList);

                LocationList items = (LocationList)Resources["LocationList"];
                items.NewItemCommand.Execute(item);
            }
        }
Ejemplo n.º 23
0
        public void AddWidget(object parameter)
        {
            //
            // create WidgetOperation object to pass
            // open add window
            //
            WidgetOperation widgetOperation = new WidgetOperation()
            {
                Status = WidgetOperation.OperationStatus.CANCEL,
                Widget = new Widget()
            };
            Window addWdigetWindow = new AddWindow(widgetOperation);

            addWdigetWindow.ShowDialog();

            //
            // TODO consider refactoring and use a class with the Widget object and status
            //
            if (widgetOperation.Status != WidgetOperation.OperationStatus.CANCEL)
            {
                Widgets.Add(widgetOperation.Widget);
            }
        }
        public void addAnnouncement()
        {
            AddWindow addWindow = new AddWindow();

            addWindow.ShowDialog();
        }
        private void MenuItem_Click_3(object sender, RoutedEventArgs e)
        {
            int index = dgWorkers.Items.IndexOf(dgWorkers.CurrentItem);
            int actId = _workers.ElementAt(index).id;

            //int r = res.id;
            //MessageBox.Show(r.ToString());
            _orders = _repo.GetOrder(actId);

            MessageBoxResult res = MessageBoxResult.None;

            if (_orders.Count() == 0)
            {
                res = MessageBox.Show("orders not found in " + " You want add Order ", _workers.ElementAt(index).FirstName + " " + _workers.ElementAt(index).LastName,
                    MessageBoxButton.YesNo , MessageBoxImage.Question);
            }

            if (_orders.Count() != 0 || res == MessageBoxResult.Yes)
            {

                try
                {
                    AddWindow addWin = new AddWindow();
                    OrderShow orderShow = new OrderShow();

                    addWin.SizeToContent = SizeToContent.WidthAndHeight;
                    addWin.Title = _workers.ElementAt(index).FirstName + " " + _workers.ElementAt(index).LastName;
                    orderShow.ParentWin = addWin;
                    addWin.AddGrid.Children.Add(orderShow);
                    orderShow.WorkerId = _workers.ElementAt(index).id;
                    addWin.ShowDialog();
                }
                    catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
 public void Execute(object parameter)
 {
     AddWindow addWindow = new AddWindow();
     addWindow.ShowDialog();
 }
Ejemplo n.º 27
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            AddWindow addWindow = new AddWindow();

            addWindow.ShowDialog();
        }