コード例 #1
0
 private void LoadScoreCommentResultInfo(BasicScoreSheetItem item)
 {
     try
     {
         //加载评分备注结果信息
         if (item == null)
         {
             return;
         }
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3102Codes.GetScoreCommentResultList;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(item.ScoreResultID.ToString());
         Service31021Client client = new Service31021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31021"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(string.Format("Fail.\tListData is null"));
             return;
         }
         mListScoreCommentResults.Clear();
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string          strInfo   = webReturn.ListData[i];
             OperationReturn optReturn = XMLHelper.DeserializeObject <BasicScoreCommentInfo>(strInfo);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             BasicScoreCommentInfo info = optReturn.Data as BasicScoreCommentInfo;
             if (info == null)
             {
                 ShowException(string.Format("Fail.\tBasicScoreCommentResultInfo is null"));
                 return;
             }
             mListScoreCommentResults.Add(info);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
コード例 #2
0
 private bool SaveScoreCommentResult()
 {
     try
     {
         if (ScoreSheetItem == null ||
             mCurrentScoreSheet == null)
         {
             return(false);
         }
         List <ScoreObject> listScoreObjects = new List <ScoreObject>();
         mCurrentScoreSheet.GetAllScoreObject(ref listScoreObjects);
         List <BasicScoreCommentInfo> listCommentResults = new List <BasicScoreCommentInfo>();
         for (int i = 0; i < listScoreObjects.Count; i++)
         {
             var comment = listScoreObjects[i] as Comment;
             if (comment == null)
             {
                 continue;
             }
             var scoreItem = comment.ScoreItem;
             if (scoreItem == null)
             {
                 continue;
             }
             var temp =
                 mListScoreCommentResults.FirstOrDefault(s => s.ScoreResultID == ScoreSheetItem.ScoreResultID &&
                                                         s.ScoreSheetID == mCurrentScoreSheet.ID &&
                                                         s.ScoreItemID == scoreItem.ID &&
                                                         s.ScoreCommentID == comment.ID);
             if (temp == null)
             {
                 temp = new BasicScoreCommentInfo();
                 temp.ScoreResultID  = ScoreSheetItem.ScoreResultID;
                 temp.ScoreSheetID   = mCurrentScoreSheet.ID;
                 temp.ScoreItemID    = scoreItem.ID;
                 temp.ScoreCommentID = comment.ID;
             }
             var itemComment = comment as ItemComment;
             if (itemComment != null &&
                 itemComment.SelectItem != null)
             {
                 temp.CommentItemID      = itemComment.SelectItem.ID;
                 temp.CommentItemOrderID = itemComment.SelectItem.OrderID;
                 temp.CommentText        = itemComment.SelectItem.Text;
                 listCommentResults.Add(temp);
             }
             var textComment = comment as TextComment;
             if (textComment != null)
             {
                 temp.CommentText = textComment.Text;
                 listCommentResults.Add(temp);
             }
         }
         int count = listCommentResults.Count;
         if (count <= 0)
         {
             return(true);
         }
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S3102Codes.SaveScoreCommentResultInfos;
         webRequest.ListData.Add(ScoreSheetItem.ScoreResultID.ToString());
         webRequest.ListData.Add(count.ToString());
         for (int i = 0; i < listCommentResults.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.SeriallizeObject(listCommentResults[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return(false);
             }
             webRequest.ListData.Add(optReturn.Data.ToString());
         }
         Service31021Client client = new Service31021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo,
                                                                                            "Service31021"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
         return(false);
     }
 }