private void SaveResult() { ObservableCollection<T_OA_REQUIRERESULT> resultList = new ObservableCollection<T_OA_REQUIRERESULT>(); SurveyShowList ssL = null; T_OA_REQUIRERESULT resultInfo = null; bool AnswerIsNull = true; string StrAnswer = ""; for (int i = 0; i < spSurveysList.Children.Count; i++) { ssL = new SurveyShowList(); ssL = spSurveysList.Children[i] as SurveyShowList; if (string.IsNullOrEmpty(ssL.ResultDetail.RESULT)) { AnswerIsNull = false; StrAnswer += (i + 1).ToString() + ","; continue; } resultInfo = ssL.ResultDetail; resultInfo.REQUIRERESULTID = System.Guid.NewGuid().ToString(); resultInfo.T_OA_REQUIREMASTER = employeeSurveyInfo.RequireMaster; resultInfo.T_OA_REQUIRE = require; resultInfo.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; resultInfo.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; resultInfo.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; resultInfo.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; resultInfo.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; resultInfo.OWNERID = Common.CurrentLoginUserInfo.EmployeeID; resultInfo.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; resultInfo.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; resultInfo.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; resultInfo.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName; resultInfo.UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; resultInfo.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; resultInfo.UPDATEDATE = System.DateTime.Now; resultList.Add(resultInfo); } if (!AnswerIsNull) { StrAnswer = StrAnswer.Substring(0, StrAnswer.Length - 1); Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), "第" + StrAnswer + "道题没有答案"); } if (resultList.Count() > 0) { empSurveysWS.SubmitResultAsync(resultList); } else { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), "请填写答案"); } }
private void SaveResult() { ObservableCollection <T_OA_REQUIRERESULT> resultList = new ObservableCollection <T_OA_REQUIRERESULT>(); SurveyShowList ssL = null; T_OA_REQUIRERESULT resultInfo = null; bool AnswerIsNull = true; string StrAnswer = ""; for (int i = 0; i < spSurveysList.Children.Count; i++) { ssL = new SurveyShowList(); ssL = spSurveysList.Children[i] as SurveyShowList; if (string.IsNullOrEmpty(ssL.ResultDetail.RESULT)) { AnswerIsNull = false; StrAnswer += (i + 1).ToString() + ","; continue; } resultInfo = ssL.ResultDetail; resultInfo.REQUIRERESULTID = System.Guid.NewGuid().ToString(); resultInfo.T_OA_REQUIREMASTER = employeeSurveyInfo.RequireMaster; resultInfo.T_OA_REQUIRE = require; resultInfo.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; resultInfo.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; resultInfo.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; resultInfo.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; resultInfo.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; resultInfo.OWNERID = Common.CurrentLoginUserInfo.EmployeeID; resultInfo.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; resultInfo.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; resultInfo.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; resultInfo.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName; resultInfo.UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; resultInfo.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; resultInfo.UPDATEDATE = System.DateTime.Now; resultList.Add(resultInfo); } if (!AnswerIsNull) { StrAnswer = StrAnswer.Substring(0, StrAnswer.Length - 1); Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), "第" + StrAnswer + "道题没有答案"); } if (resultList.Count() > 0) { empSurveysWS.SubmitResultAsync(resultList); } else { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), "请填写答案"); } }
void Get_ESurveyCompleted(object sender, Get_ESurveyCompletedEventArgs e) { if (e.Result != null) { employeeSurveyInfo = e.Result as V_EmployeeSurvey; txbTitle.Text = EmployeeSurveyInfo.RequireMaster.REQUIRETITLE; txbContent.Text = EmployeeSurveyInfo.RequireMaster.CONTENT; //题目,答案 foreach (V_EmployeeSurveySubject subInfo in EmployeeSurveyInfo.SubjectViewList) { SurveyShowList subjectItem = new SurveyShowList(); subjectItem.SubjectViewInfo = subInfo; subjectItem.IsShowResult = 0; spSurveysList.Children.Add(subjectItem); } } }
void empSurveysManage_GetResultByUserIDCompleted(object sender, GetResultByUserIDCompletedEventArgs e) { ObservableCollection <T_OA_REQUIRERESULT> subjectResult = e.Result; foreach (V_EmployeeSurveySubject subInfo in EmployeeSurveyInfo.SubjectViewList) { SurveyShowList subjectItem = new SurveyShowList(); if (subjectResult != null) { // subjectItem.ResultDetail = subjectResult.Where(q => q.SUBJECTID == subInfo.SubjectInfo.SUBJECTID).FirstOrDefault(); } subjectItem.SubjectViewInfo = subInfo; subjectItem.IsShowResult = 3; spSurveysList.Children.Add(subjectItem); if (type == FormTypes.Browse) { subjectItem.txtComments.IsReadOnly = true; } } }
void empSurveysManage_GetResultByUserIDCompleted(object sender, GetResultByUserIDCompletedEventArgs e) { ObservableCollection<T_OA_REQUIRERESULT> subjectResult = e.Result; foreach (V_EmployeeSurveySubject subInfo in EmployeeSurveyInfo.SubjectViewList) { SurveyShowList subjectItem = new SurveyShowList(); if (subjectResult != null) { // subjectItem.ResultDetail = subjectResult.Where(q => q.SUBJECTID == subInfo.SubjectInfo.SUBJECTID).FirstOrDefault(); } subjectItem.SubjectViewInfo = subInfo; subjectItem.IsShowResult = 3; spSurveysList.Children.Add(subjectItem); if (type == FormTypes.Browse) { subjectItem.txtComments.IsReadOnly = true; } } }