internal void RemoveAgentFromRoute(Education_Matrice matriceSelected, string nameGrpAgentSelected) { Education_Matrice_GrLearner itemDb = db.Education_Matrice_GrLearner //.Include("Education_Matrice") .Where(x => x.MatriceGrLearner_Matrice == matriceSelected.Matrice_Id && x.Education_GroupLearner.GroupLearner_Actif == true && x.Education_GroupLearner.GroupLearner_Name == nameGrpAgentSelected) .FirstOrDefault(); itemDb.MatriceGrLearner_Actif = false; db.SaveChanges(); List <Education_GroupLearner_Agent> ListgrpLearner = db.Education_GroupLearner_Agent.Where(x => x.Education_GroupLearner.GroupLearner_Name == nameGrpAgentSelected && x.Education_GroupLearner.GroupLearner_Actif == true) .ToList(); foreach (var grpagent in ListgrpLearner) { Education_Matrice_Agent agentItemDb = db.Education_Matrice_Agent //.Include("Education_Matrice") .Where(x => x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceSelected.Matrice_Id && x.MatriceAgent_Agent == grpagent.Education_Agent.Agent_Id) .FirstOrDefault(); agentItemDb.MatriceAgent_Actif = false; db.SaveChanges(); } }
public List <Education_Matrice_Agent> LoadAllTrajetSingleAgent(Education_Matrice matriceSelected, long userIDSelected) { return(db.Education_Matrice_Agent .Include("Education_Matrice_Formation") .Where(x => x.Education_Agent.Agent_Matricule == userIDSelected && x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceSelected.Matrice_Id) .ToList()); }
public List <Education_Matrice_Agent> LoadAllTrajetAgent(Education_Matrice matriceAgent) { return(db.Education_Matrice_Agent .Include("Education_Agent") .Where(x => x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceAgent.Matrice_Id) .ToList()); }
public Education_Matrice SaveDetailsRoute(string nameMatrice, int recurrency, string newMatriceName) { try { var matriceDB = db.Education_Matrice.Where(x => x.Matrice_Description == nameMatrice).FirstOrDefault(); if (matriceDB != null) { if (nameMatrice != newMatriceName) { matriceDB.Matrice_Description = newMatriceName; } matriceDB.Matrice_Recurrency = recurrency; db.SaveChanges(); return(matriceDB); } else { Education_Matrice newRecord = new Education_Matrice() { Matrice_Description = newMatriceName, Matrice_Recurrency = recurrency }; db.Education_Matrice.Add(newRecord); db.SaveChanges(); return(matriceDB); } } catch (Exception ex) { return(null); } }
internal List <Education_GroupLearner> LoadGrpAgentOfMatriceSelectezd(Education_Matrice matriceSelected) { return(db.Education_GroupLearner //.Include("Education_Matrice") .Where(x => x.Education_Matrice_GrLearner.Any(c => c.MatriceGrLearner_Matrice == matriceSelected.Matrice_Id) && x.GroupLearner_Actif == true) .ToList()); }
public List <Education_Matrice_Agent> LoadAllAgentOfTheRoute(Education_Matrice matriceAgent) { return(db.Education_Matrice_Agent .Include("Education_Agent") .Where(x => x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceAgent.Matrice_Id) .Distinct() .ToList()); }
public List <Education_Matrice_GrLearner> LoadSingleTrajetGrpAgent(Education_Matrice matriceSelected, Education_GroupLearner agentGrpSelected) { return(db.Education_Matrice_GrLearner .Include("Education_Matrice") .Where(x => x.Education_GroupLearner.GroupLearner_Id == agentGrpSelected.GroupLearner_Id && x.MatriceGrLearner_Matrice == matriceSelected.Matrice_Id) .ToList()); }
internal void RemoveAgentFromRoute(Education_Matrice matriceSelected, long userIDSelected) { List <Education_Matrice_Agent> ListitemDb = db.Education_Matrice_Agent .Where(x => x.Education_Agent.Agent_Matricule == userIDSelected && x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceSelected.Matrice_Id) .ToList(); foreach (Education_Matrice_Agent itemDb in ListitemDb) { itemDb.MatriceAgent_Actif = false; db.SaveChanges(); } }
public List <Education_Agent> LoadAllAgentsExcepted(Education_Matrice matriceSelected) { db = new CFNEducation_FormationEntities(); List <Education_Agent> listAgentInGrp = db.Education_Agent .Where(w => w.Education_Matrice_Agent.Any(x => x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceSelected.Matrice_Id)) .ToList(); List <Education_Agent> listAgent = db.Education_Agent .ToList(); List <Education_Agent> listIntersect = listAgent.Except(listAgentInGrp).ToList(); return(listIntersect); }
public void RemoveFormationFromTrajet(string formationSAP, string routeName) { Education_Matrice Matrice = db.Education_Matrice .Where(x => x.Matrice_Description == routeName) .FirstOrDefault(); Education_Matrice_Formation MatriceFormation = db.Education_Matrice_Formation .Where(p => p.Education_Matrice.Matrice_Id == Matrice.Matrice_Id && p.Education_Formation.Formation_SAP == formationSAP) .FirstOrDefault();; db.Education_Matrice_Formation.Remove(MatriceFormation); db.SaveChanges(); }
public List <Education_GroupLearner> LoadAllGrpAgentsExcepted(Education_Matrice matriceSelected) { db = new CFNEducation_FormationEntities(); List <Education_GroupLearner> listAgentInGrp = db.Education_GroupLearner .Where(w => w.Education_Matrice_GrLearner.Any(x => x.MatriceGrLearner_Matrice == matriceSelected.Matrice_Id && x.MatriceGrLearner_Actif == true)) .ToList(); List <Education_GroupLearner> listAgent = db.Education_GroupLearner.Where(x => x.GroupLearner_Actif == true) .ToList(); List <Education_GroupLearner> listIntersect = listAgent.Except(listAgentInGrp).ToList(); return(listIntersect); }
public void AssignGrpAgentToRoute(Education_Matrice matriceSelected, Education_GroupLearner agentGrpSelected) { Education_GroupLearner GrpAgent = db.Education_GroupLearner .Where(y => y.GroupLearner_Id == agentGrpSelected.GroupLearner_Id).FirstOrDefault(); if (GrpAgent == null) { Education_Matrice_GrLearner newRecord = new Education_Matrice_GrLearner() { MatriceGrLearner_Matrice = matriceSelected.Matrice_Id, MatriceGrLearner_GroupeLearner = GrpAgent.GroupLearner_Id }; db.Education_Matrice_GrLearner.Add(newRecord); db.SaveChanges(); } }
public List <Education_Matrice_Formation> SaveMatriceFormation(Education_Matrice matriceF, int recurrency) { List <Education_Matrice_Formation> listMatriceFormation = db.Education_Matrice_Formation .Where(x => x.MatriceFormation_Matrice == matriceF.Matrice_Id) .ToList(); if (listMatriceFormation.Count > 0) { foreach (Education_Matrice_Formation matriceFormationItem in listMatriceFormation) { matriceFormationItem.MatriceFormation_Recurrency = recurrency; db.SaveChanges(); } } return(listMatriceFormation); }
public void RemoveAllMatriceForamtion(TreeNodeCollection nodes, string routeName) { Education_Matrice Matrice = db.Education_Matrice .Where(x => x.Matrice_Description == routeName) .FirstOrDefault(); foreach (TreeNode singleRecord in nodes) { Education_Matrice_Formation MatriceFormation = db.Education_Matrice_Formation .Where(p => p.Education_Matrice.Matrice_Id == Matrice.Matrice_Id && p.Education_Formation.Formation_SAP == singleRecord.Name) .FirstOrDefault();; db.Education_Matrice_Formation.Remove(MatriceFormation); db.SaveChanges(); } db.Education_Matrice.Remove(Matrice); db.SaveChanges(); }
public Education_Matrice AddNewMatrice(string nameMatrice, int recurrency) { Education_Matrice matrice = db.Education_Matrice .Where(x => x.Matrice_Description == nameMatrice) .FirstOrDefault(); if (matrice == null) { Education_Matrice newRecord = new Education_Matrice { Matrice_Recurrency = recurrency, Matrice_Description = nameMatrice }; db.Education_Matrice.Add(newRecord); db.SaveChanges(); return(newRecord); } else { return(null); } }
public void AssignAgentToRoute(Education_Matrice matriceSelected, Education_Agent agentSelected) { foreach (var matriceformation in matriceSelected.Education_Matrice_Formation) { Education_Matrice_Agent newRecord = new Education_Matrice_Agent() { MatriceAgent_MatriceFormation = matriceformation.MatriceFormation_Id, MatriceAgent_Agent = agentSelected.Agent_Id, MatriceAgent_Actif = true }; db.Education_Matrice_Agent.Add(newRecord); db.SaveChanges(); //var matriceFormation = db.Education_Matrice_Formation.Where(x => x.) Education_Agent_Formation newRecordAF = new Education_Agent_Formation() { AgentFormation_Agent = agentSelected.Agent_Id, AgentFormation_Formation = matriceformation.Education_Formation.Formation_Id }; db.Education_Agent_Formation.Add(newRecordAF); db.SaveChanges(); } }
public Education_Matrice_Agent LoadSingleTrajetAgent(Education_Matrice matriceAgent, Education_Agent agent) { return(db.Education_Matrice_Agent .Where(x => x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceAgent.Matrice_Id && x.MatriceAgent_Agent == agent.Agent_Id) .FirstOrDefault()); }
public Education_Matrice SaveMatrice(Education_Matrice newMatrice) { db.Education_Matrice.Add(newMatrice); db.SaveChanges(); return(newMatrice); }
public void LoadAllFormationAgent(Education_Matrice matriceSelected, long userIDSelected) { throw new NotImplementedException(); }