public ActionResult DepartmentDetails(string id) { var data = LoadDepartmentDetails(id); var nameList = LoadUnits(); Dictionary <int, string> offices = new Dictionary <int, string>(); offices.Add(0, "Select"); foreach (var dep in nameList) { offices.Add(dep.OfficeKey, dep.OfficeName); } ViewData["namesList"] = offices; DepartementViewModel model = new DepartementViewModel { DepartmentKey = data[0].DepartmentKey, OfficeKey = data[0].OfficeKey, Name = data[0].Name, ResponsibleKey = data[0].ResponsibleKey, Description = data[0].Description, OfficeName = data[0].OfficeName }; ViewBag.Message = "EDIT"; return(PartialView("_CreateEditDepartmentView", model)); }
public static DepartementViewModel getDepartement(int idDepartement) { DepartementDAO pDAO = DepartementDAO.getDepartement(idDepartement); DepartementViewModel p = new DepartementViewModel(pDAO.idDepartementDAO, pDAO.nomDepartementDAO); return(p); }
public static DepartementViewModel getDepartement(int idDepartement) { DepartementDAO dDAO = DepartementDAO.getDepartements(idDepartement); DepartementViewModel e = new DepartementViewModel(dDAO.idDepartementDAO, dDAO.nomDepartementDAO); return(e); }
public CommuneViewModel(int idCommune, string nomCommune, string codePostal, DepartementViewModel departement) { this.idCommuneProperty = idCommune; this.nomCommuneProperty = nomCommune; this.codePostalProperty = codePostal; this.departementProperty = departement; }
public AfficherDepartements() { InitializeComponent(); lu = DepartementORM.listeDepartements(); listeDepartements.ItemsSource = lu; myDataObject = new DepartementViewModel(); }
public CommuneViewModel(int id, string nom, string CodePostale, DepartementViewModel Departement) { this.idCommune = id; this.nomCommuneProperty = nom; this.CodePostaleProperty = CodePostale; this.DepartementCommune = Departement; }
public DepartementViewModel GetDepartementViewModel() { var departementViewModel = new DepartementViewModel(); var departements = departementRepository.GetAllDepartments(); departementViewModel.Departements = departements; return(departementViewModel); }
private void supprimerButton_Click(object sender, EventArgs e) { DepartementViewModel toRemove = (DepartementViewModel)listeDepartements.SelectedItem; lu.Remove(toRemove); listeDepartements.Items.Refresh(); DepartementORM.supprimerDepartement(selectedDepartementId); }
public PlageViewModel(int id, string nom, CommuneViewModel commune, PrelevementViewModel prelevement, DepartementViewModel departement) { this.idPlage = id; this.nomProperty = nom; communeViewModel = commune; prelevementViewModel = prelevement; departementViewModel = departement; }
public static CommuneViewModel getCommune(int idCommune) { CommuneDAO pDAO = CommuneDAO.getCommune(idCommune); int idDepartement = pDAO.DepartementCommuneDAO; DepartementViewModel m = DepartementORM.getDepartement(idDepartement); CommuneViewModel p = new CommuneViewModel(pDAO.idCommuneDAO, pDAO.nomCommuneDAO, pDAO.CodePostaleDAO, m); return(p); }
public static CommuneViewModel getCommune(int idCommune) { CommuneDAO cDAO = CommuneDAO.getCommunes(idCommune); int idDepartement = cDAO.idDepartementDAO; DepartementViewModel m = DepartementORM.getDepartement(idDepartement); CommuneViewModel e = new CommuneViewModel(cDAO.idCommuneDAO, cDAO.nomCommuneDAO, m); return(e); }
private void ajouterButton(object sender, RoutedEventArgs e) { myDataObject.nomDepartementProperty = nomTextBox.Text; DepartementViewModel nouveau = new DepartementViewModel(DepartementDAL.getMaxIdDepartement() + 1, myDataObject.nomDepartementProperty); le.Add(nouveau); DepartementORM.insertDepartement(nouveau); listeDepartements.Items.Refresh(); }
private void supprimerButton_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { DepartementViewModel toRemove = (DepartementViewModel)listeDepartements.SelectedItem; lp3.Remove(toRemove); DepartementORM.supprimerDepartement(selectedDepartementsId); MessageBox.Show("Departement supprimé avec succes ! "); }
public static ObservableCollection <DepartementViewModel> listeDepartements() { ObservableCollection <DepartementDAO> lDAO = DepartementDAO.listeDepartements(); ObservableCollection <DepartementViewModel> l = new ObservableCollection <DepartementViewModel>(); foreach (DepartementDAO element in lDAO) { DepartementViewModel p = new DepartementViewModel(element.idDepartementDAO, element.nomDepartementDAO); l.Add(p); } return(l); }
public ActionResult Add(DepartementViewModel departementViewModel) { DepartmentManager departementManager = new DepartmentManager(); Department ParentDepartment = new Department(); Department newDepartement = new Department(); ParentDepartment = departementManager.Read(x => x.Id == departementViewModel.ParentDepartmentGUID).First(); newDepartement.Name = departementViewModel.Name; newDepartement.ParentDepartement = ParentDepartment; departementManager.Add(newDepartement); departementManager.saveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(DepartementViewModel departementViewModel) { if (ModelState.IsValid) { var departement = new Departement { Name = departementViewModel.DepartementName }; departementRepository.Add(departement); return(RedirectToAction("Index")); } departementViewModel.Departements = departementRepository.GetAllDepartments(); return(View(departementViewModel)); }
// GET: Category public ActionResult Index() { DepartmentManager departmentManager = new DepartmentManager(); DepartementViewModel departementViewModel = new DepartementViewModel { Departements = departmentManager.Read(null), PageId = "Department" }; departementViewModel.DepartmentJson = getWhileLoopJsonDepartment(false, new Guid()); departementViewModel.DepartmentString = string.Join(",", departmentManager.Read(null).Select(x => x.Id.ToString())); return(View(departementViewModel)); }
public static ObservableCollection <CommuneViewModel> ListeCommunes() { ObservableCollection <CommuneDAO> lDAO = CommuneDAO.listeCommunes(); ObservableCollection <CommuneViewModel> l = new ObservableCollection <CommuneViewModel>(); foreach (CommuneDAO element in lDAO) { int idDepartement = element.DepartementCommuneDAO; DepartementViewModel m = DepartementORM.getDepartement(idDepartement); CommuneViewModel p = new CommuneViewModel(element.idCommuneDAO, element.nomCommuneDAO, element.CodePostaleDAO, m); l.Add(p); } return(l); }
private void ajouterDepartement_Click(object sender, EventArgs e) { myDataObject.nomDepartementProperty = Nom.Text; string valueToParse = NumeroDepartement.Text; int result; int defaultValue = 0; myDataObject.numeroDepartementProperty = int.TryParse(valueToParse, out result) ? result : defaultValue; DepartementViewModel nouveau = new DepartementViewModel(DepartementDAL.getMaxIdDepartement() + 1, myDataObject.nomDepartementProperty, myDataObject.numeroDepartementProperty); lu.Add(nouveau); DepartementORM.insertDepartement(nouveau); listeDepartements.Items.Refresh(); }
//[ValidateAntiForgeryToken] public ActionResult Edit(Guid id) { DepartmentManager departementManager = new DepartmentManager(); DepartementViewModel departementViewModel = new DepartementViewModel() { Departements = departementManager.Read(null) }; departementViewModel.PageId = "Department"; departementViewModel.SelectedDepartment = departementManager.Read(id); departementViewModel.SelectedDepartmentParent = departementManager.GetParent(id); departementViewModel.DepartmentJson = getWhileLoopJsonDepartment(true, departementViewModel.SelectedDepartment.Id); departementViewModel.DepartmentString = departementViewModel.SelectedDepartmentParent.Id.ToString(); return(View(departementViewModel)); }
public static ObservableCollection <CommuneViewModel> listeCommunes() { ObservableCollection <CommuneDAO> lDAO = CommuneDAO.listeCommunes(); ObservableCollection <CommuneViewModel> l = new ObservableCollection <CommuneViewModel>(); foreach (CommuneDAO element in lDAO) { int idDepartement = element.idDepartementDAO; DepartementViewModel m = DepartementORM.getDepartement(idDepartement); // Plus propre que d'aller chercher le departement dans la DAO. CommuneViewModel e = new CommuneViewModel(element.idCommuneDAO, element.nomCommuneDAO, m); l.Add(e); } return(l); }
///////////////////////////////////// Departement ///////////////////////////////////// ///////////////////////////////////// Departement ///////////////////////////////////// private void ValideDepartement_Click(object sender, RoutedEventArgs e) { myDataObject3 = new DepartementViewModel(); myDataObject3.nomDepartementProperty = NomDepartement.Text; myDataObject3.CodePostalePropertie = CodePostaleDep.Text; DepartementViewModel nouveau = new DepartementViewModel(DepartementDAL.getMaxIdDepartement() + 1, myDataObject3.nomDepartementProperty, myDataObject3.CodePostalePropertie); lp3.Add(nouveau); DepartementORM.insertDepartement(nouveau); compteur = lp3.Count(); listeDepartements.ItemsSource = lp3; ((TextBox)NomDepartement).Text = string.Empty; MessageBox.Show("Département ajouté avec succes ! "); }
public ActionResult Edit(DepartementViewModel model) { if (ModelState.IsValid) { Responses responses = DepartementRepo.Update(model); if (responses.Success) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Error msg" }, JsonRequestBehavior.AllowGet)); } } return(Json(new { success = false, message = "Invalid" }, JsonRequestBehavior.AllowGet)); }
public MainViewModel() { HomeVm = new HomeViewModel(); CollegesVm = new CollegeViewModel(); DepartementVm = new DepartementViewModel(); EnseignantVm = new EnseignantViewModel(); EtudiantVm = new EtudiantViewModel(); MatiereVm = new MatiereViewModel(); NoteVm = new NoteViewModel(); SalleVm = new SalleViewModel(); CurrentView = HomeVm; HomeViewCommand = new RelayCommand(o => { CurrentView = HomeVm; }); CollegeViewCommand = new RelayCommand(o => { CurrentView = CollegesVm; }); DepartemnetViewCommand = new RelayCommand(o => { CurrentView = DepartementVm; }); EnseignantViewCommand = new RelayCommand(o => { CurrentView = EnseignantVm; }); EtudiantViewCommand = new RelayCommand(o => { CurrentView = EtudiantVm; }); MatiereViewCommand = new RelayCommand(o => { CurrentView = MatiereVm; }); NoteViewCommand = new RelayCommand(o => { CurrentView = NoteVm; }); SalleViewCommand = new RelayCommand(o => { CurrentView = SalleVm; }); }
// PUT api/<controller>/5 public Responses Put(int id, [FromBody] DepartementViewModel entity) { entity.Id = id; return(DepartementRepo.Update(entity)); }
// POST api/<controller> public Responses Post([FromBody] DepartementViewModel entity) { return(DepartementRepo.Update(entity)); }
public static void insertDepartement(DepartementViewModel p) { DepartementDAO.insertDepartement(new DepartementDAO(p.idDepartementProperty, p.nomDepartementProperty)); }
public static void updateDepartement(DepartementViewModel p) { DepartementDAO.updateDepartement(new DepartementDAO(p.idDepartementProperty, p.nomDepartementProperty, p.numeroDepartementProperty)); }
public ActionResult AddDepartment(DepartementViewModel model) { CreateDepartment(model.Name, model.ResponsibleKey, model.Description, model.OfficeKey, model.InsertBy); return(RedirectToAction("DepartmentView")); }
public ActionResult DepartmentDetails(DepartementViewModel model, string id) { EditDepartment(model.DepartmentKey, model.Name, model.ResponsibleKey, model.Description, model.OfficeKey, model.ModifyBy); return(RedirectToAction("DepartmentView")); }