예제 #1
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <returns></returns>
        public DataTable GetData(string entityName, string[] columns = null, string where = null, string pkName = null, string pkValue = null, string order = null, bool sortDesc = false)
        {
            FE_GetDataParam getDataParam = new FE_GetDataParam();

            getDataParam.Sources = entityName;
            if (columns != null)
            {
                getDataParam.Columns.AddRange(columns);
            }
            getDataParam.AddWhere(where);
            getDataParam.PrimaryKey      = pkName;
            getDataParam.PrimaryKeyValue = pkValue;
            if (order != null)
            {
                getDataParam.OrderByConditons.Add(new OrderByCondition(order, sortDesc));
            }

            DataSet ds = GetData(getDataParam);

            if (TmoShare.DataSetIsEmpty(ds))
            {
                return(null);
            }
            return(ds.Tables.Contains("tmo_data") ? ds.Tables["tmo_data"] : ds.Tables[0]);
        }
예제 #2
0
        public DataTable GetAttchs(string userID, string userTImes, string newOrold)
        {
            string sql = "select * from tmo_web_attachment_new where user_id='" + userID + "' and user_times='" + userTImes + "'";

            if (newOrold == "old")
            {
                sql = "select * from tmo_web_attachment where user_id='" + userID + "' and user_times='" + userTImes + "'";
            }
            DataSet ds = MySQLHelper.Query(sql);

            if (TmoShare.DataSetIsEmpty(ds))
            {
                return(null);
            }
            else
            {
                DataRow drData = ds.Tables[0].Rows[0];
                ds.Tables[0].Columns.Add("content_bt", typeof(byte[]));
                string filename = drData["filename"].ToString();
                if (string.IsNullOrEmpty(filename))
                {
                    //ds.Tables[0].Rows[0]["filename"] = "1";
                    return(ds.Tables[0]);
                }

                string path = System.AppDomain.CurrentDomain.BaseDirectory + "words\\" + filename;
                byte[] by   = File.ReadAllBytes(path);
                ds.Tables[0].Rows[0]["content_bt"] = by;
                return(ds.Tables[0]);
            }
        }
예제 #3
0
        /// <summary>
        /// 获取分页数据
        /// ldd
        /// </summary>
        /// <param name="sbColumns">查询所有列名 包含select 如:select a,b,c from </param>
        /// <param name="sbBody">查询条件和所有关联表 table A inner join table B where  ...</param>
        /// <param name="groupStr">分组和排序字符串 group by... order by...</param>
        /// <param name="PageSize">每页显示多少条数据,如果为-1则不分页查询所有数据 </param>
        /// <param name="NowPage">当前第几页</param>
        /// <returns></returns>
        public static DataSet GetPagingData(StringBuilder sbColumns, StringBuilder sbBody, string groupStr, int PageSize, int NowPage, out string err_tip)
        {
            try
            {
                object obj = GetCountNum(sbBody);
                if (obj == null || obj.ToString() == "0")
                {
                    err_tip = "all_null";
                    return(null);
                }
                int       totalRowCount = Convert.ToInt32(obj);
                DataSet   ds            = new DataSet("tmodata");
                DataTable dtCount       = new DataTable("Count");
                dtCount.Rows.Add(dtCount.NewRow());
                DataColumn c = new DataColumn("totalRowCount", typeof(int));
                c.DefaultValue = totalRowCount;
                dtCount.Columns.Add(c);
                ds.Tables.Add(dtCount);

                string sql = sbBody.ToString() + "" + groupStr;

                if (PageSize != -1)//如果为-1则不分页查询所有数据
                {
                    if (NowPage >= 1)
                    {
                        sql += " limit " + PageSize * (NowPage - 1) + ", " + PageSize;
                    }
                    else
                    {
                        sql += " limit 0, " + PageSize;
                    }
                }
                sql = sbColumns.ToString() + sql;

                DataSet dsTemp = MySQLHelper.Query(sql);

                if (TmoShare.DataSetIsEmpty(dsTemp))
                {
                    err_tip = "err_field";
                    return(null);
                }
                else
                {
                    err_tip = "success";
                }
                ds.Tables.Add(dsTemp.Tables[0].Copy());
                return(ds);
            }
            catch
            {
                err_tip = "all_null";
                return(null);
            }
        }
예제 #4
0
        public bool SendEmail(string emailXML, out string err_tip)
        {
            #region 参数处理
            err_tip = null;
            if (string.IsNullOrWhiteSpace(emailXML))
            {
                err_tip = "传入参数为空";
                return(false);
            }

            var ds = TmoShare.getDataSetFromXML(emailXML);
            if (ds == null)
            {
                err_tip = "传入参数非DataSet格式";
                return(false);
            }
            if (TmoShare.DataSetIsEmpty(ds))
            {
                err_tip = "传入DataSet数据为空";
                return(false);
            }
            #endregion

            var    dr            = ds.Tables[0].Rows[0];
            string user_code     = dr.GetDataRowStringValue("user_code");
            string sendaccount   = dr.GetDataRowStringValue("sendaccount");
            string sendEmail     = EmailHelper.Instance.MailFrom;
            string sendToaccount = dr.GetDataRowStringValue("sendToaccount");
            string sendcontent   = dr.GetDataRowStringValue("sendcontent");
            string sendtitle     = dr.GetDataRowStringValue("sendtitle");
            string sendtype      = dr.GetDataRowStringValue("sendtype");
            string doc_code      = dr.GetDataRowStringValue("doc_code");

            //发送邮件
            bool sendsuc = EmailHelper.Instance.SendMail(sendtitle, sendcontent, sendaccount, sendToaccount, out err_tip);
            if (sendsuc)
            {
                string sql =
                    "insert into tmo_sendemail(user_code,sendaccount,sendEmail,sendToaccount,sendcontent,sendtitle,sendtype,doc_code,input_time) values" +
                    String.Format("('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',sysdate())",
                                  user_code, sendaccount, sendEmail, sendToaccount, sendcontent, sendtitle, sendtype, doc_code);
                int n = MySQLHelper.ExecuteSql(sql);
                if (n < 1)
                {
                    err_tip = "发送邮件成功,但保存记录失败";
                }

                return(true);
            }
            return(false);
        }
예제 #5
0
        public bool SendSms(string smsXML, out string err_tip, out int rt_code)
        {
            #region 参数处理
            err_tip = null;
            rt_code = -99;
            if (string.IsNullOrWhiteSpace(smsXML))
            {
                err_tip = "传入参数为空";
                return(false);
            }

            var ds = TmoShare.getDataSetFromXML(smsXML);
            if (ds == null)
            {
                err_tip = "传入参数非DataSet格式";
                return(false);
            }
            if (TmoShare.DataSetIsEmpty(ds))
            {
                err_tip = "传入DataSet数据为空";
                return(false);
            }
            #endregion

            var    dr        = ds.Tables[0].Rows[0];
            string user_code = dr.GetDataRowStringValue("user_code");
            string mobile    = dr.GetDataRowStringValue("mobile");
            string message   = dr.GetDataRowStringValue("message");
            string type      = dr.GetDataRowStringValue("type");
            string doc_code  = dr.GetDataRowStringValue("doc_code");

            //发送短信
            bool sendsuc = SMSHelper.Instance.SendSms(mobile, message, out err_tip, out rt_code);
            if (sendsuc)
            {
                string sql =
                    "insert into tmo_sendsms(user_code,mobile,message,type,doc_code,input_time) values" +
                    String.Format("('{0}','{1}','{2}','{3}','{4}',sysdate())", user_code, mobile, message, type, doc_code);
                int n = MySQLHelper.ExecuteSql(sql);
                if (n < 1)
                {
                    err_tip = "发送短信成功,但保存记录失败";
                }

                return(true);
            }
            return(false);
        }
예제 #6
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <returns></returns>
        public DataTable GetData(string entityName, string[] columns, string where = null, string pkName = null, string pkValue = null, string order = null, bool sortDesc = false, int pageSize = -1)
        {
            FE_GetDataParam getDataParam = new FE_GetDataParam();

            getDataParam.Sources = entityName;
            if (columns != null && columns.Length > 0)
            {
                getDataParam.Columns.AddRange(columns);
            }
            getDataParam.AddWhere(where);
            getDataParam.PrimaryKey      = pkName;
            getDataParam.PrimaryKeyValue = pkValue;
            if (order != null)
            {
                getDataParam.OrderByConditons.Add(new OrderByCondition()
                {
                    Col = order, IsDesc = sortDesc
                });
            }
            if (pageSize != -1)
            {
                getDataParam.PageIndex = 1;
                getDataParam.PageSize  = pageSize;
            }

            DataSet ds = GetData(getDataParam);

            if (TmoShare.DataSetIsEmpty(ds))
            {
                return(null);
            }
            if (ds.Tables.Contains("tmo_data"))
            {
                return(ds.Tables["tmo_data"]);
            }
            else
            {
                DataTable dt = ds.Tables[0];
                if (dt.TableName == "tmo_count")
                {
                    return(null);
                }
                return(dt);
            }
        }
        public bool PushAddWxMsg(string strxml)
        {
            DataSet dt = TmoShare.getDataSetFromXML(strxml);

            if (TmoShare.DataSetIsEmpty(dt))
            {
                return(false);
            }

            DataRow row      = dt.Tables[0].Rows[0];
            string  doc_code = "admin";
            string  MsgId    = row["MsgId"].ToString();
            string  wx_type  = "1";

            if (string.IsNullOrEmpty(row["wx_type"].ToString()))
            {
                wx_type = "1";
            }
            else
            {
                wx_type = row["wx_type"].ToString();
            }
            string sqls = "insert into tmo_weixin_content (doc_code,token_open_id,message_content,create_time,input_time,wm_id,is_del,r_mark,wx_type,media_id,format,MsgId,picturedata)" +
                          " SELECT '" + doc_code + "','" + row["token_open_id"] + "','" + row["message_content"].ToString() + "','" + row["create_time"].ToString() + "','" + System.DateTime.Now +
                          "','" + row["wm_id"].ToString() + "',1,'" + row["r_mark"].ToString() + "'," + wx_type + ",'" + row["media_id"].ToString() + "','" + row["format"].ToString() + "','" + MsgId + "', " +
                          "?picturedata FROM DUAL where NOT EXISTS(SELECT MsgId FROM tmo_weixin_content WHERE MsgId = '" + MsgId + "')";
            MySqlParameter myparameter = new MySqlParameter("?picturedata", MySqlDbType.MediumBlob);

            if (wx_type == "2")
            {
                myparameter.Value = GetMultimedia(row["message_content"].ToString());
            }
            else
            {
                myparameter.Value = DBNull.Value;
            }

            int num = MySQLHelper.ExecuteSql(sqls, myparameter);

            if (num > 0)
            {
                return(true);
            }
            return(false);
        }
예제 #8
0
        public bool AddModel(string xml)
        {
            DataSet ds = TmoShare.getDataSetFromXML(xml);

            if (TmoShare.DataSetIsEmpty(ds))
            {
                return(false);
            }
            StringBuilder strSql   = new StringBuilder();
            StringBuilder strkey   = new StringBuilder();
            StringBuilder strvalue = new StringBuilder();

            DataRow dr = ds.Tables[0].Rows[0];

            strSql.Append("insert into " + dr["table_name"] + " ");

            int j = ds.Tables[0].Columns.Count;
            int i = 1;

            foreach (DataColumn dc in ds.Tables[0].Columns)
            {
                string value = "";
                if (dc.ColumnName == "table_name")
                {
                    i++; continue;
                }
                else if (dc.ColumnName.Contains("guid"))
                {
                    value = Guid.NewGuid().ToString("N");
                }
                else if (dc.ColumnName == "input_time")
                {
                    value = DateTime.Now.ToString();
                }
                else if (dc.ColumnName == "is_del")
                {
                    value = "2";
                }
                else
                {
                    value = dr[dc.ColumnName.ToString()].ToString();
                }

                if (i == 1)
                {
                    strkey.Append(" (" + dc.ColumnName.ToString() + ", ");
                    strvalue.Append(" (" + value + ",");
                }
                else if (i == j)
                {
                    strkey.Append(" " + dc.ColumnName.ToString() + ")");
                    strvalue.Append(" " + value + ")");
                }
                else
                {
                    strkey.Append(dc.ColumnName.ToString() + ", ");
                    strvalue.Append(value + ", ");
                }
                i++;
            }
            strSql.Append(strkey.ToString());
            strSql.Append(" values ");
            strSql.Append(strvalue.ToString());
            int num = MySQLHelper.ExecuteSql(strSql.ToString());

            return(num > 0?true:false);
        }
예제 #9
0
        /// <summary>
        /// 监测数据推送微信
        /// </summary>
        /// <param name="state"></param>
        private void MonitorSendWe(object state)
        {
            string data     = @"<data>
                                <first>
                                    <value></value>
                                    <color></color>
                                </first>
                                <keyword1>
                                    <value></value>
                                    <color></color>
                                </keyword1>
                                <keyword2>
                                    <value></value>
                                    <color></color>
                                </keyword2>
                                <keyword3>
                                    <value></value>
                                    <color></color>
                                </keyword3>
                                <remark>
                                    <value></value>
                                    <color></color>
                                </remark>        
                            </data>";
            string result   = "";
            string testName = "";

            if ((DateTime.Now - lastMonitorSendWeTime).TotalSeconds >= 30) //30秒查询一次
            {
                var dtUser = Tmo_FakeEntityManager.Instance.GetData("tmo_monitor",
                                                                    new[] { "user_id", "mt_code", "mt_valueint", "mt_time", "mt_valuefloat", "mt_isnormal", "id", "mt_timestamp" },
                                                                    "mt_code in (100,101,102,103) and we_send ='2' and mt_time>=date_add(NOW(), interval -7 day)", null, null, null, false, 1000);
                if (TmoShare.DataTableIsNotEmpty(dtUser))
                {
                    List <string> skipIds = new List <string>();
                    foreach (DataRow dr in dtUser.Rows)
                    {
                        string id = dr.GetDataRowStringValue("id");
                        if (skipIds.Contains(id))
                        {
                            continue;                       //跳过处理过的血压数据
                        }
                        string userid = dr.GetDataRowStringValue("user_id");
                        if (string.IsNullOrWhiteSpace(userid))
                        {
                            continue;
                        }
                        //查询微信绑定
                        string myweixin = tmo_userinfo_tokenManager.Instance.GetBindId(userid);
                        //查询亲友是否绑定微信
                        DataSet familyds = tmo_userinfoManager.Instance.IsBindFamily(userid);
                        if (string.IsNullOrWhiteSpace(myweixin) && TmoShare.DataSetIsEmpty(familyds))
                        {
                            continue; //没有绑定微信 跳过
                        }
                        List <string> ids = new List <string>();
                        ids.Add(id);

                        string timestamp = dr.GetDataRowStringValue("mt_timestamp");

                        #region 组织发送内容

                        switch (dr["mt_code"].ToString())
                        {
                        case "100":     //舒张压
                            DataRow[] rows = dtUser.Select(string.Format("mt_code=101 and user_id='{0}' and mt_timestamp='{1}'", userid, timestamp));
                            string    ssy  = null;
                            if (rows.Length > 0)
                            {
                                ssy = rows[0].GetDataRowStringValue("mt_valueint");
                                string ssyid = rows[0].GetDataRowStringValue("id");
                                skipIds.Add(ssyid);
                                ids.Add(ssyid);
                            }

                            if (ssy == null)
                            {
                                result = "【舒张压】" + dr["mt_valueint"].ToString() + "mmHg";
                            }
                            else
                            {
                                result = ssy + "/" + dr.GetDataRowStringValue("mt_valueint") + " mmHg";
                            }
                            testName = "血压";
                            break;

                        case "101":     //收缩压
                            DataRow[] row1s = dtUser.Select(string.Format("mt_code=100 and user_id='{0}' and mt_timestamp='{1}'", userid, timestamp));
                            string    szy   = null;
                            if (row1s.Length > 0)
                            {
                                szy = row1s[0].GetDataRowStringValue("mt_valueint");
                                string szyid = row1s[0].GetDataRowStringValue("id");
                                skipIds.Add(szyid);
                                ids.Add(szyid);
                            }

                            if (szy == null)
                            {
                                result = "【收缩压】" + dr["mt_valueint"].ToString() + "mmHg";
                            }
                            else
                            {
                                result = dr.GetDataRowStringValue("mt_valueint") + "/" + szy + " mmHg";
                            }
                            testName = "血压";
                            break;

                        case "102":     //心率
                            result   = dr["mt_valueint"].ToString() + "次/分钟";
                            testName = "心率";
                            break;

                        case "103":     //血糖
                            result   = dr["mt_valuefloat"].ToString() + "mmol/L";
                            testName = "血糖";
                            break;

                        default:
                            break;
                        }

                        #endregion

                        #region 发送给自己

                        //查询自己是否绑定微信
                        if (!string.IsNullOrEmpty(myweixin))
                        {
                            DataSet ds = TmoShare.getDataSetFromXML(data);

                            ds.Tables["first"].Rows[0]["value"] = "尊敬的用户,您刚刚完成的测量:";
                            ds.Tables["first"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray);

                            ds.Tables["keyword1"].Rows[0]["value"] = string.Format("[{0}]", testName);
                            ds.Tables["keyword1"].Rows[0]["color"] = "#507ED3";
                            ds.Tables["keyword2"].Rows[0]["value"] = dr.GetDataRowDateTimeValue("mt_time").ToString("yyyy年MM月dd日 HH:mm:ss");
                            ds.Tables["keyword2"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray);
                            ds.Tables["keyword3"].Rows[0]["value"] = result;
                            ds.Tables["keyword3"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Green);
                            ds.Tables["remark"].Rows[0]["value"]   = "建议您养成定期测量" + testName + "的习惯,感谢您的使用!";
                            ds.Tables["remark"].Rows[0]["color"]   = TmoShare.RGBToWebColor(Color.Gray);
                            string content = TmoCommon.TmoShare.GetXml_NO_TITLE(ds);

                            string idstr = string.Join(",", ids);
                            Dictionary <string, object> dicVals = new Dictionary <string, object>();
                            dicVals.Add("push_id", idstr);
                            dicVals.Add("user_code", userid);
                            dicVals.Add("push_type", 6);
                            dicVals.Add("push_address", myweixin);
                            dicVals.Add("content_type", "1");
                            dicVals.Add("content_title", "健康监测消息推送");
                            dicVals.Add("content_value", content);
                            dicVals.Add("push_status", 1);
                            dicVals.Add("doc_code", "admin");
                            dicVals.Add("remark", "weMonitor");

                            bool suc = tmo_push_listManager.Instance.AddToPushList(dicVals);
                            if (suc)
                            {
                                tmo_monitorManager.Instance.UpdateWXState(idstr, 3); //推送中
                            }
                        }

                        #endregion

                        #region 发送给绑定的家人

                        if (TmoShare.DataSetIsNotEmpty(familyds))
                        {
                            #region 用户信息

                            string   username = userid;
                            Userinfo user     = tmo_userinfoManager.Instance.GetUserInfoByID(userid);
                            if (user != null)
                            {
                                username = user.name;
                            }

                            #endregion

                            for (int i = 0; i < familyds.Tables[0].Columns.Count; i++)
                            {
                                DataColumn cloum    = familyds.Tables[0].Columns[i];
                                string     key      = cloum.ColumnName;
                                string     familyId = familyds.Tables[0].Rows[0][key].ToString();
                                if (string.IsNullOrEmpty(familyId))
                                {
                                    continue;
                                }

                                string familyweixin = tmo_userinfo_tokenManager.Instance.GetBindId(familyId);
                                if (!string.IsNullOrWhiteSpace(familyweixin))
                                {
                                    DataSet ds = TmoShare.getDataSetFromXML(data);

                                    ds.Tables["first"].Rows[0]["value"]    = "尊敬的用户,您的亲人" + username + "刚刚完成的测量:";
                                    ds.Tables["first"].Rows[0]["color"]    = TmoShare.RGBToWebColor(Color.Gray);
                                    ds.Tables["keyword1"].Rows[0]["value"] = string.Format("[{0}]", testName);
                                    ds.Tables["keyword1"].Rows[0]["color"] = "#507ED3";
                                    ds.Tables["keyword2"].Rows[0]["value"] = dr.GetDataRowDateTimeValue("mt_time").ToString("yyyy年MM月dd日 HH:mm:ss");
                                    ds.Tables["keyword2"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray);
                                    ds.Tables["keyword3"].Rows[0]["value"] = result;
                                    ds.Tables["keyword3"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Green);
                                    ds.Tables["remark"].Rows[0]["value"]   = "感谢您的使用!";
                                    ds.Tables["remark"].Rows[0]["color"]   = TmoShare.RGBToWebColor(Color.Gray);
                                    string content = TmoCommon.TmoShare.GetXml_NO_TITLE(ds);

                                    string idstr = string.Join(",", ids);
                                    Dictionary <string, object> dicVals = new Dictionary <string, object>();
                                    dicVals.Add("push_id", idstr + "," + -1 * (i + 1));
                                    dicVals.Add("user_code", userid);
                                    dicVals.Add("push_type", 6);
                                    dicVals.Add("push_address", familyweixin);
                                    dicVals.Add("content_type", "1");
                                    dicVals.Add("content_title", "健康监测消息推送");
                                    dicVals.Add("content_value", content);
                                    dicVals.Add("push_status", 1);
                                    dicVals.Add("doc_code", "admin");
                                    dicVals.Add("remark", "weMonitor");

                                    bool suc = tmo_push_listManager.Instance.AddToPushList(dicVals);
                                    if (suc)
                                    {
                                        tmo_monitorManager.Instance.UpdateWXState(idstr, 3); //推送中
                                    }
                                }
                            }
                        }

                        #endregion
                    }
                }

                lastMonitorSendWeTime = DateTime.Now;
            }

            ((ManualResetEvent)((object[])state)[0]).Set();
        }
예제 #10
0
        void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            DataRow dr = gridView2.GetDataRow(e.RowHandle);

            if (e.Column.Name == "look_report")
            {
                if (dr["look_report"].ToString() == "---")
                {
                    return;
                }
                if (dr["projectState"].ToString() == "已生成")
                {
                    DXMessageBox.ShowWarning2("该用户此次评估已有解决方案!不能重复生成");
                    return;
                }

                string  user_idd    = dr["user_id"].ToString();
                string  user_timesd = dr["user_times"].ToString();
                string  xmlreturn   = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProResult, new object[] { user_idd, user_timesd, "" });
                DataSet ds          = TmoShare.getDataSetFromXML(xmlreturn);
                if (!TmoShare.DataSetIsEmpty(ds) && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    DXMessageBox.ShowWarning2("该用户此次评估已有解决方案!不能重复生成");
                    return;
                }
                else
                {
                    var frm = new FrmSelectNur(user_idd, user_timesd);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        ShengPro(user_idd, user_timesd);
                    }
                    frm.Dispose();
                }
            }
            else if (e.Column.Name == "look_project")
            {
                string user_idd    = dr["user_id"].ToString();
                string user_timesd = dr["user_times"].ToString();

                string  xmlreturn = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProResult, new object[] { user_idd, user_timesd, "" });
                DataSet ds        = TmoShare.getDataSetFromXML(xmlreturn);
                if (!TmoShare.DataSetIsEmpty(ds) && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    string named = dr["name"].ToString();
                    //frmPlanShow frmp = new frmPlanShow();
                    frmtest frmp = new frmtest();
                    frmp.Indata(user_idd, user_timesd, named, dr);
                    frmp.Enabled = true;
                    frmp.ShowDialog();
                    frmp.Dispose();
                }
                else
                {
                    DXMessageBox.ShowWarning2("该用户此次评估暂无解决方案!请先生成解决方案");
                    return;
                }
            }
            else if (e.Column.Name == "del")
            {
                if (dr["del"].ToString() == "---")
                {
                    return;
                }
                if (dr["projectState"].ToString() == "已生成")
                {
                    Delrow = dr;

                    DXMessageBox.btnOKClick += DXMessageBox_btnOKClick;
                    DXMessageBox.ShowQuestion("确定要删除吗");
                }
                else
                {
                    DXMessageBox.Show("没有生成方案不能删除!");
                }
            }
            else if (e.Column.Name == "user_id")
            {
                GetItemData(dr);
            }
        }
예제 #11
0
        /// <summary>
        /// 生成解决方案
        /// </summary>
        /// <param name="user_idd"></param>
        /// <param name="user_timesd"></param>
        void ShengPro(string user_idd, string user_timesd)
        {
            this.ShowWaitingPanel(() =>
            {
                try
                {
                    List <string> disnames    = new List <string>();
                    List <string> project_ids = new List <string>();
                    DataSet inputProds        = TmoShare.getDataSetFromXML(proxml);
                    if (inputProds != null && inputProds.Tables.Count > 0 && inputProds.Tables[0] != null)
                    {
                        inputProds.Tables[0].Rows.Clear();
                    }

                    string resxml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetRiskResult, new object[] { user_idd, user_timesd });
                    DataSet ds    = TmoShare.getDataSetFromXML(resxml);
                    if (TmoShare.DataSetIsEmpty(ds))
                    {
                        return("2");
                    }
                    else
                    {
                        foreach (DataRow disanem in ds.Tables[0].Rows)
                        {
                            disnames.Add(disanem["moment_type"].ToString());
                        }
                    }

                    string resxmlprodic = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProjectDic, new object[] { "", "", "" });
                    DataSet dsprodic    = TmoShare.getDataSetFromXML(resxmlprodic);
                    if (TmoShare.DataSetIsEmpty(dsprodic))
                    {
                        return("2");
                    }
                    else
                    {
                        foreach (string disname in disnames)
                        {
                            var disnamenew = disname;
                            if (disname == "肾病五期") //糖尿病Ⅲ期肾病,糖尿病Ⅳ期肾病,糖尿病Ⅴ期肾病
                            {
                                disnamenew = "糖尿病Ⅴ期肾病";
                            }
                            if (disname == "肾病四期")
                            {
                                disnamenew = "糖尿病Ⅳ期肾病";
                            }
                            if (disname == "肾病三期")
                            {
                                disnamenew = "糖尿病Ⅲ期肾病";
                            }
                            if (disname == "视网膜病变背景期")
                            {
                                disnamenew = "糖尿病视网膜病变背景期";
                            }
                            if (disname == "糖尿病周围神经病变及自主神经病变")
                            {
                                disnamenew = "糖尿病神经病变";
                            }
                            foreach (DataRow row in dsprodic.Tables[0].Rows)
                            {
                                string[] dicstrs  = row["disease_name"].ToString().Split(',');
                                string project_id = row["project_id"].ToString();
                                if (project_ids.Contains(project_id))
                                {
                                    continue;
                                }

                                if (dicstrs.Contains(disnamenew))
                                {
                                    project_ids.Add(project_id);
                                    DataRow newdr          = inputProds.Tables[0].NewRow();
                                    newdr["user_id"]       = user_idd;
                                    newdr["user_times"]    = user_timesd;
                                    newdr["project_type"]  = row["project_type"];
                                    newdr["project_name"]  = row["project_name"];
                                    newdr["solve_content"] = row["solve_content"];
                                    inputProds.Tables[0].Rows.Add(newdr);
                                }
                            }
                        }

                        project_ids.Clear();
                        string inputproxml = TmoShare.getXMLFromDataSet(inputProds);
                        bool isuc          = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.InProResult, new object[] { inputproxml });
                        if (isuc)
                        {
                            return("1");
                        }
                        else
                        {
                            return("2");
                        }
                    }
                }
                catch (Exception)
                {
                    return("2");
                }
            }, x =>
            {
                try
                {
                    if (x.ToString() == "1")
                    {
                        DXMessageBox.Show("生成解决方案成功!", true);
                        GetData();
                    }
                    else
                    {
                        DXMessageBox.ShowWarning2("生成方案失败!请重试!");
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Log.Error("实体加载数据出错", ex);
                    DXMessageBox.ShowWarning2("数据加载失败!请重试!");
                }
            });
        }