//-------------------------------------------------------------------------------------- public string ParseFieldArray(Enum arrayfieldName, Enum fieldName, XmlRpcStruct parentStruct) { try { if ((parentStruct[StringEnum.StrVal(arrayfieldName)] as object[]).Length > 0) { if ((((parentStruct[StringEnum.StrVal(arrayfieldName)] as object[]) [0] as XmlRpcStruct)) != null) { return (((parentStruct[StringEnum.StrVal(arrayfieldName)] as object[]) [0] as XmlRpcStruct)[StringEnum.StrVal(fieldName)].ToString()); } } return(""); } catch { //errorMessage("Unable to read " + arrayfieldName.ToString()); handleExeption(new Exception("Unable to read " + arrayfieldName.ToString()), "ParseFieldArray"); return(""); } }
private bool loadUserFields(XmlRpcStruct getUserNode) { if (getUserNode != null) { try { _uid = Convert.ToInt32(getUserNode[StringEnum.StrVal(Enums.UserHTMLField.UserID)]); this._name = getUserNode[StringEnum.StrVal(Enums.UserHTMLField.AuthorName)].ToString(); //setUserOrganicGroup(getUserNode); // Load permission roles of the user XmlRpcStruct rolesStruct = (getUserNode[StringEnum.StrVal(Enums.UserHTMLField.Roles)] as XmlRpcStruct); if (rolesStruct != null) { roles.Clear(); foreach (System.Collections.DictionaryEntry rol in rolesStruct) { this.roles.Add(new Role(Convert.ToInt32(rol.Key), (Enums.Roles)StringEnum.Parse(typeof(Enums.Roles), rol.Value.ToString()))); } } return(true); } catch (Exception ex) { sendLogEvent(ex.Message, "User", Enums.MessageType.Error); return(false); } } else { return(false); } }
public string ParseField(Enum fieldName, XmlRpcStruct nodeStruct) { try { //if ((nodeStruct[StringEnum.StrVal(fieldName)] != null)) return(nodeStruct[StringEnum.StrVal(fieldName)].ToString()); } catch (Exception ex) { //errorMessage(ex.Message); handleExeption(ex, "ParseField"); return(""); } }
public string ParseField(Enum fieldName, XmlRpcStruct nodeStruct, int arrayIndex) { try { //if ((nodeStruct[StringEnum.StrVal(fieldName)] != null)) return(((nodeStruct[StringEnum.StrVal(fieldName)] as object[]) [arrayIndex] as XmlRpcStruct)["value"].ToString()); //((nodeStruct[StringEnum.StrVal(fieldName)]as object[])[0] as XmlRpcStruct)["value"].ToString() } catch (Exception ex) { //errorMessage(ex.Message); handleExeption(ex, "ParseField"); return(""); } }
private bool setUserOrganicGroup(XmlRpcStruct xmlStruc) { try { this.OrganicGroups.Clear(); XmlRpcStruct groups = (xmlStruc[StringEnum.StrVal(Enums.HTMLField.Group)] as XmlRpcStruct); if (groups != null) { foreach (XmlRpcStruct values in groups.Values) { try { bool isAdmin = false; if (values["is_admin"].ToString() == "1") { isAdmin = true; } int og_id = Convert.ToInt32(values["nid"]); OrganicGroup group; group = new OrganicGroup(og_id, values["title"].ToString(), isAdmin, _servicesCon); group.LoadVocabulary(); this.OrganicGroups.Add(group); } catch (Exception ex) { sendLogEvent("Cant find vocabulary: " + ex.Message, "User", Enums.MessageType.Error); return(false); } } } return(true); } catch (Exception e) { sendLogEvent("Can't parse organic group: " + e.Message, "User", Enums.MessageType.Error); return(false); } }
private bool AddFormFile(LibCurl.MultiPartForm mf, string fileName, Enums.HTMLField field) { return(AddFormFile(mf, fileName, StringEnum.StrVal(field))); }