Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type,Value,AttributId")] Attribut attribut)
        {
            if (id != attribut.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(attribut);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AttributExists(attribut.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(attribut));
        }
        public Dictionary <Param, IList <HisValue> > readNewDataSiteJson(Site apiSite, string json)
        {
            var paramValues = new Dictionary <Param, IList <HisValue> >();

            json = json.Substring(0, json.IndexOf('\0'));  // ETS remove strange character at end '\0\0+��\0\'

            // get data from string
            var deserialized = JsonConvert.DeserializeObject <JsonResponseMqttEaseEGIotModel>(json);


            // get site variables
            foreach (var param in apiSite.Params)
            {
                IParamAttributRepository paramAttributRepo = new ParamAttributReposiroty();
                IAttributRepository      attributRepo      = new AttributRepository();

                Attribut      attribut      = attributRepo.FindByName("Adresse Api");
                ParamAttribut paramAttribut = paramAttributRepo.FindWithParamAttribut(param.Id, attribut.Id);

                // get from "adresse api" attribut
                var hisValues = new List <HisValue>();
                var hisValue  = deserialized.GetHisValueFromLabel(paramAttribut.Valeur, param.Id);
                if (hisValue != null)
                {
                    hisValues.Add(hisValue);
                    paramValues.Add(param, hisValues);
                }
            }// rof params


            return(paramValues);
        }
Example #3
0
 override public void Load(LitEngine.IO.AESReader _loader)
 {
     Key = _loader.ReadString();
     Attribut.Load(_loader);
     ValueType = GetValueTypeByString(_loader.ReadString());
     LoadByType(_loader);
 }
Example #4
0
        void Valider()
        {
            string Code         = lblCodeAttribut.Text.Trim();
            string Libelle      = lblLibelle.Text.Trim();
            string Attribut_6PO = lbl6PO.Text.Trim();
            int    element_type = listeTypeElement[lstTypeElement.SelectedIndex].ID;

            if (Libelle.Length == 0)
            {
                MessageBox.Show("Libellé obligatoire", "Erreur"); return;
            }
            if (Code.Length == 0)
            {
                MessageBox.Show("Code obligatoire", "Erreur"); return;
            }

            if (ID > 0)
            {
                attribut.Acces = Acces;

                if (attribut.Exister(element_type, Code))
                {
                    MessageBox.Show("Code existant"); return;
                }

                attribut.Code         = Code;
                attribut.Libelle      = Libelle;
                attribut.Element_Type = element_type;
                attribut.ATT_6PO      = Attribut_6PO;
                attribut.MettreAJour();

                if (Code != lblCode.Text)
                {
                    attribut.MettreAJour_dElement(lblCode.Text);
                    if (MessageBox.Show("Mettre à jour la table de valeurs pour le nouveau code ?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        attribut.MettreAJour_TV(lblCode.Text);
                    }
                }
            }
            else
            {
                attribut       = new Attribut();
                attribut.Acces = Acces;

                if (attribut.Exister((int)element_type, Code))
                {
                    MessageBox.Show("Code existant"); return;
                }

                attribut.Code         = Code;
                attribut.Libelle      = Libelle;
                attribut.Element_Type = (int)element_type;
                attribut.ATT_6PO      = Attribut_6PO;
                attribut.Ajouter();
            }
            //Attention si correction du code impact sur dElement
            this.DialogResult = DialogResult.OK;
        }
Example #5
0
 void ContraintePrimaryKeyLoad(object sender, System.EventArgs e)
 {
     for (int i = 0; i < arrayAttributs.Count; i++)
     {
         Attribut att = (Attribut)arrayAttributs[i];
         liste.Items.Add(att.propNom);
     }
 }
Example #6
0
 override public void Save(LitEngine.IO.AESWriter _writer)
 {
     _writer.WriteString(Key);
     Attribut.Save(_writer);
     _writer.WriteString(ValueType.ToString());
     if (ValueType != FieldType.Null)
     {
         SaveByType(_writer);
     }
 }
        public void GetReduzierenKosten_FertigkeitIsAttribut(int aktuellerNw, int expected)
        {
            SteigerbareFertigkeitBase fertigkeit = new Attribut()
            {
                SteigerungsWert = aktuellerNw
            };
            var result = FertigkeitVeraendernRegeln.GetReduzierenKosten(fertigkeit);

            Assert.Equal(expected, result);
        }
Example #8
0
        public IDictionary <Param, IList <HisValue> > readDataSite(DateTime startDate, DateTime enDate, Site sites)
        {
            var url = Url + "&dateDebutDju={0}&dateFinDju={1}&codeStationMeteo={2}";


            // renvoi une liste de tous les params du site contenant un attribut (ref_attribut) au nom : "Adresse Api"
            var paramList = getVariables(sites);

            mapParamListValue = new Dictionary <Param, IList <HisValue> >(); // objet his_value contenant des données horodatés dateTime et une valeur double

            foreach (var par in paramList)
            {
                var Result = "";
                // On récupère la valeur des attributs de ParamAttribut correspondant à à l'id_param et à l'id_attribut
                IParamAttributRepository paramAttributRepo = new ParamAttributReposiroty();
                IAttributRepository      attributRepo      = new AttributRepository();

                Attribut      attribut      = attributRepo.FindByName("Adresse Api");
                ParamAttribut paramAttribut = paramAttributRepo.FindWithParamAttribut(par.Id, attribut.Id);

                // if (attribut != null)
                {
                    WebRequest request = WebRequest.Create(string.Format(url, startDate.ToString("yyyyMMdd"), enDate.ToString("yyyyMMdd"), sites.CodeExterne)); //TODO ajouter get getData pour tous les param du site contenant un attribut "adresse api"

                    request.Credentials = CredentialCache.DefaultCredentials;
                    request.Method      = "GET";
                    request.Timeout     = 60000;// System.Threading.Timeout.Infinite;

                    try
                    {
                        WebResponse response = request.GetResponse();

                        // Get the stream containing content returned by the server.
                        Stream dataStream = response.GetResponseStream();

                        // Open the stream using a StreamReader for easy access.
                        StreamReader reader = new StreamReader(dataStream);

                        // Read the content.
                        string responseFromServer = reader.ReadToEnd();

                        Result = responseFromServer;//.Replace(",", "\r\n");
                        reader.Close();
                        response.Close();
                        JsonResponseMeteoIdexModel valueList = JsonConvert.DeserializeObject <JsonResponseMeteoIdexModel>(Result);
                        mapParamListValue.Add(par, valueList.toHisValues(par.Id, paramAttribut != null ? paramAttribut.Valeur : ""));
                    }
                    catch (Exception ex)
                    {
                        Result = ex.Message;
                    }
                }
            }
            return(mapParamListValue);
        }
Example #9
0
        public async Task <IActionResult> Create([Bind("Id,Type,Value,AttributId")] Attribut attribut)
        {
            if (ModelState.IsValid)
            {
                _context.Add(attribut);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(attribut));
        }
Example #10
0
        public void ChangeErfahrung_RaisesNoEvent()
        {
            var id       = ImagoEntitaetFactory.GetNewEntitaet(ImagoAttribut.Staerke);
            var attribut = new Attribut(id);
            var args     = new FaktischerWertChangedEventArgs(id);

            attribut.Erfahrung = 5;

            //todo
            //no assert available
        }
Example #11
0
        public async Task <IActionResult> Create([Bind("ID,Nom,Mesure")] Attribut attribut)
        {
            if (ModelState.IsValid)
            {
                _context.Add(attribut);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(attribut));
        }
        public void GetSteigerungsKosten_FertigkeitIsAttribut_GetImagoInt()
        {
            var random = new Random().Next(0, 101);
            SteigerbareFertigkeitBase fertigkeit = new Attribut()
            {
                SteigerungsWert = random
            };
            var result = FertigkeitVeraendernRegeln.GetSteigernKosten(fertigkeit);

            Assert.Contains(result, FertigkeitVeraendernRegeln.ImagoFolge);
        }
Example #13
0
        public void SteigereFertigkeit_AttributHasNotGenugEp_SteigerungWertNoInc(int aktuellerNw, int verfuegbareEp, int erwarteterNw)
        {
            SteigerbareFertigkeitBase fertigkeit = new Attribut()
            {
                SteigerungsWert = aktuellerNw, Erfahrung = verfuegbareEp
            };

            _service.SteigereFertigkeit(ref fertigkeit);
            var result = fertigkeit.SteigerungsWert;

            Assert.Equal(erwarteterNw, result);
        }
        /// <summary>
        /// filter irrelevant attributes from view
        /// </summary>
        /// <param name="item"></param>
        /// <returns>true if it will be shown, false otherwise</returns>
        private bool AttributesFilter(object item)
        {
            Attribut attribute = item as Attribut;

            if (attribute.Type == AttributType.Wildcard)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #15
0
            override public void Load(LitEngine.IO.AESReader _loader)
            {
                TableName = _loader.ReadString();
                Attribut.Load(_loader);
                int trowCount = _loader.ReadInt32();

                for (int i = 0; i < trowCount; i++)
                {
                    DataRow trow = new DataRow();
                    trow.Load(_loader);
                    AddFromRow(trow);
                }
            }
Example #16
0
            override public void Save(LitEngine.IO.AESWriter _writer)
            {
                _writer.WriteString(Key);
                Attribut.Save(_writer);
                int tfieldCount = fieldList.Count;

                _writer.WriteInt(tfieldCount);
                for (int i = 0; i < tfieldCount; i++)
                {
                    DataField tfield = fieldList[i];
                    tfield.Save(_writer);
                }
            }
Example #17
0
            override public void Load(LitEngine.IO.AESReader _loader)
            {
                Key = _loader.ReadString();
                Attribut.Load(_loader);
                int tfieldCount = _loader.ReadInt32();

                for (int i = 0; i < tfieldCount; i++)
                {
                    DataField tfield = new DataField(null, null);
                    tfield.Load(_loader);
                    AddFromField(tfield);
                }
            }
Example #18
0
        /// <summary>
        /// Fonction qui permet de construire un objet parametre
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="nsmgr"></param>
        /// <returns></returns>
        public static List <ObjetParametre> ObjetsParametre(XmlDocument doc, XmlNamespaceManager nsmgr)
        {
            List <string>           noms            = NomsObjetsParametre(doc, nsmgr);
            List <ObjetParametre>   objetsParametre = new List <ObjetParametre>();
            List <string>           descriptions    = DescriptionsObjetsParametre(doc, nsmgr);
            List <List <Attribut> > attributs       = Attribut.AttributsObjetsParametres(doc, nsmgr);

            for (int i = 0; i < noms.Count; i++)
            {
                objetsParametre.Add(new ObjetParametre(noms[i], descriptions[i], attributs[i]));
            }
            return(objetsParametre);
        }
Example #19
0
        /// <summary>
        /// Fonction qui permet de retourner la liste des classes  de presentation du fichier
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="nsmgr"></param>
        /// <returns></returns>
        public static List <ClassePresentation> ClassesPresentation(XmlDocument doc, XmlNamespaceManager nsmgr)
        {
            List <string>             noms = NomsClassesPresentation(doc, nsmgr);
            List <ClassePresentation> classesPresentation = new List <ClassePresentation>();
            List <string>             descriptions        = DescriptionsClassesPresentation(doc, nsmgr);
            List <List <Attribut> >   attributs           = Attribut.AttributsClassePresentation(doc, nsmgr);

            for (int i = 0; i < noms.Count; i++)
            {
                classesPresentation.Add(new ClassePresentation(noms[i], descriptions[i], attributs[i]));
            }
            return(classesPresentation);
        }
Example #20
0
            override public void Save(LitEngine.IO.AESWriter _writer)
            {
                _writer.WriteString(TableName);
                Attribut.Save(_writer);

                int trowCount = rowList.Count;

                _writer.WriteInt(trowCount);
                for (int i = 0; i < trowCount; i++)
                {
                    DataRow trow = rowList[i];
                    trow.Save(_writer);
                }
            }
Example #21
0
        private static Attribut ParseAttributElement(XElement attributeElement, LISAEntities entities)
        {
            Attribut result = new Attribut();

            long   attributeId    = long.Parse(attributeElement.Attribute(XName.Get("id")).Value);
            string attributeLabel = attributeElement.Element(XName.Get("label")).Value;

            result = new Attribut()
            {
                Libelle = attributeLabel
            };
            entities.Attributs.Add(result);

            return(result);
        }
Example #22
0
        public void ChangeModifikation_RaisesEvent()
        {
            var id       = ImagoEntitaetFactory.GetNewEntitaet(ImagoAttribut.Staerke);
            var attribut = new Attribut(id);
            var args     = new FaktischerWertChangedEventArgs(id);

            var evt = Assert.RaisesAny <FaktischerWertChangedEventArgs>(
                h => attribut.FaktischerWertChanged += h,
                h => attribut.FaktischerWertChanged -= h,
                () => attribut.Modifikation          = 5);

            Assert.NotNull(evt);
            Assert.Equal(attribut, evt.Sender);
            Assert.Equal(args, evt.Arguments);
        }
Example #23
0
        void ContrainteForeignKeyLoad(object sender, System.EventArgs e)
        {
            for (int i = 0; i < entite.attributs.Count; i++)
            {
                Attribut att = (Attribut)entite.attributs[i];
                listeAttributs.Items.Add(att.propNom.ToString());
            }

            for (int i = 0; i < arrayTables.Count; i++)
            {
                Table t = (Table)arrayTables[i];
                listeTables.Items.Add(t.propNom.ToString());
            }

            //ajout de la table courante
            listeTables.Items.Add(entite.propNom.ToString());
        }
Example #24
0
        void BoutonSuivantClick(object sender, System.EventArgs e)
        {
            arrayAttributs = new ArrayList();
            for (int i = 0; i < table.Rows.Count - 1; i++)
            {
                Attribut att = new Attribut(table.Rows[i].Cells[0].FormattedValue.ToString(), table.Rows[i].Cells[1].FormattedValue.ToString());
                att.propTable = tableWizard1.nomTable;
                if (!table.Rows[i].Cells[2].FormattedValue.ToString().Equals(""))
                {
                    att.propTaille = table.Rows[i].Cells[2].FormattedValue.ToString();
                }
                if (!table.Rows[i].Cells[3].FormattedValue.ToString().Equals(""))
                {
                    att.propDefaultValue = table.Rows[i].Cells[3].FormattedValue.ToString();
                }
                if (!table.Rows[i].Cells[4].FormattedValue.ToString().Equals(Boolean.FalseString))
                {
                    att.notNull = true;
                }
                if (!table.Rows[i].Cells[5].FormattedValue.ToString().Equals(""))
                {
                    att.nomNotNull = table.Rows[i].Cells[5].FormattedValue.ToString();
                }
                if (!table.Rows[i].Cells[6].FormattedValue.ToString().Equals(Boolean.FalseString))
                {
                    att.autoNotNull = true;
                }
                arrayAttributs.Add(att);
                Console.WriteLine(att.ToString());
            }
            if (tableWizard3 == null)
            {
                tableWizard3 = new CreateTableWizard3();
                tableWizard3.propTableWizard2 = this;
                tableWizard3.propTables       = arrayTables;
                tableWizard3.propAttributs    = arrayAttributs;
                tableWizard3.propListe        = liste;
                tableWizard3.initialiser();
            }

            this.Visible         = false;
            tableWizard3.Visible = true;
        }
Example #25
0
        void ChargementTableAttribut()
        {
            Modules.ClassePHP cls = new Modules.ClassePHP();
            listeattribut = new List <Attribut>();

            lst.Items.Add("Chargement de la table des attributs...");
            Application.DoEvents();

            DataSet Sn = cls.ContenuTable("attribut");

            foreach (DataRow r in Sn.Tables["attribut"].Rows)
            {
                Attribut t = new Attribut();
                t.ID           = int.Parse(r[0].ToString());
                t.Code         = r[1].ToString();
                t.Libelle      = r[2].ToString();
                t.Element_Type = int.Parse(r[3].ToString());
                listeattribut.Add(t);
            }
        }
Example #26
0
 public void UpdateAttributes(string[] names, string[] values)
 {
     for (int i = 0; i < names.Length; i++)
     {
         int idx = FindOrCreate(names[i]);
         if (idx != -1)
         {
             Attribut a = Attributes[idx];
             a.Value         = values[i];
             Attributes[idx] = a;
         }
         else
         {
             Attribut a = new Attribut();
             a.Name  = names[i];
             a.Value = values[i];
             Attributes.Add(a);
         }
     }
     Update = true;
 }
Example #27
0
        private void setDataAttribut()
        {
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                string nameTest = "";

                string typeTest = "";

                try
                {
                    typeTest = row.Cells[0].Value.ToString();
                    nameTest = row.Cells[1].Value.ToString();

                    Attribut att = new Attribut(nameTest, typeTest);
                    classManager.addAttribut(att);
                }
                catch (Exception ex)
                {
                }
            }
        }
Example #28
0
        public AttributVM(Attribut attribut)
        {
            Attribut = attribut;

            AddValeur = new RelayCommand(() =>
            {
                if (Pere != null)
                {
                    if (SelectedValeurPere == null)
                    {
                        return;
                    }
                    Attribut.Valeurs.Add(new Valeur()
                    {
                        Pere = SelectedValeurPere
                    });
                }
                else
                {
                    Attribut.Valeurs.Add(new Valeur());
                }
                IoCContainer.Get <ModelContainer>().SaveChanges();
                OnPropertyChanged(nameof(Valeurs));

                OnPropertyChanged(nameof(SelectedValeur));
            });

            DeleteValeur = new RelayCommand(() =>
            {
                if (SelectedValeur == null)
                {
                    return;
                }
                Attribut.Valeurs.Remove(SelectedValeur.Valeur);
                IoCContainer.Get <ModelContainer>().SaveChanges();
                OnPropertyChanged(nameof(Valeurs));
                SelectedValeur = Valeurs.Last();
                OnPropertyChanged(nameof(SelectedValeur));
            });
        }
        void SupprimerAttribut()
        {
            if (DG_Attribut.SelectedRows.Count == 0)
            {
                return;
            }

            if (MessageBox.Show("Etes-vous sûr de vouloir supprimer cet attribut ?", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            Attribut att = new Attribut();

            att.Acces = Acces;
            att.ID    = int.Parse(DG_Attribut.SelectedRows[0].Cells["id"].Value.ToString());
            att.Supprimer();

            //Impact sur dElement !!!!!

            Afficher_ListeAttribut();
        }
        private static void Attributanalyse()
        {
            int i = 0, limit = 100, offset = 35;

            foreach (var r in AllTablesColumns)
            {
                Console.WriteLine($"\r    Starte Relation {i+1}: '{r.Key}'");
                if (i >= offset)
                {
                    foreach (var a in r.Value)
                    {
                        Console.WriteLine($"\r        Starte Attribut '{a}'");
                        Ergebnisse_Attribute.Add(Attribut.Analysieren(r.Key, a, r.Value.IndexOf(a)));
                    }
                }
                else
                {
                    Console.WriteLine($"    Skipped!");
                }


                string dump_json = JsonConvert.SerializeObject(Ergebnisse_Attribute, Formatting.Indented);
                if (File.Exists("dump.json"))
                {
                    File.Delete("dump.json");
                }
                File.WriteAllText("dump.json", dump_json);

                i++;
                if (i >= limit)
                {
                    break;
                }
            }

            Console.WriteLine($"\r    {Ergebnisse_Attribute.Count} Attribute analysiert!");
        }
Example #31
0
 public Fertigkeit(Attribut attribut, XmlReader reader)
     : this(reader.getBoolean("skillbar"), attribut, reader)
 {
 }
Example #32
0
 private Fertigkeit(bool skillbar, Attribut attribut, XmlReader reader)
     : base(reader)
 {
     this.skillbar = skillbar;
     this.attribut = attribut;
 }