public void Submit_NextCheck() { if (CurrentCheck != null) { var area = CurrentCheck.Get_NextArea(); if (area == null || CurrentCheck.UpdateDone) { CurrentCheck = new AutoCheck_Handle(); IsPosting = false; return; } ECheckSubmit eCheckSubmit = new ECheckSubmit { Area_Id = area.id, CheckPerson_Id = CurrentCheck.CheckingPerson.id, }; eCheckSubmit.CheckItems = new List <EItem>(); foreach (var item in area.ECheckings) { eCheckSubmit.CheckItems.Add(new EItem { Item = item.ECheckItemCode, Status = 0xFF, }); } var request = (HttpWebRequest)WebRequest.Create("http://10.10.10.3:32760/echecklist/post"); //var request = (HttpWebRequest)WebRequest.Create("http://10.4.3.41:32760/echecklist/post"); //var request = (HttpWebRequest)WebRequest.Create("http://localhost:32760/echecklist/post"); var data = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(eCheckSubmit)); request.Method = "POST"; request.ContentType = "application/json"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); if (responseString.ToLower().IndexOf("true") > -1) { CurrentCheck.IncreaseIndex(); } } }
public void Get_HandleToPost(DateTime Time) { if (!IsPosting) { var current = AutoList.Where(i => i.UpdateHour == Time.Hour && i.UpdateMin == Time.Minute && !i.UpdateDone) .FirstOrDefault(); if (current != null && current.UpdateHour != 0) { CurrentCheck = current; IsPosting = true; } } }