Пример #1
0
        public static Objectif CreateGroupe(Objectif objectif)
        {
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());

            String requete = @"Insert INTO objectif(Mesure,Description,Resultat,IdentifiantEntretien) Values (@Mesure,@Description,@Resultat,@IdentifiantEntretien); SELECT SCOPE_IDENTITY() ; ";

            SqlCommand commande = new SqlCommand(requete, connection);

            commande.Parameters.AddWithValue("Mesure",objectif.Mesure);
            commande.Parameters.AddWithValue("Description", objectif.Description);
            commande.Parameters.AddWithValue("Resultat", objectif.Resultat);
            commande.Parameters.AddWithValue("IdentifiantEntretien", objectif.IdentifiantEntretien);

              try
            {
                connection.Open();
                Decimal IDENTIFIANTDERNIERAJOUT = (Decimal)commande.ExecuteScalar();
                return ObjectifDB.Get(Int32.Parse(IDENTIFIANTDERNIERAJOUT.ToString()));

            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
                connection.Close();
            }
        }
Пример #2
0
        public void poster(Message msg)
        {
            if (msg.Performatif == PerformatifMessage.SignalHub && msg.Emetteur is AgentHub)
            {
                this.capterHub(msg.Emetteur as AgentHub);
            }
            else if (msg.Performatif == PerformatifMessage.DefinirObjectif)
            {
                Objectif o = (Objectif)msg.Contenu[1];

                this.Objectifs.Add(o.TypeObj, o);
                this.ConnaissancesObjectifs.Add(o.TypeObj, new Hashtable());

                this.World.poster(CatalogueMessages.GetMessageRealiserObjectif(o.TypeObj, this));
            }
            else if (msg.Performatif == PerformatifMessage.RealiserObjectif)
            {
                this.Objectifs[(TypeObjectif)msg.Contenu[0]].RealisationObjectif
                .handleOrLetTheNextDoIt(null, this);
            }
            else
            {
                lock (this._locker)
                {
                    if (this.ChaineComportement != null)
                    {
                        this.ChaineComportement.handleOrLetTheNextDoIt(msg, this);
                    }
                }
            }
        }
Пример #3
0
        public static Boolean delete(Objectif objectif)
        {
            Boolean isDelete = false;
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());

            String requete = @"DELETE FROM objectif WHERE Identifiant = @Identifiant ; ";

            SqlCommand commande = new SqlCommand(requete, connection);

            commande.Parameters.AddWithValue("Identifiant", objectif.Identifiant);

            try
            {
                connection.Open();
                commande.ExecuteNonQuery();
                isDelete = true;
            }

            catch (Exception)
            {
                isDelete = false;
            }

            finally
            {
                connection.Close();
            }

            return isDelete;
        }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        if (isActive)
        {
            attackTimer += Time.deltaTime;
            if (attackTimer > attackSpeed)
            {
                attackTimer = 0;
                if (iddleMinions.Count > robotDefend)
                {
                    List <Ennemy> units  = SelectForce(iddleMinions);
                    Objectif      create = CreateObjectif(units);
                    if (create != null)
                    {
                        DoObjectif(create);
                        objectifs.Add(create);
                    }
                }
            }

            checkTimer += Time.deltaTime;
            if (checkTimer > checkTime)
            {
                clearNull(minions);
                clearNull(iddleMinions);
                CheckRobotIddle();
                RefreshObjectif();
                checkTimer = 0;
            }
        }
    }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ObjectifId,Description,CurriculumId")] Objectif objectif)
        {
            if (id != objectif.ObjectifId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(objectif);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ObjectifExists(objectif.ObjectifId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", "Curriculums", new { id = objectif.CurriculumId }));
            }

            return(View(objectif));
        }
Пример #6
0
    public Objectif CreateObjectif(List <Ennemy> _assigned)
    {
        WorldObject target = null;

        // Get a target
        int randomTarget = Random.Range(0, 2);

        if (randomTarget == 0)
        {
            List <Citizen> targets = GameState.instance.GetCitizenBellow(agressionHauteur);
            if (targets.Count > 0)
            {
                target = targets[0];
            }
        }
        else
        {
            List <Building> targets = GameState.instance.GetBuildingBellow(agressionHauteur);
            if (targets.Count > 0)
            {
                target = targets[0];
            }
        }

        // Select force and create objectif !
        if (target != null)
        {
            if (_assigned.Count > 0)
            {
                Objectif retour = new Objectif(target, _assigned);
                return(retour);
            }
        }
        return(null);
    }
Пример #7
0
        // GET: Objectifs/Create
        public IActionResult Create(int id)
        {
            Objectif objectif = new Objectif();

            objectif.CurriculumId = id;
            return(View(objectif));
        }
Пример #8
0
    private string ObjToStr(Objectif obj)
    {
        switch (obj)
        {
        case Objectif.DESTROY:
            return("Destroy");

        case Objectif.INTERACT:
            return("Interact");

        case Objectif.KILL:
            return("Kill");

        case Objectif.POSITION:
            return("Position");

        case Objectif.SAVE:
            return("Save");

        case Objectif.TIME:
            return("Time");

        default:
            return("");
        }
    }
Пример #9
0
 public void DoObjectif(Objectif _obj)
 {
     foreach (Ennemy en in _obj.assigned)
     {
         en.state.orderedTask = new FightMTask(en, _obj.target);
         iddleMinions.Remove(en);
     }
 }
 public void InsertObjectif(Objectif Objectif)
 {
     if (Objectif != null)
     {
         Projet p = _dbContext.Projets.Where(A => A.Id == Objectif.ProjetId).FirstOrDefault();
         p.Objectifs.Add(Objectif);
         Save();
     }
 }
Пример #11
0
        void ExtraitObjectif(XElement element)
        {
            foreach (XElement childElement in element.Elements())
            {
                if (childElement.Name == "Objectif")
                {
                    Objectif p = new Objectif();

                    foreach (XElement xl in childElement.Elements())
                    {
                        switch (xl.Name.ToString())
                        {
                        case "ID":
                        { p.ID = int.Parse(xl.Value.ToString()); break; }

                        case "Libelle":
                        { p.Libelle = xl.Value.ToString(); break; }

                        case "Code":
                        { p.Code = xl.Value.ToString(); break; }

                        case "Description":
                        { p.Description = xl.Value.ToString(); break; }

                        case "Actif":
                        { p.Actif = bool.Parse(xl.Value.ToString()); break; }

                        case "TypeObjectif":
                        { p.TypeObjectif = (TypeObjectif)int.Parse(xl.Value.ToString()); break; }

                        case "Pilote":
                        { p.Pilote = Acces.Trouver_Utilisateur(int.Parse(xl.Value.ToString())); break; }

                        case "DateDebut":
                        { p.DateDebut = DateTime.Parse(xl.Value.ToString()); break; }

                        case "DateFin":
                        { p.DateFin = DateTime.Parse(xl.Value.ToString()); break; }

                        case "Meteo":
                        { p.Meteo = (Meteo)int.Parse(xl.Value.ToString()); break; }

                        case "TxAvancement":
                        { p.TxAvancement = (TxAvancement)int.Parse(xl.Value.ToString()); break; }

                        case "AnalyseQualitative":
                        { p.AnalyseQualitative = xl.Value.ToString(); break; }
                        }
                    }
                    if (!Acces.Existe_Element(Acces.type_OBJECTIF, "CODE", p.Code))
                    {
                        Acces.Ajouter_Element(Acces.type_OBJECTIF, p);
                    }
                }
            }
        }
Пример #12
0
        public IActionResult Post([FromBody] Objectif objectif)
        {
            string LoggedInuserId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            using (var scope = new TransactionScope())
            {
                _objectifRepository.InsertObjectif(objectif);
                scope.Complete();
                return(CreatedAtAction(nameof(Get), new { id = objectif.Id }, objectif));
            }
        }
Пример #13
0
        public async Task <IActionResult> Create([Bind("ObjectifId,Description,CurriculumId")] Objectif objectif)
        {
            if (ModelState.IsValid)
            {
                _context.Add(objectif);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Curriculums", new { id = objectif.CurriculumId }));
            }

            return(View(objectif));
        }
Пример #14
0
 public IActionResult Put([FromBody] Objectif Model)
 {
     if (Model != null)
     {
         using (var scope = new TransactionScope())
         {
             _objectifRepository.UpdateObjectif(Model);
             scope.Complete();
             return(new OkResult());
         }
     }
     return(new NoContentResult());
 }
Пример #15
0
        void Desactiver_Objectif()
        {
            if (lstObjectif.SelectedNode != null)
            {
                var Id = Int32.Parse(lstObjectif.SelectedNode.Name);
                Acces.Modifier_Element(Acces.type_OBJECTIF, Id, false);

                Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, Id);
                lstObjectif.SelectedNode.ForeColor = (obj.Actif) ? Color.Black : Color.Red;

                //AfficheListeObjectif();
            }
        }
Пример #16
0
    public Objectif GetNewObjectif(Objectif _previous)
    {
        List <Citizen> targets  = GameState.instance.citizens;
        Citizen        choice   = null;
        float          distance = float.MaxValue;

        foreach (Citizen target in targets)
        {
            Vector2Int direction = target.position - _previous.position;
            if (direction.magnitude < extraAgression)
            {
                if (direction.magnitude < distance)
                {
                    choice   = target;
                    distance = direction.magnitude;
                }
            }
        }
        if (choice != null)
        {
            Objectif retour = new Objectif(choice, _previous.assigned);
            return(retour);
        }
        else
        {
            List <Building> buildTargets = GameState.instance.buildingsOnMap;
            Building        buildChoice  = null;
            distance = float.MaxValue;
            foreach (Building target in buildTargets)
            {
                Vector2Int direction = target.position - _previous.position;
                if (direction.magnitude < extraAgression)
                {
                    if (direction.magnitude < distance)
                    {
                        buildChoice = target;
                        distance    = direction.magnitude;
                    }
                }
            }
            if (buildChoice != null)
            {
                Objectif retour = new Objectif(buildChoice, _previous.assigned);
                return(retour);
            }
            else
            {
                return(null);
            }
        }
    }
Пример #17
0
        /// <summary>
        /// Edition de la fiche pour un objectif
        /// </summary>
        public string Editer_Fiche_Objectif()
        {
            //Création de l'application Excel
            app = new Microsoft.Office.Interop.Excel.Application();
            app.DisplayAlerts = false;

            Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, id_element);

            var modele  = Chemin + "\\Modeles\\Fiche_OBJECTIF.xltx";
            var fichier = Chemin + "\\Fichiers\\" + "FO-" + obj.Code;

            app.Workbooks.Open(modele);

            Workbooks wk = app.Workbooks;
            Workbook  wb = app.ActiveWorkbook;
            Worksheet ws = wb.Sheets[1];
            Range     r;

            r       = ws.Cells[2, 2];
            r.Value = obj.Code;
            r       = ws.Cells[3, 2];
            r.Value = obj.Libelle;
            r       = ws.Cells[4, 2];
            if (obj.Pilote != null)
            {
                r.Value = obj.Pilote.Nom + " " + obj.Pilote.Prenom;
            }
            r       = ws.Cells[6, 2];
            r.Value = Conversion(obj.Description);

            //Sauvegarde du fichier
            wb.SaveAs(fichier + ".xlsx");
            wb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fichier + ".pdf");

            wb.Close(false);
            wk.Close();

            //Fermeture de l'application Excel
            app.Quit();
            app = null;

            if (OuvertureAuto)
            {
                OuvertureFichier(fichier + ".pdf");
            }

            return(fichier);
        }
Пример #18
0
        public void Modifier_Objectif()
        {
            if (obj == null)
            {
                return;
            }

            ctrlFicheObjectif f = new ctrlFicheObjectif();

            f.Acces    = Acces;
            f.Creation = false;
            f.Console  = Console;

            var Id = obj.ID;

            Objectif P = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, Id);

            f.objectif = P;
            n_obj++;
            f.Tag              = Acces.type_OBJECTIF.id + n_obj;
            f.EVT_Enregistrer += Handler_evt_Modifier;

            f.Initialiser();
            f.Dock = DockStyle.Fill;

            var D = new WeifenLuo.WinFormsUI.Docking.DockContent();

            D.TabText = "Objectif " + P.Code;

            f.Dock = DockStyle.Fill;
            D.Controls.Add(f);
            D.Tag = obj.Code;

            //Recherche si la fiche élément n'est pas ouverte
            foreach (DockContent d in DP.Documents)
            {
                if (d.Tag == D.Tag)
                {
                    d.Show(); return;
                }
            }
            D.Show(DP, DockState.Document);
        }
Пример #19
0
        void Ouvrir_Objectif(int ID)
        {
            Objectif objectif = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, ID);

            var D = new WeifenLuo.WinFormsUI.Docking.DockContent();

            D.TabText = "Objectif " + objectif.Code;

            var ctrl = new ctrlFicheObjectif();

            ctrl.Acces    = Acces;
            ctrl.objectif = objectif;
            ctrl.Initialiser();

            ctrl.Dock = DockStyle.Fill;
            D.Controls.Add(ctrl);

            D.Show(DP, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }
Пример #20
0
        public ActionResult AddTask(ObjectifViewModel objVm)
        {
            string type = objVm.Type;

            if (ModelState.IsValid)
            {
                ObjectifType objectifType = objCtx.GetObjectifTypeByName(type);
                objectifType.Items = new List <Item>();

                if (!objVm.Items.Contains(objVm.Tache))
                {
                    objectifType.Items.Add(new Item {
                        Name = objVm.Tache
                    });
                }

                var objectif = new Objectif
                {
                    Date        = objVm.Date,
                    NbPoint     = objVm.NbPoint,
                    ObjTypeId   = objectifType.Id,
                    Commentaire = objVm.Commentaire,
                    UserId      = userCtx.GetUserIdWhithName(User.Identity.Name),
                    Tache       = objVm.Tache
                };

                objCtx.AddObjectif(objectif);
                objVm.Objectifs   = objCtx.GetObjectifsByType(type);
                objVm.Commentaire = string.Empty;
                objVm.Date        = DateTime.Now;
                objVm.NbPoint     = 0;
            }
            else
            {
                objVm.Date    = DateTime.Now;
                objVm.isValid = false;
            }
            initViewModel(objVm, type);
            return(View("Objectif", objVm));
        }
Пример #21
0
        void Ajouter_SousObjectif()
        {
            string code = CodeRef;

            if (lstObjectif.SelectedNode is null)
            {
                MessageBox.Show("Vous devez choisir un objectif parent");
                return;
            }

            int      id  = int.Parse(lstObjectif.SelectedNode.Name);
            Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, id);

            code = obj.Code;

            ctrlFicheObjectif f = new ctrlFicheObjectif();

            f.Acces          = Acces;
            f.Creation       = true;
            f.objectif       = new Objectif();
            f.objectif.Code  = code;
            f.objectif.Actif = true;
            f.objectifParent = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, int.Parse(lstObjectif.SelectedNode.Name));;

            n_obj++;
            f.Tag              = Acces.type_OBJECTIF.code + n_obj;
            f.EVT_Enregistrer += Handler_evt_Modifier;

            f.Initialiser();

            var D = new WeifenLuo.WinFormsUI.Docking.DockContent();

            D.TabText = "Objectif (Nouveau)";

            f.Dock = DockStyle.Fill;
            D.Controls.Add(f);

            D.Show(DP, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }
Пример #22
0
        /// <summary>
        /// Repositionne les éléments selon la hiérarchie définie
        /// </summary>
        void Repositionner(Plan plan)
        {
            int nbObjectif = 0; int nbAction = 0; int nbOpération = 0; int nbIndicateur = 0;

            //Placement des objectifs/sous-objectifs
            listeLien = Acces.Remplir_ListeLien_Niv0(Acces.type_PLAN, plan.ID.ToString());
            listeLien.Sort();

            //On balaye la liste des éléments
            //On crée l'élément sous le parent
            foreach (var p in listeLien)
            {
                //Recherche du parent
                string   Parent    = Acces.Trouver_TableValeur(p.Element1_Type).Code + "-" + p.Element1_ID.ToString();
                TreeNode NodParent = NodG;

                if (!(Parent == NodG.Name))
                {
                    TreeNode[] NodP = NodG.Nodes.Find(Parent, true);
                    if (NodP.Length > 0)
                    {
                        NodParent = NodP[0];
                    }
                }

                string Enfant = Acces.Trouver_TableValeur(p.Element2_Type).Code + "-" + p.Element2_ID.ToString();
                if (!(Enfant is null))
                {
                    Boolean Ajoute = true;
                    //Création de l'élément enfant
                    TreeNode NodEnfant = new TreeNode()
                    {
                        Name = Enfant,
                        Tag  = p,
                    };

                    if (p.Element2_Type == Acces.type_OBJECTIF.ID)
                    //if (p.Element2_Type == Acces.Trouver_TableValeur_ID("TYPE_ELEMENT", p.Element1_Type.ToString()))
                    {
                        Objectif q = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text        = q.Libelle;
                            NodEnfant.Name        = Acces.type_OBJECTIF.Code + "-" + q.ID;
                            NodEnfant.ImageIndex  = Donner_ImageIndex(Acces.type_OBJECTIF, p.Element2_ID);
                            NodEnfant.ToolTipText = q.Code;
                            nbObjectif++;
                        }
                        else
                        {
                            Console.Ajouter("[Objectif non trouvé] ID:" + p.Element2_ID + " Code :" + p.Element2_Code);
                        }
                    }

                    if (p.Element2_Type == Acces.type_ACTION.ID)
                    {
                        PATIO.CAPA.Classes.Action q = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text       = q.Libelle;
                            NodEnfant.Name       = Acces.type_ACTION.Code + "-" + q.ID;
                            NodEnfant.ImageIndex = Donner_ImageIndex(Acces.type_ACTION, p.Element2_ID);
                            if (q.ActionPhare)
                            {
                                NodEnfant.ImageIndex = imgs[PosImageActionPhare].Id;
                            }
                            NodEnfant.ToolTipText = q.Code + " [" + p.ordre + "]";
                            if (q.TypeAction == TypeAction.ACTION)
                            {
                                nbAction++;
                            }
                            if (q.TypeAction == TypeAction.OPERATION)
                            {
                                nbOpération++;
                            }
                        }
                        else
                        {
                            Console.Ajouter("[Action non trouvée] ID:" + p.Element2_ID + " CODE:" + p.Element2_Code);
                        }
                    }

                    if (p.Element2_Type == Acces.type_INDICATEUR.ID)
                    {
                        Indicateur q = (Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text        = q.Libelle;
                            NodEnfant.Name        = Acces.type_INDICATEUR.Code + "-" + q.ID;
                            NodEnfant.ImageIndex  = Donner_ImageIndex(Acces.type_INDICATEUR, p.Element2_ID);
                            NodEnfant.ToolTipText = q.Code;
                            nbIndicateur++;
                        }
                        else
                        {
                            Console.Ajouter("[Indicateur non trouvée] ID:" + p.Element2_ID + " CODE:" + p.Element2_Code);
                        }
                    }
Пример #23
0
        public static Boolean update(Objectif objectif)
        {
            Boolean isUpDAte = false ;
            //mettre a jour la base de donnée
            // retourne un boulean si l'update ses bien dérouler

            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());

            String requete = @"Update objectif set Mesure = @Mesure,Description = @Description,Resultat = @Resultat, IdentifiantEntretien = @IdentifiantEntretien where identifiant = @identifiant  ;";

            SqlCommand commande = new SqlCommand(requete, connection);

            commande.Parameters.AddWithValue("Mesure", objectif.Mesure);
            commande.Parameters.AddWithValue("Description", objectif.Description);
            commande.Parameters.AddWithValue("Resultat", objectif.Resultat);
            commande.Parameters.AddWithValue("IdentifiantEntretien", objectif.IdentifiantEntretien);
            commande.Parameters.AddWithValue("identifiant", objectif.Identifiant);

            try
            {
                connection.Open();
                commande.ExecuteNonQuery();
                isUpDAte = true;
            }

            catch (Exception)
            {
                isUpDAte = false;
            }

            finally
            {
                connection.Close();
            }

            return isUpDAte;
        }
Пример #24
0
        /// <summary>
        /// Récupère une liste de Objectif à partir de la base de données
        /// </summary>
        /// <returns>Une liste de client</returns>
        public static List<Objectif> List()
        {
            //Récupération de la chaine de connexion
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = "SELECT IdentifiantEntretien, Mesure, Description, Resultat,IdentifiantEntretien FROM Objectif ;";
            connection.Open();
            SqlCommand commande = new SqlCommand(requete, connection);
            //execution

            SqlDataReader dataReader = commande.ExecuteReader();

            List<Objectif> list = new List<Objectif>();
            while (dataReader.Read())
            {

                //1 - Créer un Objectif à partir des donner de la ligne du dataReader
                Objectif objectif = new Objectif();
                objectif.IdentifiantEntretien = dataReader.GetInt32(0);
                objectif.Mesure = dataReader.GetString(1);
                objectif.Description = dataReader.GetString(2);
                objectif.Resultat = dataReader.GetString(3);
                objectif.IdentifiantEntretien = dataReader.GetInt32(4);

                //2 - Ajouter ce Objectif à la list de client
                list.Add(objectif);
            }
            dataReader.Close();
            connection.Close();
            return list;
        }
 public void UpdateObjectif(Objectif Objectif)
 {
     _dbContext.Entry(Objectif).State = EntityState.Modified;
     Save();
 }
 protected override Task HandleRequirementAsync(AuthorizationHandlerContext context,
                                                SameUserRequirement requirement,
                                                object resource)
 {
     if (resource.GetType() == typeof(Projet))
     {
         Projet model  = (Projet)resource;
         Projet Projet = _projetRepository.GetProjetByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Document))
     {
         Document d        = (Document)resource;
         Document document = _documentRepository.GetDocumentByID(d.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == document.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Phase))
     {
         Phase model = (Phase)resource;
         Phase Phase = _phaseRepository.GetPhaseByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Phase.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Models.Action))
     {
         Models.Action model  = (Models.Action)resource;
         Models.Action Action = _actionRepository.GetActionByID(model.Id);
         if (Action.ProjetId != null)
         {
             if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Action.Projet.UserId)
             {
                 context.Succeed(requirement);
             }
         }
         else
         {
             if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Action.Phase.Projet.UserId)
             {
                 context.Succeed(requirement);
             }
         }
     }
     else if (resource.GetType() == typeof(Tache))
     {
         Tache model = (Tache)resource;
         Tache Tache = _tacheRepository.GetTacheByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Tache.Action.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Reunion))
     {
         Reunion model   = (Reunion)resource;
         Reunion Reunion = _reunionRepository.GetReunionByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Reunion.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Objectif))
     {
         Objectif model    = (Objectif)resource;
         Objectif Objectif = _objectifRepository.GetObjectifByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Objectif.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Risque))
     {
         Risque model  = (Risque)resource;
         Risque Risque = _risqueRepository.GetRisqueByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Risque.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Opportunite))
     {
         Opportunite model       = (Opportunite)resource;
         Opportunite Opportunite = _opportuniteRepository.GetOpportuniteByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Opportunite.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Indicateur))
     {
         Indicateur model      = (Indicateur)resource;
         Indicateur Indicateur = _indicateurRepository.GetIndicateurByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Indicateur.Objectif.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Mesure))
     {
         Mesure model  = (Mesure)resource;
         Mesure Mesure = _mesureRepository.GetMesureByID(model.Id);
         if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Mesure.Indicateur.Objectif.Projet.UserId)
         {
             context.Succeed(requirement);
         }
     }
     else if (resource.GetType() == typeof(Evaluation))
     {
         Evaluation model      = (Evaluation)resource;
         Evaluation Evaluation = _evaluationRepository.GetEvaluationByID(model.Id);
         if (Evaluation.OpportuniteId != null)
         {
             if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Evaluation.Opportunite.Projet.UserId)
             {
                 context.Succeed(requirement);
             }
         }
         else
         {
             if (new Guid(context.User.FindFirstValue(ClaimTypes.NameIdentifier)) == Evaluation.Risque.Projet.UserId)
             {
                 context.Succeed(requirement);
             }
         }
     }
     return(Task.CompletedTask);
 }
Пример #27
0
        public void UpdateListAffichage()
        {
            // Update Robots
            listAffichageArduino.Items.Clear();
            //foreach (ArduinoBotIA Robot in _Follower.ListArduino)
            for (int i = 0; i < _Follower.ListArduino.Count; i++)
            {
                ArduinoBotIA Robot = _Follower.ListArduino[i];

                if (_ArduinoManager != null)
                {
                    ArduinoBotComm RobotComm = _ArduinoManager.getArduinoBotById(Robot.ID);
                    ListViewItem   master    = new ListViewItem(Robot.ID + "");
                    if (RobotComm != null)
                    {
                        master.SubItems.Add(RobotComm.Connected + "");
                        master.SubItems.Add(RobotComm.stateComm + "");
                    }
                    else
                    {
                        master.SubItems.Add("N/A");
                        master.SubItems.Add("N/A");
                    }


                    master.SubItems.Add(Robot.LastAction + "");
                    master.SubItems.Add(Robot.Position.X + "");
                    master.SubItems.Add(Robot.Position.Y + "");
                    master.SubItems.Add(Robot.Angle + "");

                    listAffichageArduino.Items.Add(master);
                }
            }
            // Update Cubes
            listAffichageCubes.Items.Clear();

            for (int i = 0; i < _Follower.TrackMaker.Cubes.Count; i++)
            {
                Objectif cube = _Follower.TrackMaker.Cubes[i];

                ListViewItem master = new ListViewItem(cube.id + "");
                master.SubItems.Add(cube.idZone + "");
                master.SubItems.Add(cube.Done + "");
                if (cube.Robot != null)
                {
                    master.SubItems.Add(cube.Robot.ID + "");
                }
                else
                {
                    master.SubItems.Add("N/A");
                }
                master.SubItems.Add(cube.position.X + "");
                master.SubItems.Add(cube.position.Y + "");

                listAffichageCubes.Items.Add(master);
            }

            // Update Zones
            listAffichageZones.Items.Clear();
            for (int i = 0; i < _Follower.TrackMaker.ZonesDepose.Count; i++)
            {
                Zone         zone   = _Follower.TrackMaker.ZonesDepose[i];
                ListViewItem master = new ListViewItem(zone.id + "");
                master.SubItems.Add("A : " + zone.position.A.ToString() + " B : " + zone.position.B.ToString() + " C : " + zone.position.C.ToString() + " D : " + zone.position.D.ToString());
                master.SubItems.Add(UtilsMath.CentreRectangle(zone.position).ToString());

                listAffichageZones.Items.Add(master);
            }
        }
Пример #28
0
        public void UpdateImageDebug()
        {
            if (_Follower.TrackMaker != null && _Follower.TrackMaker.ZoneTravail.B.X != 0)
            {
                List <PolyligneDessin> ListePoly = new List <PolyligneDessin>(); // Liste envoyé a l'image

                Bitmap bitmap = new Bitmap(_Follower.TrackMaker.ZoneTravail.B.X, _Follower.TrackMaker.ZoneTravail.B.Y);
                //dessinerTrack(bitmap, tr);

                // Dessiner Cubes
                // foreach (Objectif obstacle in _Follower.TrackMaker.Cubes)
                for (int i = 0; i < _Follower.TrackMaker.Cubes.Count; i++)
                {
                    Objectif        obstacle = _Follower.TrackMaker.Cubes[i];
                    PolyligneDessin p        = new PolyligneDessin(Color.LimeGreen);
                    for (int x = obstacle.position.X - 5; x <= obstacle.position.X + 5; x++)
                    {
                        for (int y = obstacle.position.Y - 5; y <= obstacle.position.Y + 5; y++)
                        {
                            p.addPoint(new PointDessin(x, y));
                        }
                    }
                    ListePoly.Add(p);
                    dessinerPoint(bitmap, obstacle.position, Brushes.Gray);
                }

                foreach (QuadrillageCoord q in _Follower.TrackMaker.CreerAstarQuadriallage().CalculerQuadrillage())
                {
                    PolyligneDessin p = new PolyligneDessin(Color.Gray);
                    p.addPoint(new PointDessin(q.A.X, q.A.Y));
                    p.addPoint(new PointDessin(q.B.X, q.B.Y));
                    ListePoly.Add(p);

                    dessinerLigne(bitmap, q.A, q.B, Color.Gray, 1);
                }

                for (int i = 0; i < _Follower.TrackMaker.ZonesDepose.Count; i++)
                {
                    Zone            z   = _Follower.TrackMaker.ZonesDepose[i];
                    PositionElement pos = UtilsMath.CentreRectangle(z.position);
                    PolyligneDessin p   = new PolyligneDessin(Color.Pink);
                    for (int x = pos.X - 5; x <= pos.X + 5; x++)
                    {
                        for (int y = pos.Y - 5; y <= pos.Y + 5; y++)
                        {
                            p.addPoint(new PointDessin(x, y));
                        }
                    }
                    ListePoly.Add(p);

                    dessinerPoint(bitmap, pos, Brushes.Pink);
                }


                for (int ab = 0; ab < _Follower.ListArduino.Count; ab++)
                //foreach (ArduinoBotIA robot in _Follower.ListArduino)
                {
                    ArduinoBotIA robot = _Follower.ListArduino[ab];

                    PolyligneDessin p = new PolyligneDessin(Color.Purple);

                    PositionElement pos = robot.Position;

                    for (int x = pos.X - 5; x <= pos.X + 5; x++)
                    {
                        for (int y = pos.Y - 5; y <= pos.Y + 5; y++)
                        {
                            p.addPoint(new PointDessin(x, y));
                        }
                    }
                    ListePoly.Add(p);

                    dessinerPoint(bitmap, pos, Brushes.Turquoise);
                    if (robot.Trace != null)
                    {
                        dessinerTrack(bitmap, robot.Trace, _Follower.TrackMaker.CreerAstarQuadriallage());
                        PolyligneDessin p2 = new PolyligneDessin(Color.Red);
                        for (int i = 0; i < robot.Trace.Positions.Count; i++)
                        {
                            p.addPoint(new PointDessin(robot.Trace.Positions[i].X, robot.Trace.Positions[i].Y));
                        }
                        ListePoly.Add(p2);
                    }
                }


                imageDebug.Image = bitmap;

                if (DrawPolylineEvent != null)
                {
                    DrawPolylineEventArgs args = new DrawPolylineEventArgs(ListePoly);
                    DrawPolylineEvent(this, args);
                }
            }
        }
Пример #29
0
        private void lstObjectif_AfterSelect(object sender, TreeViewEventArgs e)
        {
            int id = int.Parse(lstObjectif.SelectedNode.Name);

            obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, id);
        }
Пример #30
0
    public Objectif CreateObjectif(List <Ennemy> _assigned, WorldObject _target)
    {
        Objectif retour = new Objectif(_target, _assigned);

        return(retour);
    }
Пример #31
0
    /// <summary>
    ///
    /// </summary>
    public void Lancer()
    {
        mFenetre.MouseButtonReleased += new EventHandler <MouseButtonEventArgs>(GestionJeu);

        objectifs = new String[3];
        Random rand = new Random();
        int    rnd;
        int    i = 0;

        do
        {
            rnd = rand.Next(3);
            if (!objectifs.Contains(liste_objectifs[rnd]))
            {
                objectifs[i] = liste_objectifs[rnd];
                i++;
            }
        } while (i < 3);
        RessourceAudio.Instance.MusiqueMenu.Stop();
        RessourceAudio.Instance.MusiqueJeu.Play();

        while (mContinuer)
        {
            mFenetre.DispatchEvents();

            if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
            {
                mContinuer = false;
                break;
            }
            if (Mouse.IsButtonPressed(Mouse.Button.Left) && mSourisActivee)
            {
                StartTimer();
            }

            switch (mEtape)
            {
            case Etape.ACTIVER_BONUS:
                mPopUpBonus.ActiverEcouteurs();

                if (mPopUpBonus.Reponse == "OUI")
                {
                    mEtape = Etape.CHOISIR_BONUS;
                    mPopUpBonus.Reponse = "NDEF";     // reset Reponse PopUp
                }
                else if (mPopUpBonus.Reponse == "NON")
                {
                    if (mMaisonPlacees == true)
                    {
                        mEtape = Etape.PIOCHER;
                    }
                    else
                    {
                        mEtape = Etape.PLACER_MAISON;
                    }

                    mPopUpBonus.Reponse = "NDEF";     // reset Reponse PopUp
                }

                break;

            case Etape.CHOISIR_BONUS:
                mScroll.ActiverEcouteurs();
                mPopUpBonus.DesactiverEcouteurs();
                break;

            case Etape.PIOCHER:
                mJoueurCourant.CarteTerrain = mJoueurCourant.Piocher();
                mEtape = Etape.FIN_TOUR;
                break;

            case Etape.FIN_TOUR:
                mMaisonPlacees = false;
                compteurBonus  = 0;
                SupprimerListeBonus();
                mJoueurCourant.RecupererBonus(mPlateau);
                ChangerJoueur();
                bonusDejaUtilise = false;

                if (mJoueurCourant.m_listeBonus.Count == 0)
                {
                    mEtape = Etape.PLACER_MAISON;
                }
                else
                {
                    mEtape = Etape.ACTIVER_BONUS;
                    RemplirListeBonus();
                }
                break;

            case Etape.FIN_PARTIE:
                foreach (JoueurHumain j in mJoueurs)
                {
                    int score = j.m_maisonsPlacees.Count;

                    foreach (String nomObjectif in objectifs)
                    {
                        if (nomObjectif == "Explorateur")
                        {
                            score += Objectif.Explorateur(mPlateau, j.Couleur);
                        }
                        if (nomObjectif == "Ouvrier")
                        {
                            foreach (KeyValuePair <Coordonnee, Terrain> c in mCaseSpeciales)
                            {
                                Tuple <Coordonnee, Terrain> c2 = new Tuple <Coordonnee, Terrain>(c.Key, c.Value);
                                score += Objectif.Ouvrier(mPlateau, c2, j.Couleur);
                            }
                        }
                        if (nomObjectif == "Chevalier")
                        {
                            score += Objectif.Chevalier(mPlateau, j.Couleur);
                        }
                        if (nomObjectif == "Mineur")
                        {
                            score += Objectif.Mineur(mPlateau, j.m_maisonsPlacees);
                        }
                        if (nomObjectif == "Pecheur")
                        {
                            score += Objectif.Pecheur(mPlateau, j.m_maisonsPlacees);
                        }
                    }

                    j.Score = (Int16)score;
                }
                mContinuer = false;
                break;

            default:
                mScroll.DesactiverEcouteurs();
                break;
            }
            m_boiteInfo.ModifierTextes(mJoueurCourant.Couleur, mJoueurCourant.CarteTerrain, mJoueurCourant.NbMaisons);
            mCamera.MiseAJour();
            m_boiteInfo.PositionnerBoite(mCamera);
            Dessiner();
        }
        RessourceAudio.Instance.MusiqueJeu.Stop();
        Ins.Fenetre.SetView(Ins.Fenetre.DefaultView);
    }
Пример #32
0
        /// <summary>
        /// Récupère une Objectif à partir d'un identifiant de client
        /// </summary>
        /// <param name="Identifiant">Identifant de Objectif</param>
        /// <returns>Un Objectif </returns>
        public static Objectif Get(Int32 identifiant)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"SELECT  Identifiant,Mesure,Description, Resultat,IdentifiantEntretien FROM Objectif
                                WHERE Identifiant = @Identifiant ; ";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Identifiant", identifiant);

            //Execution
            connection.Open();
            SqlDataReader dataReader = commande.ExecuteReader();

            dataReader.Read();

            //1 - Création du Objectif
            Objectif objectif = new Objectif();

            objectif.Identifiant = dataReader.GetInt32(0);
            objectif.Mesure = dataReader.GetString(1);
            objectif.Description = dataReader.GetString(2);
            objectif.Resultat = dataReader.GetString(3);
            objectif.IdentifiantEntretien = dataReader.GetInt32(4);
            dataReader.Close();
            connection.Close();
            return objectif;
        }
Пример #33
0
        public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, Objectif obj)
        {
            objCtx.UpdateObjectifs(obj);

            return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
        }
Пример #34
0
        public void Editer_Fiche_Direction()
        {
            if (lstDirection.SelectedIndex < 0)
            {
                return;
            }

            //Extrait les informations de l'arborescence
            List <Element> Liste = new List <Element>();

            foreach (TreeNode nd in tree.Nodes)
            {
                if (nd.Checked)
                {
                    Extrait_Info(nd, ref Liste);
                }
            }

            //Création de l'application Excel
            app = new Microsoft.Office.Interop.Excel.Application();
            app.DisplayAlerts = false;

            var modele  = Chemin + "\\Modeles\\Fiche_PLAN_DIRECTION.xltx";
            var fichier = Chemin + "\\Fichiers\\" + "FD-" + ListeDirection[lstDirection.SelectedIndex].Code + "-" + string.Format("{0:yyMMddHHmmss}", DateTime.Now);

            app.Workbooks.Open(modele);

            Workbooks wk = app.Workbooks;
            Workbook  wb = app.ActiveWorkbook;
            Worksheet ws = wb.Sheets[1];
            Range     r;

            r       = ws.Cells[2, 5];
            r.Value = lstDirection.Text;
            r       = ws.Cells[3, 5];
            r.Value = string.Format("{0:dd/MM/yyyy}", DateTime.Now); //Groupe interne

            //Affichage des éléments
            int n_ligne = 7;

            //Efface la zone
            ws.Range["A8:Y10000"].Clear();

            //Traitement de la liste des éléments extraits
            foreach (Element e in Liste)
            {
                if (e.Element_Type == Acces.type_PLAN.id)
                {
                    Plan plan1 = (Plan)Acces.Trouver_Element(Acces.type_PLAN.id, e.ID);

                    n_ligne++;
                    r       = ws.Cells[n_ligne, 1];
                    r.Value = plan1.Libelle;
                    r       = ws.Cells[n_ligne, 2];
                    string pilote = "";
                    pilote  = (plan1.Pilote != null) ? "\n" + plan1.Pilote.Nom + " " + plan1.Pilote.Prenom : "";
                    r.Value = pilote;

                    r       = ws.Cells[n_ligne, 24];
                    r.Value = plan1.Code.Replace("PAR-", "");
                }

                if (e.Element_Type == Acces.type_OBJECTIF.id)
                {
                    Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, e.ID);

                    n_ligne++;
                    r       = ws.Cells[n_ligne, 3];
                    r.Value = obj.Libelle;

                    r       = ws.Cells[n_ligne, 24];
                    r.Value = obj.Code.Replace("OBJ-", "");
                }

                if (e.Element_Type == Acces.type_ACTION.id)
                {
                    PATIO.Classes.Action action = (PATIO.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION.id, e.ID);

                    if (action.TypeAction == TypeAction.ACTION)
                    {
                        n_ligne++;
                        r       = ws.Cells[n_ligne, 4];
                        r.Value = action.Libelle;

                        r = ws.Cells[n_ligne, 5];
                        string pilote = "";
                        pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                        pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : "";
                        r.Value = pilote;

                        r       = ws.Cells[n_ligne, 24];
                        r.Value = action.Code.Replace("ACT-", "");
                    }

                    if (action.TypeAction == TypeAction.OPERATION)
                    {
                        n_ligne++;
                        r       = ws.Cells[n_ligne, 6];
                        r.Value = action.Libelle;

                        r = ws.Cells[n_ligne, 7];
                        string pilote = "";
                        pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                        pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : "";
                        r.Value = pilote;

                        r       = ws.Cells[n_ligne, 24];
                        r.Value = action.Code.Replace("OPE-", "");
                    }

                    r       = ws.Cells[n_ligne, 8];
                    r.Value = Acces.Donner_Chaine_Liste(action.DirectionAssocie, "DIRECTION_METIER", "", true);

                    r       = ws.Cells[n_ligne, 9];
                    r.Value = (action.ActionPhare ? "X" : "");
                    if (action.OrdreActionPhare > 0)
                    {
                        r.Value = Acces.Trouver_TableValeur(action.OrdreActionPhare).Valeur;
                    }

                    r = ws.Cells[n_ligne, 10]; //Année 2018
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2018") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2018;
                    r = ws.Cells[n_ligne, 11]; //Année 2019
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2019") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2019;
                    r = ws.Cells[n_ligne, 12]; //Année 2020
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2020") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2020;
                    r = ws.Cells[n_ligne, 13]; //Année 2021
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2021") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2021;
                    r = ws.Cells[n_ligne, 14]; //Année 2022
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2022") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2022;
                    r = ws.Cells[n_ligne, 15]; //Année 2023
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2023") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2023;
                    r       = ws.Cells[n_ligne, 16]; //Financement
                    r.Value = action.CoutFinancier;
                    if (action.Mt_Total != null)
                    {
                        if (action.Mt_Total.Length > 0)
                        {
                            r.Value += "\n TOTAL : " + action.Mt_Total + " k€";
                        }
                    }

                    r                = ws.Cells[n_ligne, 17]; //TDS MF
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS591") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_591", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 18]; //TDS Hainaut
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS592") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_592", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 19]; //TDS 62
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS62") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_62", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 20]; //TDS 80
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS80") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_80", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 21]; //TDS 60
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS60") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_60", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 22]; //TDS 02
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS02") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_02", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 23]; //REGION
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "REGION") ? "X" : "";
                }
            }

            //Tri des lignes
            Range r_data = ws.Range["A8:Y" + n_ligne];

            r_data.Sort(r_data.Columns[24, Type.Missing], Microsoft.Office.Interop.Excel.XlSortOrder.xlAscending);

            r_data.Cells.VerticalAlignment = XlVAlign.xlVAlignCenter;

            //Mise en forme
            {
                r_data.WrapText = true; //Renvoie à la ligne
                //Bordures
                Borders border = r_data.Borders;

                border.LineStyle = XlLineStyle.xlContinuous;
                border.Weight    = 2d;
                border[XlBordersIndex.xlEdgeLeft].LineStyle   = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeTop].LineStyle    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeBottom].LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeRight].LineStyle  = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;

                //Alignement
                ws.Columns[2].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[5].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[7].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[8].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[9].HorizontalAlignment  = XlHAlign.xlHAlignCenter;
                ws.Columns[10].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[11].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[12].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[13].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[14].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[15].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[17].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[18].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[19].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[20].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[21].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[22].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[23].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                //Colonnes masquées
                ws.Columns["X"].Hidden = true; //Colonne Code
            }

            //Sauvegarde du fichier
            wb.SaveAs(fichier + ".xlsx");
            wb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fichier + ".pdf");

            wb.Close(false);
            wk.Close();

            //Fermeture de l'application Excel
            app.Quit();
            app = null;

            Process.Start(fichier + ".xlsx");
        }
Пример #35
0
        public ActionResult EditingInline_Destroy([DataSourceRequest] DataSourceRequest request, Objectif obj)
        {
            if (obj != null)
            {
                objCtx.DeleteObjectif(obj);
            }

            return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
        }