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;
            }
        }
Beispiel #3
0
        private void Control_FinishedInputEvent(object sender, EventArgs e)
        {
            Guid questionId = (Guid)sender;

            if (questionId == questionObj.Id)
            {
                switch (questionObj.Type)
                {
                case QuestionType.Standard:
                    OptionControl_Type1 control1 = grid_Options.Children[0] as OptionControl_Type1;
                    control1.FinishedInputEvent -= Control_FinishedInputEvent;
                    break;

                case QuestionType.Optional:
                    OptionControl_Type2 control2 = grid_Options.Children[0] as OptionControl_Type2;
                    control2.FinishedInputEvent -= Control_FinishedInputEvent;
                    break;

                case QuestionType.Choice:
                    OptionControl_Type3 control3 = grid_Options.Children[0] as OptionControl_Type3;
                    control3.FinishedInputEvent -= Control_FinishedInputEvent;
                    break;

                default:
                    ReturnMainPage();
                    return;
                }
                grid_Options.Children.Clear();
                if (questionObj.CurrentProgress < 1)
                {
                    serialNumber++;
                    LoadQuestionInfo(serialNumber);
                }
                else
                {
                    var task = Task.Factory.StartNew(() =>
                    {
                        INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();
                        try
                        {
                            myMainService.FinishSomeoneInvestigationRecord(recordId);
                        }
                        catch (Exception ex)
                        {
                            this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("完成调查发送错误:" + ex.Message); }));
                        }
                    });
                    WatingWindow waitingWindow = new WatingWindow(task);
                    waitingWindow.ShowDialog();
                    Frame myframe = App.Current.Properties["MyFrame"] as Frame;
                    myframe.Navigate(new Uri(@"Pages\RecordListPage.xaml", UriKind.Relative));
                }
            }
            else
            {
                MessageBox.Show("发生未知数据错误,程序返回首页");
                ReturnMainPage();
            }
        }
Beispiel #4
0
        private void LoadQuestionInfo(int serialNumber)
        {
            try
            {
                INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();
                questionObj = myMainService.GetQuestionViewBySerialNumber(serialNumber, recordId);
                pb_QuestionProcess.Value           = questionObj.CurrentProgress * 100;
                textblock_FirstCategory.Text       = questionObj.FirstCategoryName;
                textblock_SecondCategory.Text      = questionObj.SecondCategoryName;
                textblock_QuestionDescription.Text = questionObj.Description;
                switch (questionObj.Type)
                {
                case QuestionType.Standard:
                    textblock_FirstCategory.Foreground       = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    textblock_SecondCategory.Foreground      = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    textblock_QuestionDescription.Foreground = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    pb_QuestionProcess.Foreground            = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    var control1 = new OptionControl_Type1(questionObj);
                    control1.FinishedInputEvent += Control_FinishedInputEvent;
                    grid_Options.Children.Add(control1);
                    break;

                case QuestionType.Optional:
                    textblock_FirstCategory.Foreground       = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_SecondCategory.Foreground      = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_QuestionDescription.Foreground = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    pb_QuestionProcess.Foreground            = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    var control2 = new OptionControl_Type2(questionObj);
                    control2.FinishedInputEvent += Control_FinishedInputEvent;
                    grid_Options.Children.Add(control2);
                    break;

                case QuestionType.Choice:
                    textblock_FirstCategory.Foreground       = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_SecondCategory.Foreground      = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_QuestionDescription.Foreground = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    pb_QuestionProcess.Foreground            = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    var control3 = new OptionControl_Type3(questionObj);
                    control3.FinishedInputEvent += Control_FinishedInputEvent;
                    grid_Options.Children.Add(control3);
                    break;

                default:
                    ReturnMainPage();
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("加载问题失败:" + ex.Message);
                ReturnMainPage();
            }
        }
Beispiel #5
0
        private void labelRecordsCount_Loaded(object sender, RoutedEventArgs e)
        {
            INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();

            try
            {
                labelRecordsCount.Content = myMainService.GetFinishedInvestigationRecordCount().ToString() + " 份";
            }
            catch (Exception)
            {
                labelRecordsCount.Content = "0 份";
            }
        }
        private void btn_Ok_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb_Auditor.Text))
            {
                MessageBox.Show("请填写审核人姓名!");
                return;
            }
            INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();

            try
            {
                myMainService.AuditSomeoneInvestigationRecord(_recordId, tb_Auditor.Text);
                isOk = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("审核出错:" + ex.Message);
            }
            this.Close();
        }
Beispiel #7
0
        private void DgUserDataBind()
        {
            PageQueryInput <InvestigationRecordQueryConditions> conditions = new PageQueryInput <InvestigationRecordQueryConditions>()
            {
                PageSize        = myPager.PageSize,
                PageIndex       = myPager.PageIndex,
                QueryConditions = condition
            };

            try
            {
                INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();
                var            result        = myMainService.QueryInvestigationRecordListByConditions(conditions);
                myPager.TotalCount    = result.TotalCount;
                dg_Record.DataContext = result.QueryResult;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                ReturnMainPage();
            }
        }
Beispiel #8
0
        private void buttonBegin_Click(object sender, RoutedEventArgs e)
        {
            //App.Current.Properties["CurrentRecordId"] = Guid.Parse("f02a6307-9042-4424-b239-d96efd650a57");
            //Frame myframe = App.Current.Properties["MyFrame"] as Frame;
            //myframe.Navigate(new Uri(@"Pages\QuestionPage.xaml", UriKind.Relative));
            if (string.IsNullOrEmpty(textBoxQueueID.Text))
            {
                textBlock_Required1.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxHealthbookID.Text))
            {
                textBlock_Required2.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxInvestigatorName.Text))
            {
                textBlock_Required3.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxName.Text))
            {
                textBlock_Required4.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxBirthday.Text))
            {
                textBlock_Required5.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxWeek.Text))
            {
                textBlock_Required6.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxHeight.Text))
            {
                textBlock_Required7.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxBeforeWeight.Text))
            {
                textBlock_Required8.Visibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrEmpty(textBoxCurrentWeight.Text))
            {
                textBlock_Required9.Visibility = Visibility.Visible;
                return;
            }
            if (!textBoxQueueID.Text.IsNumeric())
            {
                MessageBox.Show("队列编码必须为数字");
                return;
            }
            if (!textBoxHealthbookID.Text.IsNumeric())
            {
                MessageBox.Show("围产保健手册编码必须为数字");
                return;
            }
            if (!textBoxBirthday.Text.IsDateTime())
            {
                MessageBox.Show("生日应为日期格式");
                return;
            }
            if (!textBoxWeek.Text.IsNumeric())
            {
                MessageBox.Show("孕周必须为数字");
                return;
            }
            if (!textBoxHeight.Text.IsFloat())
            {
                MessageBox.Show("身高必须为数字");
                return;
            }
            if (!textBoxBeforeWeight.Text.IsFloat())
            {
                MessageBox.Show("体重必须为数字");
                return;
            }
            if (!textBoxCurrentWeight.Text.IsFloat())
            {
                MessageBox.Show("体重必须为数字");
                return;
            }
            INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();

            try
            {
                NewInvestigationRecordDto newRecord = new NewInvestigationRecordDto()
                {
                    BeforeWeight     = double.Parse(textBoxBeforeWeight.Text),
                    Birthday         = DateTime.Parse(textBoxBirthday.Text),
                    CurrentWeight    = double.Parse(textBoxCurrentWeight.Text),
                    HealthBookId     = textBoxHealthbookID.Text,
                    Height           = double.Parse(textBoxHeight.Text),
                    InvestigatorName = textBoxInvestigatorName.Text,
                    Name             = textBoxName.Text,
                    QueueId          = textBoxQueueID.Text,
                    Week             = int.Parse(textBoxWeek.Text)
                };
                Guid myID = myMainService.CreateNewInvestigationRecord(newRecord);
                App.Current.Properties["CurrentRecordId"] = myID;
                Frame myframe = App.Current.Properties["MyFrame"] as Frame;
                myframe.Navigate(new Uri(@"Pages\QuestionPage.xaml", UriKind.Relative), 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }