예제 #1
0
 public string Send_action(object pb)
 {
     if (pb is User)
     {
         INITIALIZE user_info = new INITIALIZE();
         user_info.user = (User)pb;
         return(login(user_info));
     }
     else if (pb is PatientInfo)
     {
         ADD_PATIENT ap = new ADD_PATIENT();
         ap.info = (PatientInfo)pb;
         return(add_patient(ap));
     }
     else if (pb is ToQueue)
     {
         DOCTOR_SAY_NEXT ap = new DOCTOR_SAY_NEXT();
         ap.pId        = ((ToQueue)pb).pId;
         ap.newQueueId = ((ToQueue)pb).queueId;
         return(next(ap));
     }
     else if (pb is TriageOffice)
     {
         TRIAGE_OFFICE ap = new TRIAGE_OFFICE();
         ap.pId      = ((TriageOffice)pb).pId;
         ap.clinicId = ((TriageOffice)pb).clinicId;
         return(triage(ap));
     }
     else
     {
         return("invalid sending object");
     }
 }
예제 #2
0
        public string login(INITIALIZE initialize)
        {
            try
            {
                HttpClient httpClient = new HttpClient();
                httpClient.MaxResponseContentBufferSize = 256000;
                httpClient.Timeout = TimeSpan.FromSeconds(3);
                String url = ip + "/iQueue/user";

                var values = new List <KeyValuePair <string, string> >();
                values.Add(new KeyValuePair <string, string>("opcode", initialize.opcode));
                values.Add(new KeyValuePair <string, string>("username", initialize.user.username));
                values.Add(new KeyValuePair <string, string>("password", initialize.user.password));
                var content = new FormUrlEncodedContent(values);

                HttpResponseMessage response = new HttpResponseMessage();
                response = httpClient.PostAsync(new Uri(url), content).Result;

                String result = response.Content.ReadAsStringAsync().Result;
                return(result);
            }
            catch
            {
                return("unable to connect server:timeout(3)");
            }
        }
예제 #3
0
 public string Send_action(object pb)
 {
     if (pb is User)
     {
         INITIALIZE user_info = new INITIALIZE();
         user_info.user = (User)pb;
         return(login(user_info));
     }
     else if (pb is PatientInfo)
     {
         ADD_PATIENT ap = new ADD_PATIENT();
         ap.info = (PatientInfo)pb;
         return(add_patient(ap));
     }
     else if (pb is String)
     {
         DOCTOR_SAY_NEXT ap = new DOCTOR_SAY_NEXT();
         ap.name = (String)pb;
         return(next(ap));
     }
     else
     {
         return("invalid sending object");
     }
 }