Пример #1
0
        public static void createReport(string userId)
        {
            if (string.IsNullOrWhiteSpace(userId))
            {
                return;
            }

            DataSet ds = TmoShare.getDataSetFromXML(riskxml, true);

            if (ds.Tables[0].Rows.Count == 0)
            {
                ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
            }
            ds.Tables[0].Rows[0]["user_id"] = userId;

            string  riskDxml  = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetTimes, new object[] { userId });
            DataSet riskState = TmoShare.getDataSetFromXML(riskDxml);

            if (riskState != null && riskState.Tables.Count > 0 && riskState.Tables[0] != null && riskState.Tables[0].Rows.Count > 0)
            {
                if (riskState.Tables[0].Rows[0] != null && riskState.Tables[0].Rows[0]["isrisk"].ToString() == "1")
                {
                    ds.Tables[0].Rows[0]["user_time"] = riskState.Tables[0].Rows[0]["user_times"];
                    string selexml = TmoShare.getXMLFromDataSet(ds);
                    string strmlx  = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetRiskData, new object[] { selexml });
                    ds = TmoShare.getDataSetFromXML(strmlx);

                    string c = CreateReport.pphase_Result(ds.Tables[0], ds.Tables[1], "1");
                    if (c == "1")
                    {
                        DXMessageBox.ShowWarning2("生成评估数据成功,请到输出报告查看!");
                    }
                    else if (c == "2")
                    {
                        DXMessageBox.ShowWarning2("生成评估数据失败");
                    }
                    else
                    {
                        DXMessageBox.ShowSuccess("恭喜您,您的身体非常健康\r\n我们暂时无法给你出报告!");
                    }
                }
                else if (riskState.Tables[0].Rows[0] != null && riskState.Tables[0].Rows[0]["isrisk"].ToString() == "2")
                {
                    DXMessageBox.ShowWarning2("已经评估过!");
                }
                else
                {
                    DXMessageBox.ShowWarning2("问卷处于暂存状态,请填写完成问卷!");
                }
            }
            else
            {
                DXMessageBox.ShowWarning2("暂时不能评估");
            }
        }
Пример #2
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            object obj = TmoServiceClient.InvokeServerMethodT <bool>(txtServerIP.Text, Convert.ToInt32(txtServerPort.Text), funCode.CheckLink);

            if (obj is bool && ((bool)obj))
            {
                DXMessageBox.ShowSuccess("测试连接成功!", this);
            }
            else
            {
                DXMessageBox.ShowWarning("测试连接失败!", this);
            }
        }
Пример #3
0
 void btnAll_Click(object sender, EventArgs e)
 {
     if (IsAll)
     {
         bool isSuccess = submit();
         if (!isSuccess)
         {
             DXMessageBox.ShowError("保存失败!");
         }
         else
         {
             DXMessageBox.ShowSuccess("保存成功!");
             IsAll = !IsAll;
         }
     }
     else
     {
         IsAll = !IsAll;
     }
 }
Пример #4
0
        void btnRisk_Click(object sender, EventArgs e)
        {
            if (CheckedRowIndexs.Count == 0)
            {
                return;
            }
            DataRow dr = gridView1.GetDataRow(CheckedRowIndexs[0]);

            if (dr != null && dr["isrisk"] != null)
            {
                if (dr["isrisk"].ToString() == "已评估")
                {
                    DXMessageBox.ShowWarning2("已经评估过!");
                    return;
                }
                else if (dr["isrisk"].ToString() == "暂存")
                {
                    DXMessageBox.ShowWarning2("问卷处于暂存状态,请填写完成问卷!");
                    return;
                }
            }
            else
            {
                return;
            }
            DataSet ds = TmoShare.getDataSetFromXML(riskxml, true);

            if (ds.Tables[0].Rows.Count == 0)
            {
                ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
            }
            ds.Tables[0].Rows[0]["user_id"] = dr["user_id"];

            string  riskDxml  = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetTimes, new object[] { dr["user_id"].ToString() });
            DataSet riskState = TmoShare.getDataSetFromXML(riskDxml);

            if (riskState != null && riskState.Tables.Count > 0 && riskState.Tables[0] != null && riskState.Tables[0].Rows.Count > 0)
            {
                if (riskState.Tables[0].Rows[0] != null && riskState.Tables[0].Rows[0]["isrisk"].ToString() == "1")
                {
                    ds.Tables[0].Rows[0]["user_time"] = riskState.Tables[0].Rows[0]["user_times"];
                    string selexml = TmoShare.getXMLFromDataSet(ds);
                    string strmlx  = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetRiskData, new object[] { selexml });
                    ds = TmoShare.getDataSetFromXML(strmlx);

                    string c = CreateReport.pphase_Result(ds.Tables[0], ds.Tables[1], "1");
                    if (c == "1")
                    {
                        DXMessageBox.ShowWarning2("生成评估数据成功");
                        GetData();
                    }
                    else if (c == "2")
                    {
                        DXMessageBox.ShowWarning2("生成评估数据失败");
                    }
                    else
                    {
                        DXMessageBox.ShowSuccess("恭喜您,您的身体非常健康\r\n我们暂时无法给你出报告!");
                    }
                }
                else if (riskState.Tables[0].Rows[0] != null && riskState.Tables[0].Rows[0]["isrisk"].ToString() == "2")
                {
                    DXMessageBox.ShowWarning2("已经评估过!");
                }
                else
                {
                    DXMessageBox.ShowWarning2("问卷处于暂存状态,请填写完成问卷!");
                }
            }
            else
            {
                DXMessageBox.ShowWarning2("暂时不能评估");
            }
        }
Пример #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string contype = "";

            if (cmproType.SelectedIndex == 0)
            {
                DXMessageBox.Show("请选择题目答案的类型");
            }
            else
            {
                switch (cmproType.SelectedIndex)
                {
                case 1:
                    contype = "1";
                    break;

                case 2:
                    contype = "4";
                    break;

                case 3:
                    contype = "5";
                    break;

                case 4:
                    contype = "6";
                    break;
                }
            }
            if (string.IsNullOrEmpty(dic_name.Text))
            {
                DXMessageBox.Show("指标名称不能为空");
                return;
            }
            bool dicNametur = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.checkname, new object[] { dic_name.Text });

            if (!dicNametur)
            {
                DXMessageBox.Show("该指标名称已经被使用"); return;
            }
            if (string.IsNullOrEmpty(control_static.Text) && control_static.Visible)
            {
                DXMessageBox.Show("答案不能为空"); return;
            }

            DataTable dt = new DataTable();

            dt.TableName = "dd";
            dt.Columns.Add("dic_id", typeof(string));
            dt.Columns.Add("dic_name", typeof(string));
            dt.Columns.Add("dic_unit", typeof(string));
            dt.Columns.Add("control_type", typeof(string));
            dt.Columns.Add("contorl_static", typeof(string));
            DataRow drd = dt.NewRow();

            drd["dic_name"]       = dic_name.Text;
            drd["dic_unit"]       = dic_unit.Text;
            drd["control_type"]   = contype;
            drd["contorl_static"] = control_static.Text;

            if (update)
            {
                drd["dic_id"] = drinput["dic_id"];
                dt.Rows.Add(drd);
                string xml       = TmoShare.getXMLFromDataTable(dt);
                bool   updteTrue = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.updatemedic, new object[] { xml });
                if (updteTrue)
                {
                    DXMessageBox.ShowSuccess("修改成功");
                }
                else
                {
                    DXMessageBox.ShowWarning2("修改失败");
                }
            }
            else
            {
                dt.Rows.Add(drd);
                string xml       = TmoShare.getXMLFromDataTable(dt);
                bool   updteTrue = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.medicadd, new object[] { xml });
                if (updteTrue)
                {
                    DXMessageBox.ShowSuccess("添加成功");
                }
                else
                {
                    DXMessageBox.ShowWarning2("添加失败");
                }
            }
        }