public List <Education_Matrice_GrLearner> GetMatriceOfGroupLearner(Education_GroupLearner grpLearner)
 {
     return(db.Education_Matrice_GrLearner
            .Include("Education_Matrice")
            .Where(x => x.MatriceGrLearner_GroupeLearner == grpLearner.GroupLearner_Id && x.Education_GroupLearner.GroupLearner_Actif == true)
            .ToList());
 }
 public List <Education_GroupLearner_Agent> LoadAgentOfSelectedGroup(Education_GroupLearner grpLearner)
 {
     return(db.Education_GroupLearner_Agent
            .Include("Education_Agent")
            .Where(w => w.GroupLearnerAgent_GroupeLearner == grpLearner.GroupLearner_Id && w.Education_GroupLearner.GroupLearner_Actif == true)
            .ToList());
 }
        internal void RemoveAgentFromGroup(Education_Agent agent, Education_GroupLearner selectedGrpLearner)
        {
            var agentGrp = db.Education_GroupLearner_Agent
                           //.Include("Education_Matrice")
                           .Where(x => x.GroupLearnerAgent_Agent == agent.Agent_Id &&
                                  x.GroupLearnerAgent_GroupeLearner == selectedGrpLearner.GroupLearner_Id)
                           .FirstOrDefault();

            db.Education_GroupLearner_Agent.Remove(agentGrp);
            db.SaveChanges();
        }
        public Education_GroupLearner AddGrpAgent(string grpName, string SAPName)
        {
            Education_GroupLearner grpAgent = new Education_GroupLearner()
            {
                GroupLearner_Name = grpName,
                GroupLearner_SAP  = SAPName
            };

            db.Education_GroupLearner.Add(grpAgent);
            db.SaveChanges();
            return(grpAgent);
        }
Example #5
0
        private void comboGrpAgents_SelectedIndexChanged(object sender, EventArgs e)
        {
            SelectedGrpLearner = (Education_GroupLearner)comboGrpAgents.SelectedItem;
            listAgentPaged     = grpLearnearAgentRepository.LoadAgentOfSelectedGroup(SelectedGrpLearner).ToPagedList(1, 50);

            List <Education_Agent> listAgentNotInTheGroupSelected = grpLearnearAgentRepository.GetAgentNotInTheSelectedGroup(SelectedGrpLearner);

            comboAgents.DataSource = listAgentNotInTheGroupSelected;

            dgGrpAgent.DataSource = GetDataSource(listAgentPaged);
            lblSelectedGrp.Text   = "List d'agent du groupe " + SelectedGrpLearner.GroupLearner_Name;
        }
        internal bool DeleteGroup(Education_GroupLearner selectedGrpLearner)
        {
            var grp = db.Education_GroupLearner
                      //.Include("Education_Matrice")
                      .Where(x => x.GroupLearner_Id == selectedGrpLearner.GroupLearner_Id)
                      .FirstOrDefault();

            grp.GroupLearner_Actif = false;

            db.SaveChanges();
            return(true);
        }
        public List <Education_Agent> GetAgentNotInTheSelectedGroup(Education_GroupLearner grpLearner)
        {
            List <Education_Agent> listAgentInGrp = db.Education_Agent
                                                    .Where(w => w.Education_GroupLearner_Agent.Any(x => x.GroupLearnerAgent_GroupeLearner == grpLearner.GroupLearner_Id) &&
                                                           w.Education_GroupLearner_Agent.Any(x => x.Education_GroupLearner.GroupLearner_Actif == true))
                                                    .ToList();

            List <Education_Agent> listAgent = db.Education_Agent
                                               .ToList();

            List <Education_Agent> 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_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 List <Education_Agent> LoadAgentsNotInTheGroupSelected(Education_GroupLearner selectedGrpLearner)
 {
     throw new NotImplementedException();
 }
        public Education_GroupLearner_Agent AddGrpLearnerAgent(Education_Agent agent, Education_GroupLearner grpLearner)
        {
            Education_GroupLearner_Agent grpAgent = new Education_GroupLearner_Agent()
            {
                GroupLearnerAgent_GroupeLearner = grpLearner.GroupLearner_Id,
                GroupLearnerAgent_Agent         = agent.Agent_Id
            };

            db.Education_GroupLearner_Agent.Add(grpAgent);
            db.SaveChanges();
            return(grpAgent);
        }
Example #12
0
 public MyColumnCollectionDGGrpAgent(Education_GroupLearner obj)
 {
     _obj = obj;
 }