private async void SaveRegistCore() { try { if (!CurrentSystem.IsClicked) { _commonFun.AlertLongText("已结束的任务不能再上传"); return; } if (SystemList == null || SystemList.Count == 0) { _commonFun.AlertLongText("没有可保存的数据"); return; } saveScore = new ScoreCheckResultParam(); List <ScoreRegDto> ScoreLst = new List <ScoreRegDto>(); List <CheckResultRegDto> CheckResultLst = new List <CheckResultRegDto>(); List <StandardPicRegDto> StandardPicLst = new List <StandardPicRegDto>(); List <PictureStandard> PicStandLst = new List <PictureStandard>(); // { get; set; } // int UserId { get; set; } ScoreRegDto scoreDto; CheckResultRegDto checkDto; StandardPicRegDto standDto; PictureStandard standPicDto; foreach (var item in SystemList) { scoreDto = new ScoreRegDto(); scoreDto.TIId = item.TIId; scoreDto.GRUD = item.GRUD; scoreDto.TPId = item.TPId; scoreDto.PlanApproalYN = item.PlanApproalYN; scoreDto.ResultApproalYN = item.ResultApproalYN; scoreDto.PlanFinishDate = item.PlanFinishDate; scoreDto.ResultFinishDate = item.ResultFinishDate; int score; if (int.TryParse(CurrentScore, out score)) { scoreDto.Score = item.SeqNo == CurrentSystem.SeqNo ? (!string.IsNullOrEmpty(CurrentScore) ? Convert.ToInt32(CurrentScore) : -1) : item.Score;//update real source } else { _commonFun.AlertLongText("分数请输入数字"); return; } //scoreDto.PassYN = item.PassYN; scoreDto.Remarks = item.Remarks; ScoreLst.Add(scoreDto); foreach (var item1 in item.CSList) { checkDto = new CheckResultRegDto(); checkDto.CSId = item1.CSID; checkDto.Result = item1.IsCheck; checkDto.TIId = item1.TIId; checkDto.TPId = item1.TPId; checkDto.GRUD = item.GRUD; CheckResultLst.Add(checkDto); } foreach (var item2 in item.ParamSPicList) { if (item2.StandardPicId == 0) { standDto = new StandardPicRegDto(); standDto.TIId = item2.TIId; standDto.TPId = CurrentSystem.TPId; standDto.Url = item2.Url; standDto.PicName = item2.PicName; standDto.PicType = item2.PicType; standDto.GRUD = item.GRUD; StandardPicLst.Add(standDto); } } foreach (var item3 in item.PStandardList) { standPicDto = new PictureStandard(); standPicDto.TIId = item3.TIId; standPicDto.TPId = item3.TPId; standPicDto.Url = item3.Url; standPicDto.StandardPicId = item3.StandardPicId; standPicDto.GRUD = item.GRUD; PicStandLst.Add(standPicDto); } } saveScore.CheckResultLst = CheckResultLst; saveScore.ScoreLst = ScoreLst; saveScore.StandardPicLst = StandardPicLst; saveScore.PicStandLst = PicStandLst; saveScore.UserId = Convert.ToInt32(CommonContext.Account.UserId); if (saveScore != null || saveScore.CheckResultLst.Any() || saveScore.ScoreLst.Any() || saveScore.StandardPicLst.Any()) { try { _commonFun.ShowLoading("保存中..."); //save var result = await _tourService.SaveRegistCore(saveScore); if (result != null) { if (result.ResultCode == ResultType.Success) { _commonFun.AlertLongText("保存成功"); //CurrentSystem.SPicList = _deleteList; //CurrentSystem.SPicList = new ObservableCollection<StandardPic>(); //foreach (var sp in _deleteList) //{ // CurrentSystem.SPicList.Add(sp); //} //LossImageList = CurrentSystem.SPicList.Count * 50; } else { _commonFun.AlertLongText(result.Msg); } } else { _commonFun.AlertLongText("保存时服务出现错误,,请重试"); } } catch (OperationCanceledException) { _commonFun.AlertLongText("保存超时,请重试"); } catch (Exception) { _commonFun.AlertLongText("保存异常,请重试"); } finally { _commonFun.HideLoading(); } } } catch (Exception) { _commonFun.AlertLongText("保存失败,请重试"); } }
public void Init(ObservableCollection <StandardPicRegDto> images, StandardPicRegDto currentImage) { Images = images; }