UploadPing() private method

private UploadPing ( ServerPing, myPing, bool doInsertion ) : string
myPing ServerPing,
doInsertion bool
return string
Beispiel #1
0
    /*
     * private static string getIP() {
     *      string strHostName = "";
     *      strHostName = System.Net.Dns.GetHostName();
     *      IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
     *      IPAddress[] addr = ipEntry.AddressList;
     *      return addr[addr.Length-1].ToString();
     * }
     */

    public static string Ping(bool doInsertion, string progName, string progVersion)
    {
        try {
            ChronojumpServer myServer = new ChronojumpServer();
            LogB.Information(myServer.ConnectDatabase());

            int    evalSID   = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
            string machineID = SqlitePreferences.Select("machineID");

            ServerPing myPing = new ServerPing(evalSID, progName + " " + progVersion, UtilAll.GetOS(),
                                                                         //getIP(), DateTime.Now); //evaluator IP, date
                                               machineID, DateTime.Now); //evaluator machineID, date

            //if !doIsertion nothing will be uploaded,
            //is ok for uploadPerson to know if server is online
            string versionAvailable = myServer.UploadPing(myPing, doInsertion);

            LogB.Information(myServer.DisConnectDatabase());
            return(versionAvailable);
        } catch (Exception e) {
            LogB.Information("Server Connection", e.Message);
            return(Constants.ServerOffline);
        }
    }
Beispiel #2
0
    /*
    private static string getIP() {
        string strHostName = "";
        strHostName = System.Net.Dns.GetHostName();
        IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
        IPAddress[] addr = ipEntry.AddressList;
        return addr[addr.Length-1].ToString();
    }
    */
    public static string Ping(bool doInsertion, string progName, string progVersion)
    {
        try {
            ChronojumpServer myServer = new ChronojumpServer();
            Log.WriteLine(myServer.ConnectDatabase());

            int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
            string machineID = SqlitePreferences.Select("machineID");

            ServerPing myPing = new ServerPing(evalSID, progName + " " + progVersion, Util.GetOS(),
                    //getIP(), DateTime.Now); //evaluator IP, date
                    machineID, DateTime.Now); //evaluator machineID, date

            //if !doIsertion nothing will be uploaded,
            //is ok for uploadPerson to know if server is online
            string versionAvailable = myServer.UploadPing(myPing, doInsertion);

            Log.WriteLine(myServer.DisConnectDatabase());
            return versionAvailable;
        } catch (Exception e){
            Log.WriteLine("Server Connection "+e.Message);
            return Constants.ServerOffline;
        }
    }