Exemple #1
0
        private void OnAddView(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                if (Bcfier.SelectedBcf() == null)
                {
                    return;
                }
                var issue = e.Parameter as Markup;
                if (issue == null)
                {
                    MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                var addView = new AddView(issue, Bcfier.SelectedBcf().TempPath);
                var win     = new Window
                {
                    Content               = addView,
                    Title                 = "Add View",
                    SizeToContent         = SizeToContent.WidthAndHeight,
                    WindowStartupLocation = WindowStartupLocation.CenterScreen
                };
                win.ShowDialog();
                if (win.DialogResult.HasValue && win.DialogResult.Value)
                {
                    Bcfier.SelectedBcf().HasBeenSaved = false;
                }
            }
            catch (System.Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
            }
        }
        public HttpResponse AddPost(string name, string price)
        {
            var addView = new AddView();

            if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(price))
            {
                addView.ErrorString = "Invalid input!";

                return(new ViewResponse(HttpResponceCode.OK, addView));
            }

            var  priceInput = decimal.Parse(price);
            Cake cake       = null;

            if (!string.IsNullOrWhiteSpace(name) && priceInput >= 0)
            {
                cake = new Cake(name, priceInput);
                CakeList.AddCake(cake);
            }

            if (cake != null)
            {
                return(new ViewResponse(HttpResponceCode.OK, new AddView(cake)));
            }

            return(new ViewResponse(HttpResponceCode.OK, new AddView()));
        }
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.Settings      = db.Setting.OrderByDescending(s => s.Id).Take(1).ToList();
            model.ReserveTables = db.ReserveTable.OrderByDescending(r => r.Id).Take(1).ToList();
            return(View(model));
        }
Exemple #4
0
        // GET: Contact
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.departments = db.Department.OrderByDescending(m => m.Id).ToList();
            model.settings    = db.Settings.OrderByDescending(m => m.Id).ToList();
            return(View(model));
        }
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.News  = db.New.OrderByDescending(a => a.Id).Take(1).ToList();
            model.Users = db.User.OrderByDescending(s => s.Id).Take(1).ToList();
            return(View(model));
        }
Exemple #6
0
 public ActionResult Add(AddView addView)
 {
     if (ModelState.IsValid)
     {
         ((StudentService)(studentService)).Add(Mapper.Map <AddView, StudentInfo>(addView));
         return(RedirectToAction("Login"));
     }
     return(View(addView));
 }
Exemple #7
0
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.News     = db.New.OrderByDescending(n => n.Id).Take(5).ToList();
            model.Users    = db.User.OrderByDescending(n => n.Id).Take(5).ToList();
            model.Settings = db.Setting.OrderByDescending(n => n.Id).Take(5).ToList();

            return(View(model));
        }
        public new ActionResult Profile(int id)
        {
            AddView model = new AddView();

            model.departments  = db.Department.OrderByDescending(m => m.Id).ToList();
            model.settings     = db.Settings.OrderByDescending(m => m.Id).ToList();
            model.certificates = db.Certificates.OrderByDescending(m => m.Id).Where(m => m.DoctorId == id).ToList();
            model.id           = db.Doctors.FirstOrDefault(x => x.Id == id);
            return(View(model));
        }
        private void OnAddCommand(object obj)
        {
            AddView add = new AddView();

            add.Name = "Ajout";
            add.ShowDialog();

            ListeJoueur.Add(add.ViewModel.JoueurToAdd);
            NotifyPropertyChanged("ListeJoueur");
        }
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.Settings = db.Setting.OrderByDescending(s => s.Id).Take(1).ToList();
            model.Contacts = db.Contact.OrderByDescending(s => s.Id).Take(1).ToList();

            model.ContactForms = db.ContactForm.OrderByDescending(s => s.Id).Take(1).ToList();
            return(View(model));
        }
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.Menus    = db.Menu.OrderByDescending(m => m.Id).Take(6).ToList();
            model.MenuT1   = db.MenuT1.OrderByDescending(m => m.Id).Take(1).ToList();
            model.MenuT2   = db.MenuT2.OrderByDescending(m => m.Id).Take(1).ToList();
            model.Settings = db.Setting.OrderByDescending(m => m.Id).Take(1).ToList();
            return(View(model));
        }
 public AddViewModel(AddView ajouter)
 {
     Intervention       = " ";
     Nom                = " ";
     IntervenantCommand = new DelegateCommand(OnIntervenantAction, CanExecuteIntervenant);
     InternauteCommand  = new DelegateCommand(OnInternauteAction, CanExecuteInternaute);
     NormalCloseCommand = new DelegateCommand(OnNormalCloseAction, CanExecuteNormalClose);
     TestI              = true;
     NormalEnd          = false;
 }
Exemple #13
0
 public ActionResult Add(AddView addView)
 {
     if (ModelState.IsValid)
     {
         ((PostService)(postService)).Add(
             Mapper.Map <AddView, PostInfo>(addView));
         return(RedirectToAction("Index", "Post",
                                 Mapper.Map <AddView, PostInfo>(addView)));
     }
     return(View(addView));
 }
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.AboutInfos      = db.AboutInfo.OrderByDescending(a => a.Id).Take(1).ToList();
            model.Properties      = db.Property.OrderByDescending(s => s.Id).Take(3).ToList();
            model.Sliders         = db.Slider.OrderByDescending(s => s.Id).Take(1).ToList();
            model.Settings        = db.Setting.OrderByDescending(s => s.Id).Take(1).ToList();
            model.ReserveTableBgs = db.ReserveTableBg.OrderByDescending(s => s.Id).Take(1).ToList();
            return(View(model));
        }
Exemple #15
0
        public IActionResult Index()
        {
            AddView model = new AddView();

            model.Brands        = _context.Brands.OrderByDescending(m => m.Id).ToList();
            model.Transmissions = _context.Transmissions.ToList();
            model.Makes         = _context.Makes.ToList();
            model.Countries     = _context.Countries.ToList();
            model.Cities        = _context.Cities.ToList();
            model.FuelTypes     = _context.FuelTypes.ToList();
            model.Cars          = _context.Cars.ToList();
            return(View(model));
        }
Exemple #16
0
 /// <summary>
 /// Method to execute add song command, opens the add view for adding new song
 /// </summary>
 public void AddSongExecute()
 {
     try
     {
         AddView addView = new AddView(User);
         addView.ShowDialog();
         SongList = service.GetUsersSongs(User);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        // GET: Timetable
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.departments = db.Department.ToList();
            model.doctors     = db.Doctors.OrderByDescending(m => m.Id).ToList();
            model.timetables  = db.Timetables.OrderByDescending(m => m.Id).ToList();
            model.daytimes    = db.DayTimes.ToList();
            model.settings    = db.Settings.OrderByDescending(m => m.Id).ToList();
            model.days        = db.Days.ToList();
            model.aboutPhotos = db.AboutPhotoes.OrderByDescending(m => m.Id).Take(1).ToList();
            return(View(model));
        }
Exemple #18
0
        public void Add()
        {
            var addWindow = new AddView()
            {
                Owner = Application.Current.MainWindow
            };

            addWindow.ShowDialog();

            SelectedEntry = _addWindowViewModel.AddedEntry;

            RefreshEntriesList();
        }
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.aboutClinics = db.AboutClinics.OrderByDescending(m => m.Id).Take(4).ToList();
            model.departments  = db.Department.OrderByDescending(m => m.Id).ToList();
            model.doctors      = db.Doctors.OrderByDescending(m => m.Id).ToList();
            model.settings     = db.Settings.OrderByDescending(m => m.Id).ToList();
            model.appoinments  = db.Appoinments.ToList();
            model.counters     = db.Counters.OrderByDescending(m => m.Id).Take(4).ToList();
            model.aboutPhotos  = db.AboutPhotoes.OrderByDescending(m => m.Id).Take(1).ToList();
            return(View(model));
        }
Exemple #20
0
        public void Process(string command, string[] args)
        {
            //Create Add model
            Maze model = new Maze();

            model.SaveGame(args);

            BoardView _viewBoard = new BoardView();

            model.Persist();
            AddView view = new AddView();

            view.Render(model);
        }
Exemple #21
0
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.aboutClinics = db.AboutClinics.OrderByDescending(m => m.Id).Take(4).ToList();
            model.departments  = db.Department.OrderByDescending(m => m.Id).ToList();
            model.doctors      = db.Doctors.OrderByDescending(m => m.Id).ToList();
            model.settings     = db.Settings.OrderByDescending(m => m.Id).ToList();
            model.sliders      = db.Sliders.OrderByDescending(m => m.Id).ToList();
            model.openingHours = db.OpeningHours.OrderByDescending(m => m.Id).Take(3).ToList();
            model.testimonials = db.Testimonials.OrderByDescending(m => m.Id).ToList();
            model.appoinments  = db.Appoinments.ToList();
            model.aboutPhotos  = db.AboutPhotoes.OrderByDescending(m => m.Id).Take(1).ToList();
            return(View(model));
        }
Exemple #22
0
        private void OnAddCommand(object o)
        {
            ButtonPressedEvent.GetEvent().Handler += CloseAddView;

            _fenetreAjoutPerso      = new AddView();
            _fenetreAjoutPerso.Name = "Ajout";
            _fenetreAjoutPerso.ShowDialog(); //actif tant que la fenetre est ouverte.

            if (_fenetreAjoutPerso.ViewModel.IsSaisieValid)
            {
                ListePersonnages.Add(_fenetreAjoutPerso.ViewModel.Personnage);
                ListePersonnages      = TrierListe(ListePersonnages); // Supprimable ? (la liste qui n'est pas affichée n'a techniquement pas besoin d'être triée)
                ListePersonnageAffich = ListePersonnages;
            }
        }
Exemple #23
0
        private void OnAddCommand(object o)
        {
            AudioControl = MediaState.Stop;
            ButtonPressedEvent.GetEvent().Handler += CloseAddView;

            Add      = new AddView();
            Add.Name = "Ajout";

            Add.ShowDialog();

            if (Add.AddViewVM.ClickOnFin)
            {
                ListeVoiture.Add(Add.AddViewVM.NewVoiture);
            }
        }
Exemple #24
0
 private void OnAddCommand(object o)
 {
     try
     {
         AddView      ajouter = new AddView();
         AddViewModel modele  = new AddViewModel(ajouter);
         ajouter.DataContext = modele;
         ajouter.ShowDialog();
         if (!modele.NormalEnd)
         {
             return;
         }
         if (modele.Nom == " ")
         {
             throw (new ArgumentException("Vous n'avez pas rentrez de nom. Erreur: \n"));
         }
         if (!modele.TestI)
         {
             if (modele.Intervention == " ")
             {
                 throw (new ArgumentException("Vous n'avez pas rentrez d'intervention. Erreur: \n"));
             }
             List <Intervenant> tmp = Event.Intervenants;
             tmp.Add(new Intervenant(modele.Nom, modele.Intervention));
             Event.Intervenants = tmp;
             UpdateListeSpeaker();
         }
         else
         {
             List <Internaute> tmp = Event.Inscrits;
             tmp.Add(new Internaute(modele.Nom));
             Event.Inscrits = tmp;
             UpdateListeSpectator();
         }
         NotifyPropertyChanged("ListeSpectator");
         NotifyPropertyChanged("ListeSpeaker");
     }
     catch (Exception E)
     {
         ExceptionViewModel v = new ExceptionViewModel(E);
         ExceptionView      ExceptionWindow = new ExceptionView();
         ExceptionWindow.DataContext = v;
         ExceptionWindow.ShowDialog();
     }
 }
Exemple #25
0
        public ActionResult Index()
        {
            AddView model = new AddView();

            model.Welcomes        = db.Welcome.OrderByDescending(w => w.Id).Take(1).ToList();
            model.Services        = db.Service.OrderByDescending(s => s.Id).Take(3).ToList();
            model.MenuUpdates     = db.MenuUpdate.OrderByDescending(m => m.Id).Take(1).ToList();
            model.Menus           = db.Menu.OrderByDescending(m => m.Id).Take(6).ToList();
            model.Settings        = db.Setting.OrderByDescending(s => s.Id).Take(1).ToList();
            model.Properties      = db.Property.OrderByDescending(p => p.Id).Take(2).ToList();
            model.ReserveTableBgs = db.ReserveTableBg.OrderByDescending(r => r.Id).Take(1).ToList();
            model.ReserveTables   = db.ReserveTable.OrderByDescending(r => r.Id).Take(1).ToList();
            model.Abouts          = db.About.OrderByDescending(a => a.Id).Take(1).ToList();
            model.Teas            = db.Tea.OrderByDescending(t => t.Id).Take(1).ToList();
            model.News            = db.New.OrderByDescending(n => n.Id).Take(3).ToList();
            model.Users           = db.User.OrderByDescending(n => n.Id).Take(3).ToList();
            return(View(model));
        }
        void ReleaseDesignerOutlets()
        {
            if (AddView != null)
            {
                AddView.Dispose();
                AddView = null;
            }

            if (storeTableView != null)
            {
                storeTableView.Dispose();
                storeTableView = null;
            }

            if (sumUiTextField != null)
            {
                sumUiTextField.Dispose();
                sumUiTextField = null;
            }
        }
Exemple #27
0
 private void OnAddCommand(object obj)
 {
     if (u == null)
     {
         MessageBoxResult conf = MessageBox.Show("Veuillez vous authentifier avant de commencer", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         if (u.IsAdmin())
         {
             AddView add = new AddView();
             add.Name = "Ajout";
             add.ShowDialog();
             ListeJoueur.Add(add.ViewModel.JoueurToAdd);
             NotifyPropertyChanged("ListeJoueur");
         }
         else
         {
             MessageBoxResult conf = MessageBox.Show("Vous n'avez pas l'accès Administrateur", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
Exemple #28
0
        private void OnAddCommand(object o)
        {
            CommandChangedEvent.GetEvent().Handler += CloseAddWindows;

            _addView      = new AddView();
            _addView.Name = "Ajouter";
            _addView.ShowDialog();



            if (_addView.FilmViewModel.Valid == true)
            {
                ListFilm.Add(_addView.FilmViewModel.Film);
                ListFilm  = ListSort(ListFilm);
                ToDisplay = ListFilm;
                NotifyPropertyChanged("ToDisplay");
                System.Windows.Forms.MessageBox.Show("Ajout effectué.");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Ajout annulé.");
            }
        }
Exemple #29
0
 public void LaunchAddItem()
 {
     addmovieWindow = new AddView();
     CurrentMovie = new Movie();
     addmovieWindow.Show();
 }
Exemple #30
0
        public void addUsers()
        {
            AddView addview = new AddView();

            addview.ShowDialog();
        }
Exemple #31
0
        public MainViewModel()
        {
            Messenger.Default.Register <Customer>(this, "refresh", (customer) =>
            {
                selectedCustomer = customer;
                GetCustomer(selectedCustomer.CustomerID);
            });

            Messenger.Default.Register <Customer>(this, "clear controls", (customer) =>
            {
                ClearControls();
            });

            //Message receivers to accept messages from EditViewModel and AddViewModel
            //The sender also sends a token as the second parameter and only receivers with the same token will accept it.
            Messenger.Default.Register <Customer>(this, "add", (customer) =>
            {
                try
                {
                    // Code a query to retrieve the selected customer
                    // and store the Customer object in the class variable.
                    selectedCustomer = customer;
                    this.DisplayCustomer();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().ToString());
                }
            });

            //register for messenger from editView
            Messenger.Default.Register <Customer>(this, "edit", (customer) =>
            {
                try
                {
                    // Code a query to retrieve the selected customer
                    // and store the Customer object in the class variable.
                    selectedCustomer = customer;
                    this.DisplayCustomer();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().ToString());
                }
            });

            //open add window
            AddCommand = new RelayCommand(() =>
            {
                //call and display addview
                AddView addView = new AddView();
                addView.ShowDialog();
            });

            //open edit window and send customer info to edit view
            EditCommand = new RelayCommand(() =>
            {
                //call and display the edit view
                EditView editView = new EditView();
                //send message to edit view before window pops out
                Messenger.Default.Send(selectedCustomer, "CustomerToEdit");
                editView.ShowDialog();
            });

            //get the customer information with customer ID
            GetCommand = new RelayCommand(() =>
            {
                if (Validator.IsInt32(CustomerID) && Validator.IsPresent(CustomerID))
                {
                    int customerID = int.Parse(CustomerID);
                    GetCustomer(customerID);
                }
            });

            //close window command
            ExitCommand = new RelayCommand <Window>((window) =>
            {
                if (window != null)
                {
                    window.Close();
                }
            });

            //command to remove customer
            DeleteCommand = new RelayCommand(() =>
            {
                try
                {
                    // Mark the row for deletion.
                    // Update the database.
                    MMABooksEntity.mmaBooks.Customers.Remove(selectedCustomer);
                    //MMABooksEntity.mmaBooks.Entry(selectedCustomer).State = System.Data.EntityState.Detached;
                    MMABooksEntity.mmaBooks.SaveChanges();
                    Messenger.Default.Send(new NotificationMessage("Customer " + CustomerID + " Removed!"));

                    CustomerID = "";
                    this.ClearControls();
                }
                // Add concurrency error handling.
                // Place the catch block before the one for a generic exception.
                catch (DbUpdateConcurrencyException ex)
                {
                    ex.Entries.Single().Reload();
                    if (MMABooksEntity.mmaBooks.Entry(selectedCustomer).State == EntityState.Detached)
                    {
                        MessageBox.Show("Another user has deleted " + "that customer.", "Concurrency Error");
                        this.ClearControls();
                    }
                    else
                    {
                        MessageBox.Show("Another user has updated " + "that customer.", "Concurrency Error");
                        DisplayCustomer();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().ToString());
                }
            });
        }