Example #1
0
        public string CheckLogin(string userid, string ipaddress, string logintype)
        {
            string result = String.Empty;

            string uri = string.Format("{0}api/Authentication/CheckValidationUser?userid={1}&ipaddress={2}&serialno={3}&scanversion={4}"
                                       , this.BASE_URI
                                       , userid
                                       , ipaddress
                                       , "testserial"
                                       , "1.0.0.1"
                                       );


            HttpWebRequest request = ServicesUtil.ApiRequest(uri, "GET", this.USER_AUTH, this.TIMEOUT);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream responseStream = response.GetResponseStream();

            string jsonString = null;

            using (StreamReader reader = new StreamReader(responseStream))
            {
                jsonString = reader.ReadToEnd();
                reader.Close();
            }


            if (!string.IsNullOrEmpty(jsonString))
            {
                result = JsonConvert.DeserializeObject <String>(jsonString);
            }

            return(result);
        }
Example #2
0
        public ResponseResult ScanMixingLabel(string serialno, string mixedno, string mtlCode, string userid)
        {
            ResponseResult res = new ResponseResult();

            try
            {
                var replacements = new Dictionary <string, string>()
                {
                    { "(plus)", "+" },
                    { "(percen)", "%" }
                };

                foreach (string key in replacements.Keys)
                {
                    mtlCode = mtlCode.Replace(key, replacements.FirstOrDefault(v => v.Key == key).Value);
                }


                string uri = string.Format("{0}api/Mixed/ScanMixingLabel?serialno={1}&mixedno={2}&mtlCode={3}&userid={4}"
                                           , this.BASE_URI
                                           , serialno
                                           , mixedno
                                           , mtlCode
                                           , userid
                                           );

                //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                //request.ContentType = "application/json";
                //request.Method = "GET";

                //request.Timeout = this.TIMEOUT;
                HttpWebRequest request = ServicesUtil.ApiRequest(uri, "GET", this.USER_AUTH, this.TIMEOUT);

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream responseStream = response.GetResponseStream();

                string jsonString = null;

                using (StreamReader reader = new StreamReader(responseStream))
                {
                    jsonString = reader.ReadToEnd();
                    reader.Close();
                }

                if (!string.IsNullOrEmpty(jsonString))
                {
                    res = JsonConvert.DeserializeObject <ResponseResult>(jsonString);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
        public ResponseResult ScanRepLabel(string serialno, string repno, string jobno, string mcno, string userid)
        {
            ResponseResult res = new ResponseResult();

            try
            {
                string uri = string.Format("{0}api/Replenish/ScanRepLabel?serialno={1}&repno={2}&jobno={3}&mcno={4}&userid={5}"
                                           , this.BASE_URI
                                           , serialno
                                           , repno
                                           , jobno
                                           , mcno
                                           , userid
                                           );

                //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                //request.ContentType = "application/json";
                //request.Method = "GET";

                //request.Timeout = this.TIMEOUT;
                HttpWebRequest request = ServicesUtil.ApiRequest(uri, "GET", this.USER_AUTH, this.TIMEOUT);

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream responseStream = response.GetResponseStream();

                string jsonString = null;

                using (StreamReader reader = new StreamReader(responseStream))
                {
                    jsonString = reader.ReadToEnd();
                    reader.Close();
                }

                if (!string.IsNullOrEmpty(jsonString))
                {
                    res = JsonConvert.DeserializeObject <ResponseResult>(jsonString);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
Example #4
0
        public ResponseResult StartMixing(decimal percen, int noOfBag, string userid)
        {
            ResponseResult res = new ResponseResult();

            try
            {
                string uri = string.Format("{0}api/Mixed/StartMixing?percen={1}&noOfBag={2}&userid={3}"
                                           , this.BASE_URI
                                           , percen
                                           , noOfBag
                                           , userid
                                           );

                //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                //request.ContentType = "application/json";
                //request.Method = "GET";

                //request.Timeout = this.TIMEOUT;
                HttpWebRequest request = ServicesUtil.ApiRequest(uri, "GET", this.USER_AUTH, this.TIMEOUT);

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream responseStream = response.GetResponseStream();

                string jsonString = null;

                using (StreamReader reader = new StreamReader(responseStream))
                {
                    jsonString = reader.ReadToEnd();
                    reader.Close();
                }

                if (!string.IsNullOrEmpty(jsonString))
                {
                    res = JsonConvert.DeserializeObject <ResponseResult>(jsonString);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(res);
        }
Example #5
0
        public string CheckVersion(string curVersion)
        {
            string result = String.Empty;

            try
            {
                string uri = string.Format("{0}api/AutoUpdate/GetLatestVersion?curVersion={1}"
                                           , this.BASE_URI
                                           , curVersion
                                           );


                HttpWebRequest request = ServicesUtil.ApiRequest(uri, "GET", this.USER_AUTH, this.TIMEOUT);

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream responseStream = response.GetResponseStream();

                string jsonString = null;

                using (StreamReader reader = new StreamReader(responseStream))
                {
                    jsonString = reader.ReadToEnd();
                    reader.Close();
                }

                if (!string.IsNullOrEmpty(jsonString))
                {
                    result = JsonConvert.DeserializeObject <String>(jsonString);
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }