/// <summary> /// Copie les données à partir d'un flux xmlrpc /// </summary> /// <param name="source">Objet XmlRpcStruct source (provenant d'un flux xmlrpc)</param> /// <remarks></remarks> public void copyData(CookComputing.XmlRpc.XmlRpcStruct source) { IEnumerator boucle; boucle = source.GetEnumerator(); while (boucle.MoveNext()) { add((string)((DictionaryEntry)(boucle.Current)).Key, ((DictionaryEntry)(boucle.Current)).Value /*traitementListe(((DictionaryEntry)(boucle.Current)).Value)*/); } }
public void treatment(string name, CookComputing.XmlRpc.XmlRpcStruct donnees) { IEnumerator boucle; IEnumerator boucle2; try { _name = name; boucle = donnees.GetEnumerator(); while (boucle.MoveNext()) { switch ((string)((DictionaryEntry)(boucle.Current)).Key) { case "help": _help = (string)((DictionaryEntry)(boucle.Current)).Value; break; case "context": boucle2 = ((CookComputing.XmlRpc.XmlRpcStruct)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator(); while (boucle2.MoveNext()) _context.Add((string)((DictionaryEntry)(boucle.Current)).Key, ((DictionaryEntry)(boucle.Current)).Value); break; case "relation": _relation = (string)((DictionaryEntry)(boucle.Current)).Value; break; case "type": switch ((string)((DictionaryEntry)(boucle.Current)).Value) { case "integer": _type = FIELD_TYPE.INTEGER; break; case "float": _type = FIELD_TYPE.FLOAT; break; case "date": _type = FIELD_TYPE.DATE; break; case "datetime": _type = FIELD_TYPE.DATETIME; break; case "boolean": _type = FIELD_TYPE.BOOLEAN; break; case "char": _type = FIELD_TYPE.CHAR; break; case "text": _type = FIELD_TYPE.TEXT; break; case "selection": _type = FIELD_TYPE.SELECTION; break; case "binary": _type = FIELD_TYPE.BINARY; break; case "many2one": _type = FIELD_TYPE.MANY2ONE; break; case "many2many": _type = FIELD_TYPE.MANY2MANY; break; case "one2one": _type = FIELD_TYPE.ONE2ONE; break; case "one2many": _type = FIELD_TYPE.ONE2MANY; break; case "reference": _type = FIELD_TYPE.REFERENCE; break; default: throw new Exception("Type de champs OpenERP inconnu"); } break; case "string": _desc = (string)((DictionaryEntry)(boucle.Current)).Value; break; case "selectable": _selectable = (bool)((DictionaryEntry)(boucle.Current)).Value; break; case "fnct_inv_arg": treatmentArrayOrString(_fnct_inv_arg, ((DictionaryEntry)(boucle.Current)).Value); break; case "fnct_search": treatmentArrayOrString(_fnct_search, ((DictionaryEntry)(boucle.Current)).Value); break; case "func_method": treatmentArrayOrString(_fnct_method, ((DictionaryEntry)(boucle.Current)).Value); break; case "fnct_inv": treatmentArrayOrString(_fnct_inv, ((DictionaryEntry)(boucle.Current)).Value); break; case "func_obj": treatmentArrayOrString(_fnct_obj, ((DictionaryEntry)(boucle.Current)).Value); break; case "function": _function = (string)((DictionaryEntry)(boucle.Current)).Value; break; case "store": if ((((DictionaryEntry)(boucle.Current)).Value.GetType() != typeof(bool))) _functionStore = (string)((DictionaryEntry)(boucle.Current)).Value; else _store = (bool)((DictionaryEntry)(boucle.Current)).Value; break; case "digits": boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator(); while (boucle2.MoveNext()) _digit.Add(boucle2.Current); break; case "size": _size = (int)((DictionaryEntry)(boucle.Current)).Value; break; case "readonly": if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(int)) { if ((int)((DictionaryEntry)(boucle.Current)).Value == 0) _readOnly = false; else _readOnly = true; } else _readOnly = (bool)((DictionaryEntry)(boucle.Current)).Value; break; case "required": if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(bool)) _required = (bool)((DictionaryEntry)(boucle.Current)).Value; else _required = int.Parse((string)((DictionaryEntry)(boucle.Current)).Value) == 1 ? true : false; break; case "selection": boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator(); while (boucle2.MoveNext()) _selection.Add(((System.Array)(boucle2.Current)).GetValue(0), ((System.Array)(boucle2.Current)).GetValue(1)); break; case "translate": _translate = (bool)((DictionaryEntry)(boucle.Current)).Value; break; case "change_default": _change_default = (bool)((DictionaryEntry)(boucle.Current)).Value; break; case "select": if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(bool)) _select = (bool)((DictionaryEntry)(boucle.Current)).Value ? 1 : 0; else _select = (int)((DictionaryEntry)(boucle.Current)).Value; break; case "related_columns": boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator(); while (boucle2.MoveNext()) _relatedColumns.Add(boucle2.Current); break; case "third_table": _thirdTable = (string)((DictionaryEntry)(boucle.Current)).Value; break; case "domain": if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(string)) _domain.Add((string)((DictionaryEntry)(boucle.Current)).Value); else { boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator(); while (boucle2.MoveNext()) _domain.Add(boucle2.Current); } break; case "states": boucle2 = ((CookComputing.XmlRpc.XmlRpcStruct)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator(); while (boucle2.MoveNext()) _states.Add(boucle2.Current); break; case "invisible": _invisible = (bool)((DictionaryEntry)(boucle.Current)).Value; break; default: throw new Exception("Parametre de champs OpenERP inconnu"); } } } catch (Exception ex) { _type = FIELD_TYPE.NC; throw new Systeme.exceptionOpenERP(IMDEV.OpenERP.Systeme.exceptionOpenERP.ERRORS.ERR_READ_FIELD, ex.Message); } }