public string GetUrlContents(string url, string header, string userAgent, Functions.LogMessageDelegate LogMessage) { string result = string.Empty; IWebObjectStorage objectStorage = new WebObjectStorageFileSystem(_webObjectRoot); WebObject cached = objectStorage.GetUrlObject(url); if (cached != null) { result = cached.Content; } else { result = WebProcessor.GetUrlContents(url, header, userAgent, LogMessage); if (!Functions.IsEmptyString(result)) { cached = new WebObject() { Url = url, Content = result, MimeType = "text/html" }; objectStorage.SetUrlObject(cached); } } return(result); }
public WebObject GetUrlObject(string url) { WebObject result = null; string pathToObject = WebObjectPathAndName(_root, url); if (File.Exists(pathToObject)) { result = Functions.DeserializeObjectFromFile <WebObject>(pathToObject); } return(result); }
public void SetUrlObject(WebObject urlObject) { string pathToObject = WebObjectPathAndName(_root, urlObject.Url); string fullPath = Path.GetDirectoryName(pathToObject); if (!Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); } try { Functions.SerializeObjectToFile <WebObject>(pathToObject, urlObject); } catch { // Crap! } }
void Result(WebObject value) { UnityEngine.Debug.Log(value.user.email); }
void Result(WebObject webres) { UnityEngine.Debug.Log("Id: " + webres.user.id); _register.AddRegisterValue("webId", webres.user.id, false); }
public static string HMaskRuleSave(WebObject trn, string tab, string sdtname) { StringBuilder ret = new StringBuilder(); Artech.Common.Collections.IBaseCollection<RowElement> rows = GetRows(trn, tab); foreach (RowElement row in rows) { foreach (ColumnElement col in row.Columns) { foreach (IHPatternInstanceElement item in col.Items) { if (item is AttributeElement) { AttributeElement att = (AttributeElement)item; if (att.UnmaskedValue && !String.IsNullOrEmpty(att.MaskPicture)) { if (att.Attribute.Type == eDBType.CHARACTER || att.Attribute.Type == eDBType.VARCHAR || att.Attribute.Type == eDBType.LONGVARCHAR) { ret.AppendLine(String.Format("HMask2UnmaskedValue.Call({0},'{1}',{0}) On BeforeValidate;", att.AttributeName, att.UnmaskedChars)); } } } if (item is VariableElement) { VariableElement att = (VariableElement)item; if (att.UnmaskedValue && !String.IsNullOrEmpty(att.MaskPicture)) { if (att.Type == eDBType.CHARACTER || att.Type == eDBType.VARCHAR || att.Type == eDBType.LONGVARCHAR) { ret.AppendLine(String.Format("HMask2UnmaskedValue.Call(&{0},'{1}',&{0}) On BeforeValidate;", att.Name, att.UnmaskedChars)); } } } } } } return ret.ToString(); }
public static string TransactionActions(WebObject trn) { StringBuilder ret = new StringBuilder(); foreach (ActionElement act in trn.Actions) { ret.AppendLine(String.Format("Event '{0}'",act.Name)); ret.AppendLine(Indentation.Indent(act.EventCode,1)); ret.AppendLine("EndEvent"); ret.AppendLine(""); } if (trn.Instance.Settings.Template.GenerateCallBackLink) { ret.AppendLine(String.Format("Event '{0}'", "Fechar")); ret.AppendLine(Indentation.Indent(String.Format("If &{0}.IsEmpty()",HPatternInstance.PARMCALLBACK), 1)); ret.AppendLine(Indentation.Indent("Return", 2)); ret.AppendLine(Indentation.Indent("Else", 1)); ret.AppendLine(Indentation.Indent(String.Format("PrLinkCallBack(&{0})", HPatternInstance.PARMCALLBACK), 2)); ret.AppendLine(Indentation.Indent("EndIf", 1)); ret.AppendLine("EndEvent"); ret.AppendLine(""); } return ret.ToString(); }
public static string HMaskEventStart(WebObject trn, string tab, bool bc) { StringBuilder ret = new StringBuilder(); Artech.Common.Collections.IBaseCollection<RowElement> rows = GetRows(trn, tab); foreach (RowElement row in rows) { foreach (ColumnElement col in row.Columns) { foreach (IHPatternInstanceElement item in col.Items) { if (item is AttributeElement) { AttributeElement att = (AttributeElement)item; if (!String.IsNullOrEmpty(att.MaskPicture)) { ret.AppendLine(String.Format("{0}HMask.AttachControl = {1}{0}.InternalName", att.AttributeName,(bc ? "ctl":""))); } } if (item is VariableElement) { VariableElement att = (VariableElement)item; if (!String.IsNullOrEmpty(att.MaskPicture)) { ret.AppendLine(String.Format("{0}HMask.AttachControl = &{0}.InternalName", att.Name)); } } } } } return ret.ToString(); }
public static string HMaskEventStart(WebObject trn, string tab) { return HMaskEventStart(trn, tab, true); }
public static IBaseCollection<RowElement> GetRows(WebObject trn, string tab) { return GetRows(trn,tab,false,false); }
public static IBaseCollection<RowElement> GetRows(WebObject trn, string tab,bool GridFreeStyle,bool GridStandard) { return GetRowsPP(trn, tab, GridFreeStyle,GridStandard,trn); }
private static IBaseCollection<RowElement> GetRowsPP(WebObject trn, string tab, bool GridFreeStyle, bool GridStandard, WebObject trni) { // GetRows++ a revolta dos Rows :) IBaseCollection<RowElement> rows = new BaseCollection<RowElement>(); if (String.IsNullOrEmpty(tab)) { foreach (IHPatternInstanceElement i in trn.Form.Items) { if (i is RowElement) { RowElement row = (RowElement)i; GetRowsAllTabsPP(rows, row, GridFreeStyle, GridStandard, trni); } if (i is TabFormElement) { TabFormElement tabe = (TabFormElement)i; foreach (RowElement row in tabe.Rows) { GetRowsAllTabsPP(rows, row, GridFreeStyle, GridStandard, trni); } } } } else { foreach (TabFormElement tabe in trn.Form.Tabs) { if (tabe.Name == tab) { foreach (RowElement row in tabe.Rows) { GetRowsAllTabsPP(rows, row, GridFreeStyle, GridStandard, trni); } } } if (rows.Count == 0) { if (trn.Form.Rows == null) { foreach (TabFormElement tabe in trn.Form.Tabs) { foreach (RowElement row in tabe.Rows) { GetRowsAllTabsPP(rows, row, GridFreeStyle, GridStandard, trni); } } } else { if (trn.Form.Rows.Count > 0) { foreach (RowElement row in trn.Form.Rows) { GetRowsAllTabsPP(rows, row, GridFreeStyle, GridStandard, trni); } } else { foreach (TabFormElement tabe in trn.Form.Tabs) { foreach (RowElement row in tabe.Rows) { GetRowsAllTabsPP(rows, row, GridFreeStyle, GridStandard, trni); } } } } } } return rows; }