//上传 private void UploadBtn_Click(object sender, RoutedEventArgs e) { if (System.Windows.MessageBox.Show("是否上传检测记录?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { string activityId = Uid; List <StudentCheckData> studentCheckDatas = dbUtill.GetUploadDatasByActivityId(activityId); if (studentCheckDatas.Count > 0) { MyCustomControlLibrary.MMessageBox.ShowLoading(MyCustomControlLibrary.MMessageBox.LoadType.Circle, "正在上传", new Point(0, 0), new Size(0, 0), "", System.Windows.Controls.Orientation.Vertical, "#ffffff", 3); string url = dbUtill.GetImageUrl(); string uploadUrl = ConfigurationManager.AppSettings["UploadUrl"]; string schoolId = ConfigurationManager.AppSettings["schoolId"]; Activity activity = dbUtill.GetActivitieInfoByID(ActivityId); foreach (StudentCheckData student in studentCheckDatas) { string res = dbUtill.GetStudentInfoByStudentId(student.studentId); string studentName = dbUtill.GetStudentNameByID(student.studentId); string[] resArray = res.Split(','); string gradeName = resArray[1]; string className = resArray[0]; string path = @url + "\\" + ActivityName + "\\" + gradeName + "\\" + className + "\\" + student.studentId + "_" + studentName + ".jpg"; if (!File.Exists(path)) { ImageInfo imageInfo = CommonUtill.ImageFileInfo(path); if (student.jsonContent.Trim().Length > 1) { string param = "{\"student_educode\":\"" + student.NID + "\",\"activity_code\":\"" + activityId + "\",\"student_number\":\"" + student.studentId + "\",\"image\":[{\"image_size\":" + imageInfo.image_size + ",\"image_code\":" + imageInfo.image_code + ",\"fileName\":" + imageInfo.fileName + ",\"image_time\":" + imageInfo.image_time + "}],\"target_code\":\"7\", \"school_code\": \"" + schoolId + "\",\"datas\": { \"age\": " + student.studentAge + ",\"height\": " + student.studentHeight + ",\"checkDate\": \"" + student.checkDate + "\",\"checkResult\":\"" + student.jsonContent + "\"}},\"activityName\": \"" + activity.ActivityName + "\",\"activityDate\": \"" + activity.activityDate + "\"}"; string Res = requestUtill.PostRequestClient(uploadUrl, param); } } else { rp.checkData = student; rp.CreateMC780_boy(); ImageInfo imageInfo = CommonUtill.ImageFileInfo(path); if (student.jsonContent.Trim().Length > 1) { string param = "{\"student_educode\":\"" + student.NID + "\",\"activity_code\":\"" + activityId + "\",\"student_number\":\"" + student.studentId + "\",\"image\":[{\"image_size\":" + imageInfo.image_size + ",\"image_code\":" + imageInfo.image_code + ",\"fileName\":" + imageInfo.fileName + ",\"image_time\":" + imageInfo.image_time + "}],\"target_code\":\"7\", \"school_code\": \"" + schoolId + "\",\"datas\": { \"age\": " + student.studentAge + ",\"height\": " + student.studentHeight + ",\"checkDate\": \"" + student.checkDate + "\",\"checkResult\":\"" + student.jsonContent + "\"}},\"activityName\": \"" + activity.ActivityName + "\",\"activityDate\": \"" + activity.activityDate + "\"}"; string Res = requestUtill.PostRequestClient(uploadUrl, param); Console.WriteLine(Res); } } } MyCustomControlLibrary.MMessageBox.MClosed(); System.Windows.MessageBox.Show("上传完毕", "提示"); } else { System.Windows.MessageBox.Show("该活动不存在已检测的数据,请检测后再试", "提示"); } } }