help with .cs file on Apache

Discussion in 'Programming' started by Norvin, Nov 24, 2010.

  1. #1
    Hi all,

    A little help please

    I have .cs file

    See below.

    How do I get this to work ion an Apache or change it to perl?
    As I am a not familiar with XML or .cs sharp I need to either change this file to perl or get it to run on Apache server in order to extract the data from the client Mysql database.

    Any help appreciated

    Thanks
    *************************
    Code:using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Xml;

    namespace SupplierPubUsageExample
    {
    class Program
    {
    static private string sUsername = "username";
    static string sPassword = "password";
    static int iLastRefNum = 0;
    //static string wsUrl = "http://localhost:3906/domain/SupplierPub.asmx";
    static string wsUrl = "http://www.domain.co.uk/1stChoiceServices/SupplierPub.asmx";


    static void Main(string[] args)
    {
    //GetOrders(sUsername, sPassword, iLastRefNum);
    MakeQuote(sUsername, sPassword);
    }

    static void GetOrders(string Username, string Password, int LastRefNum)
    {
    string ReturnString = "";
    wsSupplier.SupplierPub ws = new wsSupplier.SupplierPub();
    ws.Url = wsUrl;

    ReturnString = ws.GetOrders(Username, Password, LastRefNum);
    List<OrderDetails> lOrders = ParseGetOrdersResult(ReturnString);
    }

    private class PartDetails
    {
    public string pid;
    public string pdsc;
    public string pcmt;

    public PartDetails(string pid, string pdsc, string pcmt)
    {
    this.pid = pid;
    this.pdsc = pdsc;
    this.pcmt = pcmt;
    }
    }

    private class OrderDetails
    {
    public string rfno;
    public string date;
    public string cdes;
    public string cmak;
    public string cran;
    public string cyer;
    public string cbdy;
    public string cbdt;
    public string cgbx;
    public string cfue;
    public string cvin;
    public string cenn;
    public string cccs;
    public string cclr;
    public string creg;
    public string unam;
    public string uloc;
    public string upos;
    public string uphn;
    public string umob;
    public string ueml;

    public List<PartDetails> lParts = new List<PartDetails>();
    }

    static List<OrderDetails> ParseGetOrdersResult(string ReturnString)
    {
    List<OrderDetails> lRet = new List<OrderDetails>();
    XmlDocument document = new XmlDocument();
    try
    {
    ReturnString = ReturnString.Replace("&", "&amp;");
    document.LoadXml(ReturnString);
    XmlNode root = document.DocumentElement;
    XmlNodeList xmlOrders = root.SelectNodes("descendant::rq");
    foreach (XmlNode order in xmlOrders)
    {
    lRet.Add(ParseOrderXML(order));
    }
    }
    catch (Exception ex)
    {
    string str = ex.Message;
    //return error
    }

    return lRet;
    }

    static OrderDetails ParseOrderXML(XmlNode xmlOrder)
    {
    OrderDetails oRet = new OrderDetails();

    XmlNode xmlOrDet01 = xmlOrder.SelectSingleNode("descendant::rfno");
    oRet.rfno = xmlOrDet01.InnerText;
    XmlNode xmlOrDet02 = xmlOrder.SelectSingleNode("descendant::date");
    oRet.date = xmlOrDet02.InnerText;
    XmlNode xmlOrDet03 = xmlOrder.SelectSingleNode("descendant::cdes");
    oRet.cdes = xmlOrDet03.InnerText;
    XmlNode xmlOrDet04 = xmlOrder.SelectSingleNode("descendant::cmak");
    oRet.cmak = xmlOrDet04.InnerText;
    XmlNode xmlOrDet05 = xmlOrder.SelectSingleNode("descendant::cran");
    oRet.cran = xmlOrDet05.InnerText;
    XmlNode xmlOrDet06 = xmlOrder.SelectSingleNode("descendant::cyer");
    oRet.cyer = xmlOrDet06.InnerText;
    XmlNode xmlOrDet07 = xmlOrder.SelectSingleNode("descendant::cbdy");
    oRet.cbdy = xmlOrDet07.InnerText;
    XmlNode xmlOrDet08 = xmlOrder.SelectSingleNode("descendant::cbdt");
    oRet.cbdt = xmlOrDet08.InnerText;
    XmlNode xmlOrDet09 = xmlOrder.SelectSingleNode("descendant::cgbx");
    oRet.cgbx = xmlOrDet09.InnerText;
    XmlNode xmlOrDet10 = xmlOrder.SelectSingleNode("descendant::cfue");
    oRet.cfue = xmlOrDet10.InnerText;
    XmlNode xmlOrDet11 = xmlOrder.SelectSingleNode("descendant::cvin");
    oRet.cvin = xmlOrDet11.InnerText;
    XmlNode xmlOrDet12 = xmlOrder.SelectSingleNode("descendant::cenn");
    oRet.cenn = xmlOrDet12.InnerText;
    XmlNode xmlOrDet13 = xmlOrder.SelectSingleNode("descendant::cccs");
    oRet.cccs = xmlOrDet13.InnerText;
    XmlNode xmlOrDet14 = xmlOrder.SelectSingleNode("descendant::cclr");
    oRet.cclr = xmlOrDet14.InnerText;
    XmlNode xmlOrDet15 = xmlOrder.SelectSingleNode("descendant::creg");
    oRet.creg = xmlOrDet15.InnerText;
    XmlNode xmlOrDet16 = xmlOrder.SelectSingleNode("descendant::unam");
    oRet.unam = xmlOrDet16.InnerText;
    XmlNode xmlOrDet17 = xmlOrder.SelectSingleNode("descendant::uloc");
    oRet.uloc = xmlOrDet17.InnerText;
    XmlNode xmlOrDet18 = xmlOrder.SelectSingleNode("descendant::upos");
    oRet.upos = xmlOrDet18.InnerText;
    XmlNode xmlOrDet19 = xmlOrder.SelectSingleNode("descendant::uphn");
    oRet.uphn = xmlOrDet19.InnerText;
    XmlNode xmlOrDet20 = xmlOrder.SelectSingleNode("descendant::umob");
    oRet.umob = xmlOrDet20.InnerText;
    XmlNode xmlOrDet21 = xmlOrder.SelectSingleNode("descendant::ueml");
    oRet.ueml = xmlOrDet21.InnerText;

    XmlNodeList xmlParts = xmlOrder.SelectNodes("descendant::part");
    foreach (XmlNode xmlPart in xmlParts)
    {
    XmlNode xmlOrDet22 = xmlOrder.SelectSingleNode("descendant::pid");
    XmlNode xmlOrDet23 = xmlOrder.SelectSingleNode("descendant::pdsc");
    XmlNode xmlOrDet24 = xmlOrder.SelectSingleNode("descendant::pcmt");
    oRet.lParts.Add(new PartDetails(xmlOrDet22.InnerText, xmlOrDet23.InnerText, xmlOrDet24.InnerText));
    }

    return oRet;
    }

    static void MakeQuote(string Username, string Password)
    {
    string request = "<quot rfno=\"2068421\" delp=\"840\" pcmt=\"my comment\" ccmt=\"comment for user\"><part pid=\"2663327\" gtm=\"3\" cnd=\"2\" prce=\"1200\" /></quot>";
    string ReturnString = "";
    wsSupplier.SupplierPub ws = new wsSupplier.SupplierPub();
    ws.Url = wsUrl; ;
    ReturnString = ws.MakeQuote(Username, Password, request);
    }
    }
    }
     
    Norvin, Nov 24, 2010 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What OS is the server running? What language is the script that is trying to call the functions in the .cs file written in?
     
    AstarothSolutions, Nov 25, 2010 IP
  3. hassanjawed

    hassanjawed Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    first plz tell the language?
     
    hassanjawed, Nov 26, 2010 IP
  4. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #4
    Won't work on Apache (except you have mono running).

    This file references a .asmx file (and that is ASP.NET).

    A .cs file belongs to ASP.NET too... IIS... Windows Server (I think it's C# or any C language)
     
    CSM, Nov 27, 2010 IP
  5. 525252

    525252 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    this is a c#(ASP.NET) script.

    you need a IIS server with asp.net 2.0+ ,or a mono on linux.

    link:

    asp.net
    mono-project.com/Main_Page
     
    525252, Dec 1, 2010 IP
  6. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #6
    Reason #6392 you shouldn't be using .NET anything on the web.
     
    drhowarddrfine, Dec 1, 2010 IP
  7. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #7
    So is reason #518949846 that you shouldn't use PHP the fact that it doesn't run on IIS? Using your own logic

    I do wonder who hurt you to make you so anti-microsoft ;)
     
    AstarothSolutions, Dec 1, 2010 IP