public static string SerializeWorkItemProgress(WorkItemProgress data) { return(JsmlSerializer.Serialize(data, "data", new JsmlSerializer.SerializeOptions { Hook = _workItemProgressHook, DataContractTest = IsWorkItemProgressContract })); }
public static WorkItemProgress DeserializeWorkItemProgress(string data) { return(JsmlSerializer.Deserialize <WorkItemProgress>(data, new JsmlSerializer.DeserializeOptions { Hook = _workItemProgressHook, DataContractTest = IsWorkItemProgressContract })); }
public static WorkItemRequest DeserializeWorkItemRequest(string data) { return(JsmlSerializer.Deserialize <WorkItemRequest>(data, new JsmlSerializer.DeserializeOptions { Hook = _workItemRequestHook, DataContractTest = IsWorkItemRequestContract })); }
public void Test_DataContract_non_public_constructor() { var jsml = JsmlSerializer.Serialize(new TestContract3("foo"), "data"); var obj = JsmlSerializer.Deserialize <TestContract3>(jsml); Assert.AreEqual("foo", obj.Value); }
public string GetOperationNames(string serviceContractName) { string[] names = null; Platform.GetService <IJsmlShimService>( service => names = service.GetOperationNames(new GetOperationNamesRequest(serviceContractName)).OperationNames); return(JsmlSerializer.Serialize(names, "operationNames")); }
public static void ImportSettingsDefinition(ISettingsStore store, string dataFileOrFolderPath, bool overwrite) { // determine list of source files to import var fileList = new List <string>(); if (File.Exists(dataFileOrFolderPath)) { fileList.Add(dataFileOrFolderPath); } else if (Directory.Exists(dataFileOrFolderPath)) { fileList.AddRange(Directory.GetFiles(dataFileOrFolderPath, "*.xml")); } else { throw new ArgumentException(string.Format("{0} is not a valid data file or directory.", dataFileOrFolderPath)); } Platform.Log(LogLevel.Info, "Loading settings from {0}...", dataFileOrFolderPath); var configurations = from file in fileList let xml = File.ReadAllText(file) from config in JsmlSerializer.Deserialize <SettingDefinition[]>(xml) select config; ImportSettingsDefinition(store, configurations, overwrite); }
/// <summary> /// Import authority groups defined in XML files located at the specified path. /// </summary> /// <param name="dataFileOrFolderPath"></param> public static void ImportAuthorityGroups(string dataFileOrFolderPath) { // determine list of source files to import var fileList = new List <string>(); if (File.Exists(dataFileOrFolderPath)) { fileList.Add(dataFileOrFolderPath); } else if (Directory.Exists(dataFileOrFolderPath)) { fileList.AddRange(Directory.GetFiles(dataFileOrFolderPath, "*.xml")); } else { throw new ArgumentException(string.Format("{0} is not a valid data file or directory.", dataFileOrFolderPath)); } var authGroups = from file in fileList let xml = File.ReadAllText(file) from authGroup in JsmlSerializer.Deserialize <AuthorityGroupDefinition[]>(xml) select authGroup; ImportAuthorityGroups(authGroups, dataFileOrFolderPath); }
public static string SerializeServerExtensionData(Dictionary <string, object> serverExtensionData) { return(JsmlSerializer.Serialize(serverExtensionData, "data", new JsmlSerializer.SerializeOptions { Hook = _serverExtensionDataHook, DataContractTest = IsServerExtensionDataContract })); }
public static string SerializeWorkItemRequest(WorkItemRequest data) { return(JsmlSerializer.Serialize(data, "data", new JsmlSerializer.SerializeOptions { Hook = _workItemRequestHook, DataContractTest = IsWorkItemRequestContract })); }
public static Dictionary <string, object> DeserializeServerExtensionData(string data) { return(JsmlSerializer.Deserialize <Dictionary <string, object> >(data, new JsmlSerializer.DeserializeOptions { Hook = _serverExtensionDataHook, DataContractTest = IsServerExtensionDataContract })); }
/// <summary> /// Invokes the specified operation on the specified service contract, passing the specified JSML-encoded request object. /// </summary> /// <param name="serviceContractTypeName"></param> /// <param name="operationName"></param> /// <param name="jsmlRequest"></param> /// <returns></returns> public static string InvokeOperation(string serviceContractTypeName, string operationName, string jsmlRequest) { Type contract = Type.GetType(serviceContractTypeName); MethodInfo operation = contract.GetMethod(operationName); ParameterInfo[] parameters = operation.GetParameters(); if (parameters.Length != 1) { throw new InvalidOperationException("Can only invoke methods with exactly one input parameter."); } object service = null; try { service = Platform.GetService(contract); object innerRequest = JsmlSerializer.Deserialize(parameters[0].ParameterType, jsmlRequest); object innerResponse = operation.Invoke(service, new object[] { innerRequest }); return(JsmlSerializer.Serialize(innerResponse, "responseData")); } finally { if (service != null && service is IDisposable) { (service as IDisposable).Dispose(); } } }
/// <summary> /// Import authority groups defined in XML files located at the specified path. /// </summary> /// <param name="dataFileOrFolderPath"></param> public static void ImportUsers(string dataFileOrFolderPath) { // determine list of source files to import var fileList = new List <string>(); if (File.Exists(dataFileOrFolderPath)) { fileList.Add(dataFileOrFolderPath); } else if (Directory.Exists(dataFileOrFolderPath)) { fileList.AddRange(Directory.GetFiles(dataFileOrFolderPath, "*.xml")); } else { throw new ArgumentException(string.Format("{0} is not a valid data file or directory.", dataFileOrFolderPath)); } Platform.Log(LogLevel.Info, "importing users from {0} files", fileList.Count); var users = from file in fileList let xml = File.ReadAllText(file) from user in JsmlSerializer.Deserialize <UserDefinition[]>(xml) select user; ImportUsers(users, dataFileOrFolderPath); }
public static string SerializeExternalQueryResult(ImageServerExternalQueryResult data) { return(JsmlSerializer.Serialize(data, "ImageServerExternalQueryResult", new JsmlSerializer.SerializeOptions { Hook = ExternalQueryHook, DataContractTest = IsImageServerExternalQueryContract })); }
public static ImageServerExternalQuery DeserializeExternalQuery(XmlDocument data) { return(JsmlSerializer.Deserialize <ImageServerExternalQuery>(data, new JsmlSerializer.DeserializeOptions { Hook = ExternalQueryHook, DataContractTest = IsImageServerExternalQueryContract })); }
public static ImageServerNotification DeserializeNotification(XmlDocument data) { return(JsmlSerializer.Deserialize <ImageServerNotification>(data, new JsmlSerializer.DeserializeOptions { Hook = ExternalRequestHook, DataContractTest = IsImageServerExternalRequestContract })); }
public static string SerializeNotification(ImageServerNotification data) { return(JsmlSerializer.Serialize(data, "ImageServerNotification", new JsmlSerializer.SerializeOptions { Hook = ExternalRequestHook, DataContractTest = IsImageServerExternalRequestContract })); }
/// <summary> /// Writes the specified data to the specified xml writer. /// </summary> /// <param name="writer"></param> /// <param name="data"></param> private static void Write(XmlWriter writer, object data) { // bug #5300: do not write out the "Unique" flag anymore var options = new JsmlSerializer.SerializeOptions { DataMemberTest = (m => AttributeUtils.HasAttribute <DataMemberAttribute>(m) && m.Name != "Unique") }; JsmlSerializer.Serialize(writer, data, data.GetType().Name, options); }
public static WorkQueueUidData DeserializeWorkQueueUidData(XmlDocument data) { return(JsmlSerializer.Deserialize <WorkQueueUidData>(data, new JsmlSerializer.DeserializeOptions { Hook = WorkItemDataHook, DataContractTest = IsWorkQueueDataContract, DataMemberTest = IsXmlSerializationDataMember })); }
public static ImageServerExternalRequestState DeserializeExternalRequestState(string data) { return(JsmlSerializer.Deserialize <ImageServerExternalRequestState>(data, new JsmlSerializer.DeserializeOptions { Hook = ExternalRequestHook, DataContractTest = IsImageServerExternalRequestContract })); }
public static ImageServerExternalQueryResult DeserializeExternalQueryResult(string data) { return(JsmlSerializer.Deserialize <ImageServerExternalQueryResult>(data, new JsmlSerializer.DeserializeOptions { Hook = ExternalQueryHook, DataContractTest = IsImageServerExternalQueryContract })); }
public static string SerializeWorkQueueUidData(WorkQueueUidData data) { return(JsmlSerializer.Serialize(data, "WorkQueueUidData", new JsmlSerializer.SerializeOptions { Hook = WorkItemDataHook, DataContractTest = IsWorkQueueDataContract, DataMemberTest = IsXmlSerializationDataMember })); }
/// <summary> /// Parses soft keys XML document. /// </summary> private static List <SoftKeyData> LoadSoftKeys(string softKeysXml) { if (string.IsNullOrEmpty(softKeysXml)) { return(new List <SoftKeyData>()); } var data = JsmlSerializer.Deserialize <SoftKeysData>(softKeysXml); return(data.SoftKeys); }
/// <summary> /// Parses templates XML document. /// </summary> private static List <TemplateData> LoadTemplates(string templatesXml) { if (string.IsNullOrEmpty(templatesXml)) { return(new List <TemplateData>()); } var templatesData = JsmlSerializer.Deserialize <TemplatesData>(templatesXml); return(templatesData.Templates); }
protected override void SetTag(string tag, string data) { if (string.Equals("Allergies", tag)) { this.Allergies.Clear(); this.Allergies.AddRange(JsmlSerializer.Deserialize <List <PatientAllergyDetail> >(data)); return; } base.SetTag(tag, data); }
protected override void SetTag(string tag, string data) { // the page uses SetTag to indicate that the check state has changed var checkStates = JsmlSerializer.Deserialize <List <bool> >(data); for (var i = 0; i < _context.OrderNotes.Count; i++) { _context.OrderNotes[i].WillAcknowledge = checkStates[i]; } EventsHelper.Fire(_checkedItemsChanged, this, EventArgs.Empty); }
/// <summary> /// Log the specified operation. /// </summary> /// <param name="operation">The name of the operation performed.</param> /// <param name="detailsDataContract">The audit message details.</param> private static void Log(string operation, object detailsDataContract) { if (LoginSession.Current == null) { return; } lock (_auditLog) { _auditLog.WriteEntry(operation, JsmlSerializer.Serialize(detailsDataContract, "Audit")); } }
/// <summary> /// Opens a pop up providing details on the specified practitioner /// (must be a JSML encoded <see cref="ExternalPractitionerSummary"/> object). /// </summary> /// <param name="jsml"></param> /// <returns></returns> public void OpenPractitionerDetail(string jsml) { var practitionerSummary = JsmlSerializer.Deserialize <ExternalPractitionerSummary>(jsml); LaunchAsDialog( _component.Host.DesktopWindow, new ExternalPractitionerOverviewComponent() { PractitionerSummary = practitionerSummary }, SR.TitleExternalPractitioner + " - " + PersonNameFormat.Format(practitionerSummary.Name)); }
/// <summary> /// Formats the specified Procedure (must be a JSML encoded <see cref="ProcedureSummary"/> or <see cref="ProcedureDetail"/> object). /// </summary> /// <param name="jsml"></param> /// <returns></returns> public string FormatProcedureName(string jsml) { try { var procedureSummary = JsmlSerializer.Deserialize <ProcedureSummary>(jsml); return(procedureSummary == null ? "" : ProcedureFormat.Format(procedureSummary)); } catch (InvalidCastException) { var procedureDetail = JsmlSerializer.Deserialize <ProcedureDetail>(jsml); return(procedureDetail == null ? "" : ProcedureFormat.Format(procedureDetail)); } }
/// <summary> /// Attempts to resolve the specified search string to a staff (returns a JSML encoded <see cref="StaffSummary"/>. /// </summary> /// <param name="search"></param> /// <returns></returns> public string ResolveStaffName(string search) { StaffSummary staff; var lookupHandler = new StaffLookupHandler(_component.Host.DesktopWindow); var resolved = lookupHandler.ResolveName(search, out staff); // bug #2896: the name may "resolve" to nothing, so we still need to check if staff actually has a value if (!resolved || staff == null) { resolved = lookupHandler.ResolveNameInteractive(search, out staff); } return(resolved ? JsmlSerializer.Serialize(staff, "staff") : null); }
/// <summary> /// Formats the specified Staff (must be a JSML encoded <see cref="StaffSummary"/> or <see cref="StaffDetail"/> object). /// </summary> /// <param name="jsml"></param> /// <returns></returns> public string FormatStaffNameAndRole(string jsml) { try { var staffSummary = JsmlSerializer.Deserialize <StaffSummary>(jsml); return(staffSummary == null ? "" : StaffNameAndRoleFormat.Format(staffSummary)); } catch (InvalidCastException) { var staffDetail = JsmlSerializer.Deserialize <StaffDetail>(jsml); return(staffDetail == null ? "" : StaffNameAndRoleFormat.Format(staffDetail)); } }