private void SubmitAnswerToDB() { INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance(); InvestigationAnswerInputDto answer = new InvestigationAnswerInputDto() { QuestionId = _questionObj.Id, Question_Type = _questionObj.Type, QuestionSerialNumber = _questionObj.SerialNumber, Answer_Type = currentAnswerType, InvestigationRecordId = (Guid)App.Current.Properties["CurrentRecordId"] }; if (currentChoice == 1) { answer.AnswerValue1 = 1; answer.AnswerValue2 = int.Parse(tb_OptionN.Text); } else { answer.AnswerValue1 = 0; answer.AnswerValue2 = null; } try { myMainService.AddOrUpdateSomeoneInvestigationAnswer(answer); } catch (Exception ex) { MessageBox.Show("出现数据异常:" + ex.Message + ",程序返回首页"); ReturnMainPage(); } }
private void SubmitAnswerToDB(bool isAnswered) { INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance(); InvestigationAnswerInputDto answer = new InvestigationAnswerInputDto() { QuestionId = _questionObj.Id, Question_Type = _questionObj.Type, QuestionSerialNumber = _questionObj.SerialNumber, Answer_Type = currentAnswerType, InvestigationRecordId = (Guid)App.Current.Properties["CurrentRecordId"] }; if (isAnswered) { answer.AnswerValue1 = currentFrequency; answer.AnswerValue2 = int.Parse(tb_Intake.Text); } else { answer.AnswerValue1 = null; answer.AnswerValue2 = null; } try { myMainService.AddOrUpdateSomeoneInvestigationAnswer(answer); } catch (Exception ex) { throw ex; } }