public static Form Load(Guid id) { Form result; try { Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (SorentoLib.Services.Datastore.Get<XmlDocument> (DatastoreAisle, id.ToString ()).SelectSingleNode ("(//sform.form)[1]"))); result = new Form (); result._id = new Guid ((string)item["id"]); if (item.ContainsKey ("createtimestamp")) { result._createtimestamp = int.Parse ((string)item["createtimestamp"]); } if (item.ContainsKey ("updatetimestamp")) { result._updatetimestamp = int.Parse ((string)item["updatetimestamp"]); } if (item.ContainsKey ("title")) { result._title = (string)item["title"]; } if (item.ContainsKey ("emailto")) { result._emailto = (string)item["emailto"]; } if (item.ContainsKey ("emailfrom")) { result._emailfrom = (string)item["emailfrom"]; } if (item.ContainsKey ("emailsubject")) { result._emailsubject = (string)item["emailsubject"]; } if (item.ContainsKey ("emailbody")) { result._emailbody = (string)item["emailbody"]; } if (item.ContainsKey ("emailbodytype")) { result._emailbodytype = SNDK.Convert.StringToEnum<Enums.EmailBodyType> ((string)item["emailbodytype"]); } } catch (Exception exception) { // LOG: LogDebug.ExceptionUnknown SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "SFORM.FORM", exception.Message)); // EXCEPTION: Excpetion.FormLoad throw new Exception (string.Format (Strings.Exception.FormLoad, id.ToString ())); } return result; }
public static Form FromXmlDocument(XmlDocument xmlDocument) { Hashtable item; Form result; try { item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//sform.form)[1]"))); } catch { item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument); } if (item.ContainsKey ("id")) { try { result = Load (new Guid ((string)item["id"])); } catch { result = new Form (); result._id = new Guid ((string)item["id"]); } } else { // EXCEPTION: Exception.FormFromXMLDocument throw new Exception (Strings.Exception.FormFromXMLDocument); } if (item.ContainsKey ("createtimestamp")) { result._createtimestamp = int.Parse ((string)item["createtimestamp"]); } if (item.ContainsKey ("updatetimestamp")) { result._updatetimestamp = int.Parse ((string)item["updatetimestamp"]); } if (item.ContainsKey ("title")) { result._title = (string)item["title"]; } if (item.ContainsKey ("emailto")) { result._emailto = (string)item["emailto"]; } if (item.ContainsKey ("emailfrom")) { result._emailfrom = (string)item["emailfrom"]; } if (item.ContainsKey ("emailsubject")) { result._emailsubject = (string)item["emailsubject"]; } if (item.ContainsKey ("emailbody")) { result._emailbody = (string)item["emailbody"]; } if (item.ContainsKey ("emailbodytype")) { result._emailbodytype = SNDK.Convert.StringToEnum<Enums.EmailBodyType> ((string)item["emailbodytype"]); } return result; }