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 FrmEquivalenceComment(Education_Matrice_Agent selectedMatriceAgent) { CurrentMatriceAgent = AgentMatriceRepository.LoadSingleTrajetFormation(selectedMatriceAgent.MatriceAgent_Id); InitializeComponent(); if (CurrentMatriceAgent.Education_Matrice_AgentEquivalence != null) { tbCommentEquivalence.Text = CurrentMatriceAgent.Education_Matrice_AgentEquivalence.MatriceAgentEquivalence_Comments; } LoadFormation(); SelectFormationEquiv(CurrentMatriceAgent); }
private void SelectFormationEquiv(Education_Matrice_Agent currentMatriceAgent) { int rowIndex = -1; if (currentMatriceAgent.Education_Matrice_AgentEquivalence != null) { Education_Formation formation = dbFormation.LoadSingleEducation_Formation(currentMatriceAgent.Education_Matrice_AgentEquivalence.MatriceAgentEquivalence_Formation); DataGridViewRow row = l_PopUp.Rows .Cast <DataGridViewRow>() .Where(r => r.Cells["Formation_SAP"].Value.ToString().Equals(formation.Formation_SAP)) .First(); rowIndex = row.Index; this.l_PopUp.Rows[rowIndex].Selected = true; this.l_PopUp.CurrentCell = this.l_PopUp.Rows[rowIndex].Cells[0]; } }
public Education_Matrice_Agent SaveEquivalence(Education_Matrice_Agent matriceAgent, Education_Matrice_AgentEquivalence equivalence) { Education_Matrice_Agent recordFromDb = db.Education_Matrice_Agent .Include("Education_Matrice_AgentEquivalence") .Where(x => x.MatriceAgent_Id == matriceAgent.MatriceAgent_Id) .FirstOrDefault(); if (recordFromDb.Education_Matrice_AgentEquivalence != null) { recordFromDb.Education_Matrice_AgentEquivalence.MatriceAgentEquivalence_Formation = equivalence.MatriceAgentEquivalence_Formation; recordFromDb.MatriceAgent_HasEquivalence = true; recordFromDb.MatriceAgent_Equivalence = equivalence.MatriceAgentEquivalence_Id; } else { recordFromDb.MatriceAgent_Equivalence = equivalence.MatriceAgentEquivalence_Id; } db.SaveChanges(); return(recordFromDb); }
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(); } }