GetProviders() public method

Gets the providers.
public GetProviders ( ) : DataTable
return System.Data.DataTable
Beispiel #1
0
        /// <summary>
        /// Upsert provider.
        /// </summary>
        /// <param name="queue">The queue.</param>
        /// <param name="providerXML">The provider XML.</param>
        /// <returns></returns>
        public bool UpSertProvider(string queue, string providerXML)
        {
            StringWriter decodedXML = new StringWriter();
            // Decode the encoded string.
            HttpUtility.HtmlDecode(providerXML, decodedXML);

            bool success = false;
            DataTable pTable = new DataTable();
            Atul_v1Data adb = new Atul_v1Data();
            pTable = adb.GetProviders();

            XmlDocument pXML = new XmlDocument();
            pXML.LoadXml(decodedXML.ToString());

            XmlNodeList submittedProviders = pXML.SelectNodes(@"//endpoint/provider");
            foreach (XmlNode xn in submittedProviders)
            {
                int ModifiedBy = -1;
                string xmlproviderName = xn["name"].InnerText;
                string xmlclassid = xn["classid"].InnerText;

                string xmlDescription = xn["description"].InnerText;
                //To insert or update, that is the question. We'll add the queue check in when the db gets sorted.
                DataRow providerRow = adb.GetProviderBySearch(xmlproviderName, Convert.ToInt32(xmlclassid), queue);
                string ServiceProviderXML = xn.OuterXml;
                if (providerRow != null)
                {
                    long AtulServiceProviderID = Convert.ToInt64(providerRow["AtulServiceProviderID"]);
                    int AtulServiceProviderClassID = Convert.ToInt32(Convert.ToInt32(xmlclassid));
                    success = adb.UpdateProvider(AtulServiceProviderID, xmlproviderName, xmlDescription, AtulServiceProviderClassID, queue, ModifiedBy, ServiceProviderXML);
                }
                else
                {
                    //insert provider
                    success = adb.InsertProvider(xmlproviderName, xmlDescription, Convert.ToInt32(xmlclassid), queue, ModifiedBy, ServiceProviderXML);
                }
            }
            return success;
        }
Beispiel #2
0
 /// <summary>
 /// Gets the providers.
 /// </summary>
 /// <returns></returns>
 public string GetProviders()
 {
     DataSet dsProviders = new DataSet("providers");
     DataTable returnTable = new DataTable();
     Atul_v1Data adb = new Atul_v1Data();
     returnTable = adb.GetProviders();
     dsProviders.Tables.Add(returnTable);
     XmlDocument doc = new XmlDocument();
     doc.LoadXml(dsProviders.GetXml());
     // Convert XML to a JSON string
     string JSON = JsonMethods.XmlToJSON(doc);
     return JSON;
 }