예제 #1
0
        public static SRV_RegisterData GetSrvRegisterData(string sernum, string hdd_serial)
        {
            if (sernum.Trim().Length < 12)
            {
                return(null);
            }

            //SRV_RegisterData srv_regdata = new SRV_RegisterData();
            //srv_regdata._conn_success = false;
            //srv_regdata._failed_reason = SRV_RegisterData.FAILED_REASON.NONE;

            SRV_RegisterData srv_regdata = null;

            try
            {
                string json_data = "{\"sernum\":\"" + sernum.Trim() + "\",";
                json_data += "\"hdd_serial\":\"" + hdd_serial.Trim() + "\"}";
                string result = WebComm.PostData("http://www.esg.co.th/XML-Exporter/get_registered_data.php", json_data);
                srv_regdata = JsonConvert.DeserializeObject <SRV_RegisterData>(result);
            }
            catch (Exception)
            {
                return(null);
            }

            return(srv_regdata);
        }
예제 #2
0
        public static SRV_RegisterData GetSrvRegisterData(LOC_RegisterData local_regdata)
        {
            if (local_regdata == null)
            {
                return(null);
            }

            SRV_RegisterData srv_regdata = new SRV_RegisterData();

            srv_regdata._conn_success  = false;
            srv_regdata._failed_reason = SRV_RegisterData.FAILED_REASON.NONE;

            try
            {
                string json_data = "{\"token_key\":\"" + local_regdata.token_key + "\"}";
                string result    = WebComm.PostData("http://www.esg.co.th/XML-Exporter/get_registered_data.php", json_data);
                srv_regdata = JsonConvert.DeserializeObject <SRV_RegisterData>(result);
            }
            catch (Exception)
            {
                return(null);
            }

            return(srv_regdata);
        }
예제 #3
0
        public static bool IsServerConnected()
        {
            WebResult res = new WebResult();

            res.result = false;

            try
            {
                string web_result = WebComm.PostData("http://www.esg.co.th/XML-Exporter/test_connection.php", "");
                res = JsonConvert.DeserializeObject <WebResult>(web_result);
            }
            catch (Exception)
            {
                // do nothing.
            }

            return(res.result);
        }