Exemple #1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            var name = this.tbx_Name.Text;
            int age  = 0;

            if (!string.IsNullOrEmpty(this.tbx_age.Text) && int.TryParse(this.tbx_age.Text, out age))
            {
            }

            var id = this.tbx_id.Text;

            var gender = this.cmb_gender.Text;

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(gender))
            {
                QuestionWorkflow.Instance().user = new User()
                {
                    Name = name, Age = age, Gender = gender, ID = id
                };
            }
            else
            {
                MessageBox.Show("保存失败,姓名和性别不能为空");

                this.btn_save.DialogResult = DialogResult.Retry;
            }

            this.btn_save.DialogResult = DialogResult.OK;
        }
Exemple #2
0
        public string getCurrentUser()
        {
            if (null == QuestionWorkflow.Instance().user)
            {
                return(string.Empty);
            }

            return(QuestionWorkflow.Instance().user.Name);
        }
Exemple #3
0
        private void IDInfo_Load(object sender, EventArgs e)
        {
            var user = QuestionWorkflow.Instance().user;

            if (null != user)
            {
                this.tbx_Name.Text = user.Name;
                this.tbx_age.Text  = user.Age.ToString();

                this.cmb_gender.Text = user.Gender;

                this.tbx_id.Text = user.ID;
            }
        }
Exemple #4
0
        public string getQuestionnaireCovers()
        {
            int fadeID = 0;

            StringBuilder sb = new StringBuilder();

            sb.Append("[");


            List <Questionnaire> qns = QuestionWorkflow.Instance().Questionnaires;

            List <QuestionnaireCover> qcs = new List <QuestionnaireCover>();


            var groups = qns.FindAll(q => !string.IsNullOrEmpty(q.GroupName));

            List <string> groupNames = new List <string>();

            groups.ForEach(o => groupNames.Add(o.GroupName));

            groupNames = groupNames.Distinct <string>().ToList();

            groupNames.ForEach(g => {
                List <QuestionnaireCover> subCovers = new List <QuestionnaireCover>();

                qns.FindAll(q => q.GroupName.Equals(g)).ForEach(sq => subCovers.Add(new QuestionnaireCover()
                {
                    Name = sq.Name, ID = sq.QuestionnaireID
                }));

                qcs.Add(new QuestionnaireCover()
                {
                    Name = g, ID = fadeID--, SubCovers = subCovers
                });
            });


            qns.ForEach(o =>
            {
                if (!groups.Contains(o))
                {
                    qcs.Add(new QuestionnaireCover()
                    {
                        Name = o.Name, ID = o.QuestionnaireID
                    });
                }
            });

            return(JsonConvert.SerializeObject(qcs));
        }
Exemple #5
0
        public string getQuestionnaire(int id)
        {
            string jsResult = string.Empty;

            Questionnaire qn = QuestionWorkflow.Instance().Get(id);


            if (null != qn)
            {
                jsResult = JsonConvert.SerializeObject(qn);
            }

            return(jsResult);
        }
Exemple #6
0
        void openQuestionnaireClient(object sender)
        {
            Label lbl = (Label)sender;

            if (null != lbl)
            {
                var name = lbl.Name;

                int id = Convert.ToInt32(name.Split('_')[1]);

                questionWorkflow.questionnaire = QuestionWorkflow.Instance().Questionnaires.FirstOrDefault(o => { return(o.QuestionnaireID == id); });



                QuestionnaireClient qc = new QuestionnaireClient();

                qc.ShowDialog();
            }
        }
        private void btn_save_Click(object sender, EventArgs e)
        {
            var centerName = this.tbx_centerName.Text;
            var physician  = this.txb_physiican.Text;

            if (string.IsNullOrEmpty(centerName) && string.IsNullOrEmpty(physician))
            {
                MessageBox.Show("请输入必要的信息");
                return;
            }

            QuestionWorkflow.Instance().report.CenterName = centerName;
            QuestionWorkflow.Instance().report.PhysicianName = physician;

            if (QuestionWorkflow.Instance().SaveReportSetting())
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("保存出错,请重试");
            }
        }
Exemple #8
0
        public string PrintReport()
        {
            try
            {
                var result = QuestionWorkflow.Instance().CreateResultPageAsync().Result;

                if (!string.IsNullOrEmpty(result))
                {
                    Form mainForm = Application.OpenForms["main"];
                    mainForm.BeginInvoke(new Action(() => { new PrintPreview(result).ShowDialog(); }));
                    //PrintPreview frmPreview = new PrintPreview(result);
                    //frmPreview.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                //TODO

                MessageBox.Show(string.Format("Print Error {0}", ex.Message));
                return(string.Empty);
            }

            return("p.ok");
        }
        private void ReportSetting_Load(object sender, EventArgs e)
        {
            this.tbx_centerName.Text = QuestionWorkflow.Instance().report.CenterName;

            this.txb_physiican.Text = QuestionWorkflow.Instance().report.PhysicianName;
        }
Exemple #10
0
        public string FinishQuestionnaire(object result)
        {
            string ret = string.Empty;

            if (null == (result))
            {
                return(ret);
            }

            Dictionary <string, object> dicResult = (Dictionary <string, object>)result;

            JSResult jsResult = new JSResult();

            List <JSOptions> jsOptions = new List <JSOptions>();

            jsResult.QuestionnaireID = Convert.ToInt32(dicResult["QuestionnaireID"]);

            Questionnaire qn = QuestionWorkflow.Instance().Questionnaire;

            string resultCode = string.Empty;

            object[] objOptions = (object[])dicResult["Options"];

            for (int i = 0; i < objOptions.Length; i++)
            {
                Dictionary <string, object> dicOption = (Dictionary <string, object>)objOptions[i];

                JSOptions jso = new JSOptions()
                {
                    key = dicOption["key"].ToString(), value = Convert.ToInt32(dicOption["val"])
                };

                jsOptions.Add(jso);
            }

            jsResult.Options = jsOptions;



            switch (jsResult.QuestionnaireID)
            {
            case 1:
                ret = QuestionHelper.resultMessage1(qn, jsResult, out resultCode);
                break;

            case 2:
                ret = QuestionHelper.resultMessage2(qn, jsResult, out resultCode);
                break;

            case 3:
                ret = QuestionHelper.resultMessage3(qn, jsResult, out resultCode);
                break;

            case 4:
                ret = QuestionHelper.resultMessage4(qn, jsResult, out resultCode);
                break;

            case 5:
                ret = QuestionHelper.resultMessage5(qn, jsResult, out resultCode);
                break;

            case 6:
                ret = QuestionHelper.resultMessage6(qn, jsResult, out resultCode);
                break;

            case 7:
                ret = QuestionHelper.resultMessage7(qn, jsResult, out resultCode);
                break;

            case 8:
                ret = QuestionHelper.resultMessage8(qn, jsResult, out resultCode);
                break;

            case 9:
                ret = QuestionHelper.resultMessage9(qn, jsResult, out resultCode);
                break;

            case 10:
                ret = QuestionHelper.resultMessage10(qn, jsResult, out resultCode);
                break;

            case 11:

                ret = QuestionHelper.resultMessage11(qn, jsResult, out resultCode);

                break;

            case 12:

                ret = QuestionHelper.resultMessage12(qn, jsResult, out resultCode);

                break;

            case 13:

                ret = QuestionHelper.resultMessage13(qn, jsResult, out resultCode);

                break;

            case 14:

                ret = QuestionHelper.resultMessage14(qn, jsResult, out resultCode);

                break;

            case 15:

                ret = QuestionHelper.resultMessage15(qn, jsResult, out resultCode);

                break;
            }

            Tuple <bool, string> saveResult = QuestionWorkflow.Instance().SaveWorkflow(ret, resultCode);


            return("{\"code\":" + (saveResult.Item1?1:0) + ",\"message\":\"" + (string.IsNullOrEmpty(saveResult.Item2)? "无法确定基本体质": saveResult.Item2) + "\"}");
        }