private bool valueChecked(Value value, ListBox ckdListBox)
        {
            bool retVal = false;

            for (int i = 0; i < ckdListBox.Items.Count; i++)
            {
                string val = value.getValue() + "-" + value.getDescription();
                if ((val.Equals(ckdListBox.Items[i])) & ckdListBox.GetSelected(i))
                {
                    retVal = true;
                    break;
                }
            }
            return retVal;
        }
 private void removeCheckBox(Value value, ListBox ckdListBox)
 {
     string val = value.getValue() + "-" + value.getDescription();
     for (int i = 0; i < ckdListBox.Items.Count; i++)
     {
         if (val.Equals(ckdListBox.Items[i]))
         {
             ckdListBox.Items.RemoveAt(i);
         }
     }
 }
 private bool textFound(Value value, string searchedText)
 {
     bool retVal = false;
     string val = value.getValue() + "-" + value.getDescription();
     if (val.Contains(searchedText) || (searchedText == ""))
     {
         retVal = true;
     }
     return retVal;
 }
 private bool existCheckBox(Value value, ListBox ckdListBox)
 {
     bool retVal = false;
     string val = value.getValue() + "-" + value.getDescription();
     for (int i = 0; i < ckdListBox.Items.Count; i++)
     {
         if (val.Equals(ckdListBox.Items[i]))
         {
             retVal = true;
             break;
         }
     }
     return retVal;
 }
        private List<Value> orderMetadataValue(List<Value> valuesMetadato)
        {
            
            Value val = new Value();
            
            for (int i = 0; i < valuesMetadato.Count - 1; i++)
            {
                
                for (int j = i+1; j < valuesMetadato.Count; j++)
                {
                    if (valuesMetadato[i].listExtraData.Count == 0)
                    {
                       
                        break;      
                    }
                    if (valuesMetadato[j].listExtraData.Count == 0)
                    {
                        val = valuesMetadato[i];
                        valuesMetadato[i] = valuesMetadato[j];
                        valuesMetadato[j] = val;
                        break;
                    }
                        if ((int.Parse(valuesMetadato[i].listExtraData[0].getValue())) > (int.Parse(valuesMetadato[j].listExtraData[0].getValue())))
                        {
                            val = valuesMetadato[i];
                            valuesMetadato[i] = valuesMetadato[j];
                            valuesMetadato[j] = val;
                        }
                }
            }

            return valuesMetadato;
        }
Esempio n. 6
0
        /* public MetadataSet metadataSetFromFile()
        {
            MetadataSet metadataSet = new MetadataSet();
            docXml.Load("C:/Documents and Settings/depascalis/Impostazioni locali/Dati applicazioni/IsolatedStorage/metadataSet.xml");
            return parser(docXml, metadataSet);
        }*/
        public MetadataSet parser(ProcessMetadataSet mtdSet)
        {
            MetadataSet metadataSet = new MetadataSet();
            try
            {

               // XmlNodeList elemList = doc.GetElementsByTagName("CompoundMetadata");
                ProcessCompoundMetadata[] elemList = mtdSet.cmpMetadataList;
                for (int i = 0; i < elemList.Length; i++)
                {
                    CompoundMetadata cmpMetadata = new CompoundMetadata();
                    cmpMetadata.setKey(elemList[i].key);
                    cmpMetadata.setDescription(elemList[i].description);
                   // metadataSet.cmpMetadataList.Add(cmpMetadata);
                    ProcessMetadata[] elementListMetadata = elemList[i].metadataList;
                    //XmlNodeList elementListMetadata = elemList[i].ChildNodes;
                    for (int j = 0; j < elementListMetadata.Length; j++)
                    {
                        Metadata metadata = new Metadata();
                        metadata.setKey(elementListMetadata[j].key);
                        metadata.setDescription(elementListMetadata[j].description);
                        //cmpMetadata.metadataList.Add(metadata);
                        ProcessValue[] elementListValue = elementListMetadata[j].valueList;
                        for (int k = 0; k < elementListValue.Length; k++)
                        {
                            Value value = new Value();
                            value.setValue(elementListValue[k].value);
                            value.setDescription(elementListValue[k].description);
                            value.setState(elementListValue[k].zidState);
                            ProcessExtraData[] elementExtraData = elementListValue[k].listProcessExtraData;
                            if (elementExtraData != null)
                            {
                                SimpleExtraDataManager simpleExtraData = new SimpleExtraDataManager();
                                simpleExtraData.setKey(elementExtraData[0].key);
                                simpleExtraData.setValue(elementExtraData[0].value);
                                value.listExtraData.Add(simpleExtraData);
                            }
                            metadata.valueList.Add(value);

                        }
                       cmpMetadata.metadataList.Add(metadata);
                    }
                    metadataSet.cmpMetadataList.Add(cmpMetadata);
                }
                /*XmlNodeList elemRuleSet = doc.GetElementsByTagName("RuleSet");
                RuleSet ruleSet = new RuleSet();
                for (int i = 0; i < elemRuleSet.Count; i++)
                {
                    XmlNodeList elemRule = elemRuleSet[i].ChildNodes;
                    for (int j = 0; j < elemRule.Count; j++)
                    {
                        Rule rule = new Rule();
                        rule.setkey(elemRule[j].Attributes["Key"].Value);
                        rule.setValue(elemRule[j].Attributes["Value"].Value);
                        ruleSet.ruleList.Add(rule);
                    }
                    mtdSet.ruleSetList.Add(ruleSet);
                }*/

                return metadataSet;
            }
            catch (System.Exception ex)
            {
                XmlException myEx = new XmlException("Errore nell'interpretazione del messaggio");
                throw myEx;
            }
        }
Esempio n. 7
0
        public MetadataSet parserMetadataSetFromXML(XmlDocument doc)
        {
            string pos = "MetadataParser.parserMetadataSetFromFileSystem";

            log.Info(pos + "INIT");

            MetadataSet mtdSet = null;

            try
            {
                mtdSet = new MetadataSet();

                XmlNodeList elemList = doc.GetElementsByTagName("CompoundMetadata");
                for (int i = 0; i < elemList.Count; i++)
                {
                    CompoundMetadata cmpMetadata = new CompoundMetadata();
                    cmpMetadata.setKey(elemList[i].Attributes["Key"].Value);
                    cmpMetadata.setDescription(elemList[i].Attributes["Description"].Value);
                   // metadataSet.cmpMetadataList.Add(cmpMetadata);
                    XmlNodeList elementListMetadata = elemList[i].ChildNodes;
                    for (int j = 0; j < elementListMetadata.Count; j++)
                    {
                        Metadata metadata = new Metadata();
                        metadata.setKey(elementListMetadata[j].Attributes["Key"].Value);
                        metadata.setDescription(elementListMetadata[j].Attributes["Description"].Value);
                        //cmpMetadata.metadataList.Add(metadata);
                        XmlNodeList elementListValue = elementListMetadata[j].ChildNodes;
                        for (int k = 0; k < elementListValue.Count; k++)
                        {
                            Value value = new Value();
                            value.setValue(elementListValue[k].Attributes["value"].Value);
                            value.setState(Convert.ToInt32(elementListValue[k].Attributes["state"].Value));
                            value.setDescription(elementListValue[k].Attributes["description"].Value);
                            XmlNodeList elementExtraData = elementListValue[k].ChildNodes;
                            if (elementExtraData.Count != 0)
                            {
                                SimpleExtraDataManager simpleExtraData = new SimpleExtraDataManager();
                                simpleExtraData.setKey(elementExtraData[0].Attributes["Key"].Value);
                                simpleExtraData.setValue(elementExtraData[0].Attributes["Value"].Value);
                                value.listExtraData.Add(simpleExtraData);
                            }
                            metadata.valueList.Add(value);

                        }
                       cmpMetadata.metadataList.Add(metadata);
                    }
                    mtdSet.cmpMetadataList.Add(cmpMetadata);
                }
                XmlNodeList elemRuleSet = doc.GetElementsByTagName("RuleSet");
                RuleSet ruleSet = new RuleSet();
                for (int i = 0; i < elemRuleSet.Count; i++)
                {
                    XmlNodeList elemRule = elemRuleSet[i].ChildNodes;
                    for (int j = 0; j < elemRule.Count; j++)
                    {
                        Rule rule = new Rule();
                        rule.setkey(elemRule[j].Attributes["Key"].Value);
                        rule.setValue(elemRule[j].Attributes["Value"].Value);
                        ruleSet.ruleList.Add(rule);
                    }
                    mtdSet.ruleSetList.Add(ruleSet);
                }

            }
            catch (System.Exception exep)
            {
                log.Error(pos + "Exception:" + exep.Message);
                log.Error(pos + "Exception:" + exep.StackTrace);
                XmlException myEx = new XmlException("Errore nell'interpretazione del messaggio:" + exep.Message);
                throw myEx;
            }

            log.Info(pos + "END");

            return mtdSet;
        }
Esempio n. 8
0
 /**
  * @param metadataSet rappresenta un oggetto di tipo MetadataSet.Ossia l'elenco
  * dei metadati appena scaricati dal servizio KPeople.
  * @param metadataSetFromDisk un oggetto di tipo MetadataSet contenente le informazioni
  * strutturate relative all'insieme dei metadati salvati sul File System.
  * Il metodo in questione verifica preliminarmente la presenza di matching tra i metadati del servizio
  * KPeople e quelli sul File System. Nel caso di match, preleva l'ExtraData associato a ciascun metadato
  * appartenente all'elenco dei metadati salvati su disco e lo aggiunge al corrispondente metadato
  * appartenente all'elenco dei metadati scaricati dal servizio
  */
 private void compareValue(MetadataSet metadataset, MetadataSet metadataSetFromDisk, int iMetadataset, int jMetadataset, int aMetadataSetFromDisk, int bMetadataSetFromDisk)
 {
     Value value = new Value();
     for (int i = 0; i < metadataset.cmpMetadataList[iMetadataset].metadataList[jMetadataset].valueList.Count; i++)
     {
         string valueKey = metadataset.cmpMetadataList[iMetadataset].metadataList[jMetadataset].valueList[i].getValue();
         for (int j = 0; j < metadataSetFromDisk.cmpMetadataList[aMetadataSetFromDisk].metadataList[bMetadataSetFromDisk].valueList.Count; j++)
         {
             if (metadataSetFromDisk.cmpMetadataList[aMetadataSetFromDisk].metadataList[bMetadataSetFromDisk].valueList[j].getValue().Equals(valueKey))
             {
                 if (metadataSetFromDisk.cmpMetadataList[aMetadataSetFromDisk].metadataList[bMetadataSetFromDisk].valueList[j].listExtraData.Count != 0)
                 {
                     metadataset.cmpMetadataList[iMetadataset].metadataList[jMetadataset].valueList[i].listExtraData.Add(
                         metadataSetFromDisk.cmpMetadataList[aMetadataSetFromDisk].metadataList[bMetadataSetFromDisk].valueList[j].listExtraData[0]);
                 }
             }
         }
     }
 }