Beispiel #1
0
        public t_collaborator GetCollaborator(int idCollaborator)
        {
            t_collaborator collab = _context.t_collaborator
                                    .Include("superViser")
                                    .Include("t_answertestaffectation")
                                    .Include("t_answertestaffectation.t_feedback")
                                    .Include("superViser.t_collaborator")
                                    .Include("notifacations")
                                    .Include("notifacations.Relatedwarning")

                                    .Include("warnings")

                                    .Where <t_collaborator>(c => c.C_ID == idCollaborator)
                                    .FirstOrDefault();
            ICollection <t_performancenote> notes = collab.t_performancenote


                                                    .ToList();

            //obligatoire
            foreach (t_performancenote note in notes)
            {
                var e = note.rank;
            }

            return(collab);
        }
Beispiel #2
0
        public void  IncrementBadFeedbackCountForCollaborator(int idcollab)
        {
            t_collaborator c0 = _context.t_collaborator.Where(c1 => c1.C_ID == idcollab).FirstOrDefault();

            c0.t_performancenote.ElementAt(0).NbreBadFeedbacks = c0.t_performancenote.ElementAt(0).NbreBadFeedbacks + 1;
            _context.SaveChanges();
        }
Beispiel #3
0
        public int VerifyNbrBadFeedbacks(t_collaborator c, int maxPermitted)
        {
            List <t_performancenote> notes = new List <t_performancenote>();

            notes = c.t_performancenote.ToList();
            int retour = 0;
            var w      = maxPermitted;

            int j = notes.ElementAt(0).NbreBadFeedbacks;

            if (j < maxPermitted)
            {
                //il n'a pas encore atteint le maxpermitted
                retour = 1;
            }
            else if (j == maxPermitted)
            {
                retour = 2;
                //il  a exactement atteint le maxpermitted
            }
            else
            {
                retour = 3;

                //il a depassé le maxpermitted
            }


            return(retour);
        }
Beispiel #4
0
        public List <t_evaluationguestaffectation> GetAllAff(int idCollaborator)
        {
            List <t_evaluationguestaffectation> list = new List <t_evaluationguestaffectation>();
            t_collaborator c = _context.t_collaborator.Where <t_collaborator>(c0 => c0.C_ID == idCollaborator).FirstOrDefault();

            list = c.t_evaluationguestaffectation.ToList <t_evaluationguestaffectation>();
            return(list);
        }
Beispiel #5
0
        public string VerifyFeedback(int idCollaborator)
        {
            t_collaborator collab = GetCollaborator(idCollaborator);

            int res = VerifyNbrBadFeedbacks(collab, 2);

            string retour = "";

            //si entre ici ca veut dire son nombre de bad feedback <2
            //=> pas de warning
            if (res == 1)
            {
                retour = "pas de warning feedback ";
            }
            //il atteint la limite
            //=> warning fedback type normal
            else if (res == 2)
            {
                Warning warn = new Warning();
                warn.gravity      = Gravity.normal;
                warn.Reason       = "Feedback";
                warn.Content      = "you have reached the max permitted of bad feedbacks = 2";
                warn.is_Confirmed = 0;
                warn.manager      = collab.superViser;
                warn.collab       = collab;
                AddWarning(warn);

                retour = "warning feedback normal";
            }

            //il a dépassé  la limite
            //=> warning fedback type serious
            else
            {
                Warning warn = new Warning();
                warn.gravity      = Gravity.serious;
                warn.Reason       = "Feedback";
                warn.Content      = "you have depassed the max permitted of bad feedbacks = 2";
                warn.is_Confirmed = 0;
                warn.manager      = collab.superViser;
                warn.collab       = collab;
                AddWarning(warn);
                retour = "warning feedback serious";
            }
            return(retour);
        }
Beispiel #6
0
        public IEnumerable <t_evaluationtest> DisplayTests(t_collaborator collaborator, string type)
        {
            /*	t_collaborator collab = _context.t_collaborator
             *                                      .Include("t_evaluationtargetaffectation")
             *                                      .Include("t_evaluationtargetaffectation.t_evaluationtest")
             *                                      .Include("t_evaluationtargetaffectation.t_evaluationtest.t_criteria")
             *                                      .Include("t_evaluationtargetaffectation.t_evaluationtest.t_criteria.t_possibleresponse")
             *                                      .Where<t_collaborator>(c => c.C_ID == idcollaborator).FirstOrDefault();
             */
            //IEnumerable<t_evaluationguestaffectation> affecatations = collaborator.t_evaluationguestaffectation;

            IEnumerable <t_evaluationguestaffectation> affecatations = GetAllAff(collaborator.C_ID);
            List <t_evaluationtest> tests = new List <t_evaluationtest>();

            if (type.Equals("Auto"))
            {
                foreach (t_evaluationguestaffectation aff in affecatations)
                {
                    if (aff.t_evaluationtest.ET_Type.Equals("AutoEvaluation") && aff.isAnswered == false)
                    {
                        tests.Add(aff.t_evaluationtest);
                    }
                }
            }

            IEnumerable <t_evaluationguestaffectation> invitations = GetAllAff(collaborator.C_ID);

            if (type.Equals("360"))
            {
                foreach (t_evaluationguestaffectation aff in invitations)
                {
                    if (aff.t_evaluationtest.ET_Type.Equals("PersonalEvaluation") && aff.isAnswered == false)
                    {
                        tests.Add(aff.t_evaluationtest);
                    }
                }
            }

            return(tests);
        }
Beispiel #7
0
        public CollaboratorModel initCollaborator(t_collaborator c)
        {
            CollaboratorModel collab;


            collab = new DevelopperModel();

            ////////////////////superviser////////////////
            ManagerModel superviser = new ManagerModel();

            superviser.C_Forname  = c.superViser.t_collaborator.C_Forname;
            superviser.C_Lastname = c.superViser.t_collaborator.C_Lastname;
            collab.superviser     = superviser;
            /////////////////////////////////////////////////////


            collab.C_Age      = c.C_Age;
            collab.C_email    = c.C_email;
            collab.C_Forname  = c.C_Forname;
            collab.C_Lastname = c.C_Lastname;

            //performance notes //////////////////////
            PerformanceModel perf = new PerformanceModel();

            perf.gloabalAutoNote   = c.t_performancenote.ElementAt(0).gloabalAutoNote;
            perf.global360Note     = c.t_performancenote.ElementAt(0).global360Note;
            perf.globalPerformance = c.t_performancenote.ElementAt(0).globalPerformance;
            //rankkkkkkkkkkkkkkkk/////////////////
            perf.RankingAuto   = c.t_performancenote.ElementAt(0).rank.RankingAuto;
            perf.Ranking360    = c.t_performancenote.ElementAt(0).rank.Ranking360;
            perf.globalRanking = c.t_performancenote.ElementAt(0).rank.globalRanking;

            collab.performance = perf;
            //////////////////////////////////////////////////////


            return(collab);
        }
Beispiel #8
0
        public ActionResult Dashboard()
        {
            Getlogger();


            t_collaborator    co = _pi.GetCollaborator(logger.C_ID);
            CollaboratorModel model;

            if (logger.t_developper != null)
            {
                model = initCollaborator(co);
            }
            else
            {
                model = initCollaborator(co);
                //ajouter ici les features du manager
            }



            //var model = collab;
            return(View(model));
        }
Beispiel #9
0
 public void Getlogger()
 {
     logger = (t_collaborator)Session["logger"];
 }
Beispiel #10
0
        public ActionResult Tests360()
        {
            IEnumerable <t_evaluationtest> list = _sr.DisplayTests(logger, "360");

            RenderList = new List <TestToRender>();


            TestToRender     render;
            Question         question;
            PossibleResponse response;

            foreach (t_evaluationtest test in list)
            {
                render                  = new TestToRender();
                render.ID               = test.ET_ID;
                render.Type             = test.ET_Type;
                render.tType            = test.Et_tType;
                render.globaloNoteSoFar = test.globaloNoteSoFar;
                render.NbreQuestions    = test.t_criteria.Count();
                render.NbreParticipants = test.t_answertestaffectation.Count();

                render.questions = new List <Question>();

                //add target list of the test

                render.targetList = new List <CollaboratorModel>();
                CollaboratorModel colab;

                foreach (t_evaluationtargetaffectation aff in test.t_evaluationtargetaffectation)
                {
                    colab = new CollaboratorModel();
                    t_collaborator target = aff.t_collaborator;
                    colab.C_Lastname = target.C_Lastname;
                    colab.C_Forname  = target.C_Forname;
                    colab.C_ID       = target.C_ID;
                    render.targetList.Add(colab);
                }


                //add the questions
                foreach (t_criteria c in test.t_criteria)
                {
                    question             = new Question();
                    question.ID          = c.Cr_ID;
                    question.coefficient = c.Cr_coefficient;
                    question.Content     = c.Cr_Content;

                    question.PossibleResponses = new List <PossibleResponse>();

                    //add the responses of each question
                    foreach (t_possibleresponse rep in c.t_possibleresponse)
                    {
                        response         = new PossibleResponse();
                        response.ID      = rep.Pr_ID;
                        response.Content = rep.Pr_Content;
                        response.Score   = rep.Pr_score;

                        question.PossibleResponses.Add(response);
                    }


                    render.questions.Add(question);
                }
                RenderList.Add(render);
            }
            RenderTestList model = new RenderTestList();

            model.TestsList = RenderList;

            return(View(model));
        }
Beispiel #11
0
        //if this returns 1 => warning auto type serious ;
        //if this retuns 2 => warning auto	 type normal ;
        public int VerifyRankingAuto(int idcollab)
        {
            int            w      = 0;
            t_collaborator collab = GetCollaborator(idcollab);

            int allCollabsNumber = GetAllCollabsNumber();

            //Last 3 indexes
            List <int> LastThreeIndexes = new List <int>();

            for (int i = allCollabsNumber; i > allCollabsNumber - 3; i--)
            {
                LastThreeIndexes.Add(i);
            }

            // last 5 indexes
            List <int> LastFiveIndexes = new List <int>();

            for (int i = allCollabsNumber; i > allCollabsNumber - 5; i--)
            {
                LastFiveIndexes.Add(i);
            }



            //si parmi les 3 derniers warning grave


            foreach (int index in LastThreeIndexes)
            {
                if (collab.t_performancenote.ElementAt(0).rank.RankingAuto == index)
                {
                    //w = 1 warning grave
                    w = 1;
                    //creation du warning type grave
                    Warning warn = new Warning();
                    warn.gravity      = Gravity.serious;
                    warn.Reason       = "AutoNote";
                    warn.Content      = "your Auto Note is between the last 3";
                    warn.is_Confirmed = 0;
                    warn.manager      = collab.superViser;
                    warn.collab       = collab;
                    AddWarning(warn);
                }
            }
            //si parmi les 5 derniers => <warning normaal
            //on entre seulement si il n'est pas des 3 derniers
            if (w != 1)
            {
                foreach (int index in LastFiveIndexes)
                {
                    if (collab.t_performancenote.ElementAt(0).rank.RankingAuto == index)
                    {
                        //w = 2 warning normal
                        w = 2;
                        Warning warn = new Warning();
                        warn.gravity      = Gravity.normal;
                        warn.Reason       = "AutoNote";
                        warn.Content      = "your Auto Note is between the last 5";
                        warn.is_Confirmed = 0;
                        warn.manager      = collab.superViser;
                        warn.collab       = collab;
                        AddWarning(warn);
                    }
                }
            }

            var t = w;

            return(w);
        }