public void Delete(StaffMember AssignedTreeView) { using (var context = new StaffMembersContext()) { var allManagerMember = from manager in context.staffMember where manager.Fonction == StaffFonction.Manager select manager; if (allManagerMember != null) { var allManagedMembers = from newId in context.staffMember where newId.ManagerID == AssignedTreeView.ID select newId; foreach (var allManagedMember in allManagedMembers) { allManagedMember.ManagerID = AssignedTreeView.ManagerID; } } else { var managedMembers = from newIdManager in context.staffMember where newIdManager.ManagerID == AssignedTreeView.ID select newIdManager; foreach (var managedMember in managedMembers) { managedMember.ManagerID = 0; } } context.staffMember.Remove(context.staffMember.Find(AssignedTreeView.ID)); context.SaveChanges(); } }
public List <StaffMember> FiltreManageMember(StaffMemberFront smcfm) { using (var contextStaffMemberManage = new StaffMembersContext()) { var manageMembers = from membersmanageList in contextStaffMemberManage.staffMember where membersmanageList.ManagerID == smcfm.ID select membersmanageList; return(manageMembers.ToList()); } }
public List <StaffMember> FiltreChiefManager() { using (var contextChiefManager = new StaffMembersContext()) { var chiefManagers = from managerList in contextChiefManager.staffMember where managerList.ManagerID == 0 select managerList; return(chiefManagers.ToList()); } }
public List <StaffMember> DisplayBddManager() { using (var context = new StaffMembersContext()) { var manager = from m in context.staffMember where m.Fonction == StaffFonction.Manager select m; return(manager.ToList()); } }
public async void AddStaffMemberBdd(StaffMember staffMember) { try { using (var context = new StaffMembersContext()) { await context.AddAsync(staffMember); var members = context.staffMember.ToList(); context.SaveChanges(); } } catch (Exception Ex) { MessageBox.Show(" Veuillez verifier les données saisies /br " + Ex.Message); } }
public void UpdateStaffMemberBDD(StaffMember AssignedTreeView) { using (var context = new StaffMembersContext()) { StaffMember sm = context.staffMember.Find(AssignedTreeView.ID); sm.Name = AssignedTreeView.Name; sm.SurName = AssignedTreeView.SurName; sm.Mail = AssignedTreeView.Mail; sm.Tel = AssignedTreeView.Tel; sm.Fonction = AssignedTreeView.Fonction; context.staffMember.Update(sm); context.SaveChanges(); } }