/// <summary> /// Returns a string that can be diaplayed in a report from a raw string data, /// handling date formatting and magic strings/numbers/codes. /// </summary> /// <param name="data"></param> /// <param name="field"></param> /// <param name="user"></param> /// <returns></returns> private string AsDisplayableData(string data, IApplicationDisplayable field, InMemoryUser user) { DateTime dtTimeAux; var formatToUse = "dd/MM/yyyy HH:mm"; if (field.RendererParameters.ContainsKey("format")) { formatToUse = field.RendererParameters["format"]; } var dateParsed = DateTime.TryParse(data, out dtTimeAux); var dataToCell = data; if (dateParsed) { dataToCell = dtTimeAux.FromMaximoToUser(user).ToString(formatToUse); } if (dataToCell == "-666") { //this magic number should never be displayed! //hack to make the grid sortable on unions, where we return this -666 instead of null, but then remove this from screen! dataToCell = ""; } return(dataToCell); }
private static void OverrideReferenceValues(ApplicationSchemaDefinition schema, ReferenceDisplayable reference, IApplicationDisplayable applicationDisplayable) { if (reference.ShowExpression != null) { applicationDisplayable.ShowExpression = GetPropertyValue(schema, reference, reference.ShowExpression); } if (reference.EnableExpression != null) { applicationDisplayable.EnableExpression = GetPropertyValue(schema, reference, reference.EnableExpression); } if (reference.Label != null) { ((IApplicationAttributeDisplayable)applicationDisplayable).Label = GetPropertyValue(schema, reference, reference.Label); } if (reference.Attribute != null) { ((IApplicationAttributeDisplayable)applicationDisplayable).Attribute = GetPropertyValue(schema, reference, reference.Attribute); } if (reference.ReadOnly != null) { applicationDisplayable.ReadOnly = reference.ReadOnly; } }