protected virtual void OnAcceptButtonClicked(object sender, System.EventArgs e) { if (password1Entry.Text != "") { llum.Core core = llum.Core.getCore(); string out_response; CookComputing.XmlRpc.XmlRpcStruct new_ret = llum.Core.getCore().xmlrpc.client.change_own_password(core.user_info, "Golem", core.user_info, password1Entry.Text); if (Convert.ToInt32(new_ret["status"]) == 0) { out_response = (string)new_ret["return"]; } else { out_response = (string)new_ret["msg"]; } if (out_response == "true") { msgLabel.Text = Mono.Unix.Catalog.GetString("Password changed successfully"); core.user_info[1] = password1Entry.Text; } else { msgLabel.Text = Mono.Unix.Catalog.GetString("Could not change password.") + "\n Error: " + out_response; } } }
/// <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 CookComputing.XmlRpc.XmlRpcStruct toArray(bool withId) { CookComputing.XmlRpc.XmlRpcStruct temp = new CookComputing.XmlRpc.XmlRpcStruct(); foreach (string key in Keys) { if ((key != "id") || (withId)) { if ((this[key] == null)) { temp.Add(key, false); } else { temp.Add(key, this[key]); } } } return(temp); }
protected virtual void OnAcceptButtonClicked(object sender, System.EventArgs e) { llum.Core core = llum.Core.getCore(); CookComputing.XmlRpc.XmlRpcStruct properties = new CookComputing.XmlRpc.XmlRpcStruct(); properties["cn"] = nameEntry.Text; properties["description"] = descriptionEntry.Text; properties["x-lliurex-grouptype"] = "generic"; string ret = core.xmlrpc.add_group(properties); if (ret == "true") { msgLabel.Markup = "<b>" + Mono.Unix.Catalog.GetString("Group successfully added") + "</b>"; } else { msgLabel.Markup = "<span foreground='red'>" + Mono.Unix.Catalog.GetString("An error was found when adding group:") + "\n" + ret + "</span>"; } }
convert_to_proxy_XenRefVDI_XenRefSR(Dictionary <XenRef <VDI>, XenRef <SR> > table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef <VDI> key in table.Keys) { try { string k = key ?? ""; string v = table[key] ?? ""; result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_string_string(Dictionary <string, string> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (string key in table.Keys) { try { string k = key ?? ""; string v = table[key] ?? ""; result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_XenRefVGPU_type_long(Dictionary <XenRef <VGPU_type>, long> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef <VGPU_type> key in table.Keys) { try { string k = key ?? ""; string v = table[key].ToString(); result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_vm_operations_string(Dictionary <vm_operations, string> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (vm_operations key in table.Keys) { try { string k = vm_operations_helper.ToString(key); string v = (table[key] != null) ? table[key] : ""; result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_string_vm_operations(Dictionary <string, vm_operations> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (string key in table.Keys) { try { string k = (key != null) ? key : ""; string v = vm_operations_helper.ToString(table[key]); result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_long_string_array(Dictionary <long, string[]> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (long key in table.Keys) { try { string k = key.ToString(); string [] v = table[key]; result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_XenRefVM_Dictionary_string_string(Dictionary <XenRef <VM>, Dictionary <string, string> > table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef <VM> key in table.Keys) { try { string k = (key != null) ? key : ""; Object v = Maps.convert_to_proxy_string_string(table[key]); result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_XenRefHost_string_array(Dictionary <XenRef <Host>, string[]> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef <Host> key in table.Keys) { try { string k = (key != null) ? key : ""; string [] v = table[key]; result[k] = v; } catch { continue; } } } return(result); }
convert_to_proxy_XenRefVIF_string(Dictionary <XenRef <VIF>, string> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef <VIF> key in table.Keys) { try { string k = (key != null) ? key : ""; string v = (table[key] != null) ? table[key] : ""; result[k] = v; } catch { continue; } } } return(result); }
internal static Hashtable convert_to_proxy_long_string_array(Dictionary<long, string[]> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (long key in table.Keys) { try { string k = key.ToString(); string [] v = table[key]; result[k] = v; } catch { continue; } } } return result; }
internal static Hashtable convert_to_proxy_XenRefVIF_XenRefNetwork(Dictionary<XenRef<VIF>, XenRef<Network>> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef<VIF> key in table.Keys) { try { string k = (key != null) ? key : ""; string v = (table[key] != null) ? table[key] : ""; result[k] = v; } catch { continue; } } } return result; }
internal static Hashtable convert_to_proxy_XenRefVGPU_type_long(Dictionary<XenRef<VGPU_type>, long> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef<VGPU_type> key in table.Keys) { try { string k = (key != null) ? key : ""; string v = table[key].ToString(); result[k] = v; } catch { continue; } } } return result; }
internal static Hashtable convert_to_proxy_XenRefHost_string_array(Dictionary<XenRef<Host>, string[]> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef<Host> key in table.Keys) { try { string k = (key != null) ? key : ""; string [] v = table[key]; result[k] = v; } catch { continue; } } } return result; }
internal static Hashtable convert_to_proxy_vm_operations_string(Dictionary<vm_operations, string> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (vm_operations key in table.Keys) { try { string k = vm_operations_helper.ToString(key); string v = (table[key] != null) ? table[key] : ""; result[k] = v; } catch { continue; } } } return result; }
public CookComputing.XmlRpc.XmlRpcStruct toXmlRpc(bool avecLectureSeule) { object val; object dummyObj; CookComputing.XmlRpc.XmlRpcStruct retour; retour = new CookComputing.XmlRpc.XmlRpcStruct(); List <System.Reflection.PropertyInfo> listProprietesRel; List <System.Reflection.PropertyInfo> listProprietesEnum; listProprietesRel = listeProprieteRelationnelles(); listProprietesEnum = listeProprieteEnum(); System.Reflection.FieldInfo libEnum; try { foreach (System.Reflection.PropertyInfo prop in listProprietesRel) { val = prop.GetValue(this, null); if (val != null) { dummyObj = null; if (val.GetType() == typeof(models.fields.relations.manyToMany)) { dummyObj = ((models.fields.relations.manyToMany)(val)).toXmlRpc(); } if (val.GetType() == typeof(models.fields.relations.oneToMany)) { dummyObj = ((models.fields.relations.oneToMany)(val)).toXmlRpc(); } if (val.GetType() == typeof(models.fields.relations.manyToOne)) { dummyObj = ((models.fields.relations.manyToOne)(val)).toXmlRpc(); } if (dummyObj != null) { retour.Add(prop.Name, dummyObj); } } } foreach (System.Reflection.PropertyInfo prop in listProprietesEnum) { val = prop.GetValue(this, null); if ((val != null) && (val.ToString() != "")) { if ((val.ToString() != "NULL")) { if ((val.ToString() == "_EMPTY_")) { retour.Add(prop.Name, 0); } else { libEnum = this.GetType().GetField(("_frv_" + prop.Name), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static); retour.Add(prop.Name, ((System.Array)(libEnum.GetValue(this))).GetValue((int)prop.GetValue(this, null))); } } } } CookComputing.XmlRpc.XmlRpcStruct varStd; varStd = _listePropriete.toArray(); foreach (string key in varStd.Keys) { System.Reflection.PropertyInfo prop = this.GetType().GetProperty(key); if (prop != null) { if (avecLectureSeule || prop.CanWrite) { retour.Add(key, varStd[key]); } } } } catch { throw new Systeme.exceptionOpenERP(IMDEV.OpenERP.Systeme.exceptionOpenERP.ERRORS.ERROR_READING_VALUES); } return(retour); }
internal static Hashtable convert_to_proxy_XenRefVM_Dictionary_string_string(Dictionary<XenRef<VM>, Dictionary<string, string>> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (XenRef<VM> key in table.Keys) { try { string k = (key != null) ? key : ""; Object v = Maps.convert_to_proxy_string_string(table[key]); result[k] = v; } catch { continue; } } } return result; }
public void copyData(CookComputing.XmlRpc.XmlRpcStruct source) { bool change = true; List <System.Reflection.PropertyInfo> listePropriete; List <System.Reflection.PropertyInfo> listeProprietesEnum; listePropriete = listeProprieteRelationnelles(); // On copie d'abord les valeurs des champs relationnelles (m2o, o2m, m2m) while (change) { change = false; foreach (string key in source.Keys) { foreach (System.Reflection.PropertyInfo prop in listePropriete) { if (prop.Name.Trim().ToLower() == key.Trim().ToLower()) { if (source[key].GetType() != typeof(bool)) { if (prop.GetValue(this, null).GetType() == typeof(models.fields.relations.manyToOne)) { if (source[key].GetType() == typeof(int)) { ((models.fields.relations.manyToOne)(prop.GetValue(this, null))).copyData((int)source[key]); } else { ((models.fields.relations.manyToOne)(prop.GetValue(this, null))).copyData((Array)source[key]); } } else if (prop.GetValue(this, null).GetType() == typeof(models.fields.relations.oneToMany)) { ((models.fields.relations.oneToMany)(prop.GetValue(this, null))).copyData((Array)source[key]); } else if (prop.GetValue(this, null).GetType() == typeof(models.fields.relations.manyToMany)) { ((models.fields.relations.manyToMany)(prop.GetValue(this, null))).copyData((Array)source[key]); } } change = true; source.Remove(key); break; } } if (change) { break; } } } listeProprietesEnum = listeProprieteEnum(); change = true; while (change) { change = false; foreach (string key in source.Keys) { if (source[key].GetType() != typeof(bool)) { foreach (System.Reflection.PropertyInfo prop in listeProprietesEnum) { if (prop.Name.Trim().ToLower() == key.Trim().ToLower()) { setEnum(prop, source[key].ToString()); change = true; source.Remove(key); break; } } if (change) { break; } } } } // On copie ensuite le reste (int, string, etc...) _listePropriete.copyData(source); }
protected virtual void OnAcceptButtonClicked(object sender, System.EventArgs e) { Gtk.TreeIter iter; templateCombobox.GetActiveIter(out iter); llum.Core core = llum.Core.getCore(); string ret = ""; CookComputing.XmlRpc.XmlRpcStruct user_properties = new CookComputing.XmlRpc.XmlRpcStruct(); user_properties["uid"] = uidEntry.Text; user_properties["cn"] = nameEntry.Text; user_properties["sn"] = surnameEntry.Text; user_properties["userPassword"] = passwordEntry.Text; switch ((int)store.GetValue(iter, 1)) { case 0: //Students if (niaEntry.Text != "") { user_properties["x-lliurex-usertype"] = "itaca"; user_properties["x-lliurex-nia"] = niaEntry.Text; } else { user_properties["x-lliurex-usertype"] = "generic"; } ret = core.xmlrpc.add_user("Students", user_properties); if (ret.Contains("true:")) { msgLabel.Text = Mono.Unix.Catalog.GetString("User created successfully"); acceptButton.Sensitive = false; } else { msgLabel.Markup = "<span foreground='red'>" + Mono.Unix.Catalog.GetString("Error creating user: "******"</span>"; } break; case 1: //Teachers if (dniEntry.Text != "") { user_properties["x-lliurex-usertype"] = "itaca"; user_properties["x-lliurex-nif"] = dniEntry.Text; } else { user_properties["x-lliurex-usertype"] = "generic"; } ret = core.xmlrpc.add_user("Teachers", user_properties); if (ret.Contains("true:")) { msgLabel.Markup = "<b>" + Mono.Unix.Catalog.GetString("User created successfully") + "</b>"; acceptButton.Sensitive = false; } else { msgLabel.Markup = "<span foreground='red'>" + Mono.Unix.Catalog.GetString("Error creating user: "******"</span>"; } break; case 2: //Other if (dniEntry.Text != "") { user_properties["x-lliurex-nif"] = dniEntry.Text; } user_properties["x-lliurex-usertype"] = "generic"; ret = core.xmlrpc.add_user("Others", user_properties); if (ret.Contains("true:")) { msgLabel.Text = Mono.Unix.Catalog.GetString("User created successfully"); acceptButton.Sensitive = false; } else { msgLabel.Markup = "<span foreground='red'>" + Mono.Unix.Catalog.GetString("Error creating user: "******"</span>"; } break; default: break; } if (ret.Contains("true:")) { Gtk.TreeIter iter2; groupCombobox.GetActiveIter(out iter2); switch ((int)groups_store.GetValue(iter2, 1)) { case 1: try { Console.WriteLine("5"); core.xmlrpc.add_to_group((string)user_properties["uid"], (string)groups_store.GetValue(iter2, 0)); } catch { } break; default: break; } } }
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); } }
internal static Hashtable convert_to_proxy_string_vm_operations(Dictionary<string, vm_operations> table) { CookComputing.XmlRpc.XmlRpcStruct result = new CookComputing.XmlRpc.XmlRpcStruct(); if (table != null) { foreach (string key in table.Keys) { try { string k = (key != null) ? key : ""; string v = vm_operations_helper.ToString(table[key]); result[k] = v; } catch { continue; } } } return result; }