/// <summary> /// ViewRealTimeData is a request to the ERP system for real time viewing data from the ERP system. /// </summary> /// <param name="queryFields">An array of query fields that represent the parameters needed for the request.</param> /// <param name="config">the configuration object</param> /// <returns>The response to ViewRealTimeData is a XmlDocument, which contains a list of real time data.</returns> public ViewRealTimeDataResult ViewRealTimeData(string entityName, string[] selectFields, SearchField[] searchFields, string[] orderFields, int rowsPerPage, int pageNumber, NorthwindConfig northwindConfig) { // declarations RTDVBase rdtv; rdtv = RTDVFactory.GetRTDV(entityName); if (rdtv == null) { throw new Exception(string.Format(Resources.ErrorMessages_RTDVNotImplemented, entityName)); } if (orderFields == null) { orderFields = new string[0]; } if (searchFields == null) { searchFields = new SearchField[0]; } if (selectFields == null) { selectFields = new string[0]; } ViewRealTimeDataResult result = new ViewRealTimeDataResult(); result.RealTimeData = rdtv.ViewRealTimeData(entityName, selectFields, searchFields, orderFields, rowsPerPage, pageNumber, northwindConfig); return(result); }
/// <summary> /// GetConfiguration is called after GetAuthentication when a new integration is created. /// It is also called when an integration is enabled. /// GetConfiguration is a request to the ERP system for configuration information. /// This will be used to populate the configuration area of the integration in CRM. /// </summary> /// <returns>The ERP system responds with a GetConfigurationResponse. /// GetConfigurationResponse contains a Configuration structure. /// The contents of a Configuration structure are: /// • Version – The version of the contract supported. /// The version supported in the 6.0.1 release is version 1.0. /// • Product Name – The name of the ERP system, eg MAS200, Line 50. /// • ERP Schema – This is a complex type used to feed back /// the xsd for the webservices interface. /// The xsd must conform to the specification defined by sage CRM. /// </returns> public Configuration GetConfiguration(NorthwindConfig nwConfig) { string schemastring; List <Document> documents = EntityFactory.GetSupportedDocumentTemplates(); Configuration config = new Configuration(); config.ProductName = "Northwind"; config.SchemaVersion = nwConfig.Version; XmlDocument xmlDoc = new XmlDocument(); XmlSchema schema = new XmlSchema(); schema.ElementFormDefault = XmlSchemaForm.Qualified; schema.TargetNamespace = "http://schemas.sage.com/sis/Northwind/2007/05/Synch"; //schema.Namespaces.Add("xs", XmlSchema.Namespace); schema.Namespaces.Add("tns", schema.TargetNamespace); foreach (Document doc in documents) { schema.Items.Add(doc.GetSchemaElement()); } schemastring = XmlSerializationHelpers.SerializeObjectToXml(schema); xmlDoc.LoadXml(schemastring); config.SyncSchema = xmlDoc.DocumentElement; #region RTDV // create and initialize rtdv schema schema = new XmlSchema(); schema.Id = "RTDV"; schema.TargetNamespace = "http://schemas.sage.com/sis/Northwind/2007/05/RTDV"; schema.ElementFormDefault = XmlSchemaForm.Qualified; schema.Namespaces.Add("mstns", schema.TargetNamespace); // append elements to schema RTDVBase[] rtdvArray = RTDVFactory.GetRTDVAll(); // get instances of all RTDVs foreach (RTDVBase rtdv in rtdvArray) // iterate through all RTDVs and get their schema element { schema.Items.Add(rtdv.GetXmlSchemaElement()); // append schema element to rtdv schema } xmlDoc = new XmlDocument(); schemastring = XmlSerializationHelpers.SerializeObjectToXml(schema); xmlDoc.LoadXml(schemastring); config.RTDSchema = xmlDoc.DocumentElement; // set rtdv schema to config #endregion return(config); }