public void GetComdata() { DataSet ds = TmoShare.getDataSetFromXML(TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProType, new object[] { "" })); DataTable dt = ds != null ? ds.Tables[0] : null; int intCount = (dt != null) ? dt.Rows.Count : 0; cmproType.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; // 设置 comboBox的文本值不能被编辑 cmproType.Properties.Items.Clear(); cmproType.Properties.Items.Insert(0, "全部类型"); if (intCount > 0) { for (int i = 0; i < intCount; i++) { cmproType.Properties.Items.Add(dt.Rows[i][0].ToString()); } } cmproType.SelectedIndex = 0; // 设置选中第1项 }
/// <summary> /// 发送消息 到指定的客户端 /// </summary> private void btnSend_Click(object sender, EventArgs e) { TCPServerClient client = lbClientList.SelectedItem as TCPServerClient; if (client != null) { string data = txtCmdTxt.Text.Trim(); List <string> datas = StringPlus.GetStrArray(data, ";"); if (datas.Count < 2) { if (string.IsNullOrWhiteSpace(datas[0])) { UserMessageBox.MessageError("发送内容不能为空!"); return; } bool suc = client.SendString(datas[0]); if (!suc) { UserMessageBox.MessageError("发送失败"); } } else { if (!TmoShare.IsNumricForInt(datas[0])) { UserMessageBox.MessageError("命令ID必须为整数"); return; } bool suc = client.SendCommand(int.Parse(datas[0]), datas[1]); if (!suc) { UserMessageBox.MessageError("发送失败"); } } } else { UserMessageBox.MessageInfo("请选择要发送的客户端"); } }
public bool Delete(string pushID, int trySendTimes, bool isTrue) { try { //查询次数 object pushCountobj = MySQLHelper.GetSingle("select push_count from tmo_push_list where push_id='" + pushID + "'"); int pushCount = 1; if (pushCountobj != null && !string.IsNullOrWhiteSpace(pushCountobj.ToString())) { pushCount = Convert.ToInt32(pushCountobj); } pushCount++; //每次自动加1 List <string> sqlList = new List <string>(); //成功删除数据,失败更新数据 string receiveSql = "UPDATE tmo_push_list SET push_count=" + pushCount + ",push_time='" + TmoShare.DateTimeNow + "' WHERE push_id='" + pushID + "'"; if (isTrue || pushCount >= trySendTimes) { string historySql = @"INSERT INTO tmo_push_history SELECT '" + TmoShare.GetGuidString() + "',user_code,push_type,push_address,content_type,content_title,content_value,content_url,{0}," + pushCount + ",'" + TmoShare.DateTimeNow + @"',doc_code,remark,input_time FROM tmo_push_list WHERE push_id = '" + pushID + "'"; historySql = isTrue ? string.Format(historySql, 1) : string.Format(historySql, 2); sqlList.Add(historySql); receiveSql = string.Format("delete from tmo_push_list where push_id='{0}'", pushID); } sqlList.Add(receiveSql); int rows = MySQLHelper.ExecuteSqlTran(sqlList); //将数据移动到历史表中 if (rows > 0) { return(true); } else { return(false); } } catch { return(false); } }
private void btnSendTemplateMsg_Click(object sender, EventArgs e) { string data = @"<data> <first> <value></value> <color></color> </first> <keyword1> <value></value> <color></color> </keyword1> <keyword2> <value></value> <color></color> </keyword2> <remark> <value></value> <color></color> </remark> </data>"; 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"] = "【心率】70次/分钟\n 【血压】113/71mmHg"; ds.Tables["keyword1"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Navy); ds.Tables["keyword2"].Rows[0]["value"] = "2014年12月25日 18时37分"; ds.Tables["keyword2"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray);; ds.Tables["remark"].Rows[0]["value"] = "感谢您的使用!"; ds.Tables["remark"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray);; string resCode = WeChatHelper.WXTemplateMsgSend(new object[] { "admin", txt_openid.Text.Trim(), lblTemplate_id.Text, "", TmoShare.ARGBToWebColor(Color.Green), TmoCommon.TmoShare.GetXml_NO_TITLE(ds) }); if (string.IsNullOrEmpty(resCode) || resCode.Contains("err")) { MessageBox.Show("模板消息发送失败!\r\n错误原因:" + resCode, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("模板消息发送成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void ComboBoxBind() { try { DataTable wzds = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.GetPublicList, "tmo_product_type", "is_del='1' ").Tables[0]; if (TmoShare.DataTableIsNotEmpty(wzds)) { this.BindDataTable(produtType, wzds, "type_name", "type_id"); } DataTable ztdt = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.GetPublicList, "tmo_product_list", " is_del='1' ").Tables[0]; if (TmoShare.DataTableIsNotEmpty(ztdt)) { this.BindDataTable(productId, ztdt, "product_name", "product_id"); } } catch (Exception) { } }
public static void Stop() { try { if (mInstance == null) { throw new InvalidOperationException("还未启动监测"); } if (th != null && th.ThreadState != System.Threading.ThreadState.Stopped) { th.Abort(); } mInstance.CrossThreadCalls(() => { mInstance.EndForm(); }); } catch (Exception ex) { TmoShare.WriteLog(ex.Message); } mInstance = null; th = null; }
void btnAllToSelected_Click(object sender, EventArgs e) { DataTable source = gridControlUnSelected.DataSource as DataTable; if (TmoShare.DataTableIsNotEmpty(source)) { var users = ModelConvertHelper <Userinfo> .ConvertToModel(source); if (users != null) { foreach (Userinfo user in users) { AddUserToSelected(user); } } } else { DXMessageBox.ShowInfo("查询结果为空", this); } }
private void ComboBoxBind() { try { DataTable wzds = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.GetPublicList, "tmo_web_aticle_type", " big_class='2' ").Tables[0]; if (TmoShare.DataTableIsNotEmpty(wzds)) { this.BindDataTable(optType, wzds, "type_name", "type_id"); } DataTable ztdt = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.GetPublicList, "tmo_web_aticle_type", " big_class='4' ").Tables[0]; if (TmoShare.DataTableIsNotEmpty(ztdt)) { this.BindDataTable(sectionType, ztdt, "type_name", "type_id"); } } catch (Exception) { } }
public static object MedicalInADD(string xml) { DataSet ds = TmoShare.getDataSetFromXML(xml); if (TmoCommon.TmoShare.DataSetIsEmpty(ds)) { return("-1"); } else { bool isTrue = tmo_medical_inManager.Instance.inputMedical(ds.Tables[0]); if (isTrue) { return("1"); } else { return("-1"); } } }
public CheckBoxGroup(string checkboxJsonStr, string valueJsonStr) { InitializeComponent(); if (string.IsNullOrWhiteSpace(checkboxJsonStr)) { return; } List <T> value = null; if (!string.IsNullOrWhiteSpace(valueJsonStr)) { value = TmoShare.GetValueFromJson <List <T> >(valueJsonStr); } Dictionary <string, T> dic = JsonConvert.DeserializeObject <Dictionary <string, T> >(checkboxJsonStr); foreach (var item in dic) { CheckBox checkBox = new CheckBox(); checkBox.AutoSize = true; checkBox.Text = item.Key; checkBox.Tag = item.Value; if (value != null && value.Contains(item.Value)) { checkBox.Checked = true; } else { checkBox.Checked = false; } checkBox.CheckedChanged += (sender, args) => { if (SelectedChanged != null) { SelectedChanged(sender, args); } }; flowLayoutPanel1.Controls.Add(checkBox); } }
/// <summary> /// 跟据部门ID得到部门名字 /// </summary> /// <returns></returns> public string GetDepartmentNamesFromIDs(string ids) { if (string.IsNullOrWhiteSpace(ids)) { return(string.Empty); } if (TmoShare.DataTableIsEmpty(tmo_department)) { tmo_department = Tmo_FakeEntityClient.Instance.GetData("tmo_department"); } if (TmoShare.DataTableIsEmpty(tmo_department)) { return(string.Empty); } string[] idarray = ids.Split(','); List <string> idlist = new List <string>(); foreach (string s in idarray) { if (TmoShare.IsNumricForInt(s)) { idlist.Add(s); } } ids = StringPlus.GetArrayStr(idlist, ",", "'{0}'"); if (string.IsNullOrEmpty(ids)) { return(string.Empty); } DataRow[] rows = tmo_department.Select("dpt_id in (" + ids + ")"); StringBuilder sb = new StringBuilder(); foreach (DataRow dataRow in rows) { sb.AppendFormat("{0},", dataRow.GetDataRowStringValue("dpt_name")); } return(sb.ToString().TrimEnd(',')); }
private string GetDeviceName(Message m) { try { if (m.LParam == IntPtr.Zero) { return(null); } var devBroadcastDeviceInterface = new DevBroadcastDeviceinterface1(); var devBroadcastHeader = new DevBroadcastHdr(); try { Marshal.PtrToStructure(m.LParam, devBroadcastHeader); } catch (Exception ex) { TmoShare.WriteLog(ex.Message); } // Is the notification event concerning a device interface? if ((devBroadcastHeader.dbch_devicetype == Constants.DbtDevtypDeviceinterface)) { // Get the device path name of the affected device var stringSize = Convert.ToInt32((devBroadcastHeader.dbch_size - 32) / 2); devBroadcastDeviceInterface.dbcc_name = new Char[stringSize + 1]; Marshal.PtrToStructure(m.LParam, devBroadcastDeviceInterface); var deviceNameString = new string(devBroadcastDeviceInterface.dbcc_name, 0, stringSize); return(deviceNameString); // Compare the device name with our target device's pathname (strings are moved to lower case //return (string.Compare(deviceNameString.ToLower(), devicepath.ToLower(), StringComparison.OrdinalIgnoreCase) == 0); } } catch (Exception ex) { TmoShare.WriteLog("GetDeviceName(Message m) -> 发生异常:" + ex.Message); } return(null); }
public void Disconnect() { TmoShare.WriteLog("UsbHidDevice:Disconnect() -> 开始释放资源"); if (_fsDeviceRead != null) { _fsDeviceRead.Close(); } //if (readDataTh != null) // readDataTh.Abort(); // Is a device currently attached? //if (IsDeviceConnected) { TmoShare.WriteLog("UsbHidDevice:Disconnect() -> 释放句柄"); // Close the readHandle, writeHandle and hidHandle try { if (_deviceInformation.HidHandle != null && !_deviceInformation.HidHandle.IsInvalid()) { _deviceInformation.HidHandle.Close(); } _deviceInformation.HidHandle = IntPtr.Zero; if (_deviceInformation.ReadHandle != null && !_deviceInformation.ReadHandle.IsInvalid()) { _deviceInformation.ReadHandle.Close(); } _deviceInformation.ReadHandle = IntPtr.Zero; if (_deviceInformation.WriteHandle != null && !_deviceInformation.WriteHandle.IsInvalid()) { _deviceInformation.WriteHandle.Close(); } _deviceInformation.WriteHandle = IntPtr.Zero; } catch { } // Set the device status to detached; _deviceInformation.IsDeviceAttached = false; } }
void okbtn_Click(object sender, EventArgs e) { DataSet dtWeiXinMsg = TmoShare.getDataSetFromXML(tmo_wechat_consulting); //dtWeiXinMsg.Tables[0].Clear(); DataRow newRow = dtWeiXinMsg.Tables[0].NewRow(); if (!string.IsNullOrEmpty(user_id.Text)) { if (user_id.Text.Contains(',')) { foreach (string xx in user_id.Text.Split(',')) { string openid = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetBindId, new object[] { xx }); if (string.IsNullOrWhiteSpace(openid)) { DXMessageBox.ShowWarning2("用户" + xx + "未绑定微信!"); return; } } foreach (string xx in user_id.Text.Split(',')) { string openid = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetBindId, new object[] { xx }); sendmessage(openid, xx); } } else { string openid = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetBindId, new object[] { user_id.Text }); if (string.IsNullOrWhiteSpace(openid)) { DXMessageBox.ShowWarning2("该用户未绑定微信!"); return; } sendmessage(openid, user_id.Text); } this.DialogResult = DialogResult.OK; DXMessageBox.Show("发送成功!", true); } }
public void SetDate() { DataSet ds = TmoShare.getDataSetFromXML(xmlPharmacyDiary, true); foreach (DevExpress.XtraEditors.PanelControl temp in this.Controls) { foreach (Control det in temp.Controls) { foreach (DataColumn dc in ds.Tables[0].Columns) { if (det.Name == dc.ColumnName) { if (det.GetType().ToString() == "DevExpress.XtraEditors.RadioGroup") { if (!string.IsNullOrEmpty(datarow[det.Name].ToString())) { ((DevExpress.XtraEditors.RadioGroup)det).SelectedIndex = Convert.ToInt16(datarow[det.Name]); } } else if (det.GetType().ToString() == "DevExpress.XtraEditors.CheckEdit") { if (datarow[det.Name].ToString() == "1") { ((DevExpress.XtraEditors.CheckEdit)det).Checked = true; } else { ((DevExpress.XtraEditors.CheckEdit)det).Checked = false; } } else { det.Text = datarow[det.Name].ToString(); } } } } } }
public bool AddAsk(string strxml) { if (!string.IsNullOrEmpty(strxml)) { DataSet ds = TmoShare.getDataSetFromXML(strxml); if (ds == null || ds.Tables.Count < 0 || ds.Tables[0] == null || ds.Tables[0].Rows.Count < 0) { return(false); } else { DataRow row = ds.Tables[0].Rows[0]; string sql = "insert into tmo_wechat_consulting (con_id,user_id,con_content,reply_content,we_id,doc_id,is_reply,input_time,update_time,is_del)" + "VALUES('" + Guid.NewGuid().ToString("N") + "','" + row["user_id"].ToString() + "','" + row["con_content"].ToString() + "','" + row["reply_content"].ToString() + "','" + row["we_id"].ToString() + "','" + row["doc_id"].ToString() + "',1,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',1)"; int num1 = MySQLHelper.ExecuteSql(sql); if (num1 > 0) { return(true); } } } return(false); }
/// <summary> /// 从表里面获得子节点 /// </summary> /// <param name="tableName"></param> /// <param name="codeName"></param> /// <param name="parentName"></param> /// <param name="nodeVal"></param> /// <returns></returns> public string GetChildrenNodeFromTable(string tableName, string codeName, string parentName, string nodeVal, bool addSelf = true) { if (string.IsNullOrWhiteSpace(tableName) || string.IsNullOrWhiteSpace(codeName) || string.IsNullOrWhiteSpace(parentName) || string.IsNullOrWhiteSpace(nodeVal)) { return("err_params"); } DataTable dt = Tmo_FakeEntityClient.Instance.GetData(tableName); if (TmoShare.DataTableIsEmpty(dt)) { return(null); } List <string> list = new List <string>(); list.AddRange(GetChildrenCode(dt, codeName, parentName, nodeVal)); if (!addSelf) { list.Remove(nodeVal); } return(StringPlus.GetArrayStr(list, ",")); }
public void SetControl() { string nurXml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetnurtypeItem, new object[] { "" }); DataSet nurDs = TmoShare.getDataSetFromXML(nurXml); if (TmoShare.DataSetIsNotEmpty(nurDs)) { foreach (DataRow row in nurDs.Tables[0].Rows) { var item = new ImageComboBoxItem { Description = row["nurtype"].ToString(), Value = row["id"].ToString() }; nurtype.Properties.Items.Add(item); } nurtype.SelectedIndex = 0; } string hotXml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetHotDic, new object[] { "" }); DataSet hotDs = TmoShare.getDataSetFromXML(hotXml); if (TmoShare.DataSetIsNotEmpty(hotDs)) { foreach (DataRow row in hotDs.Tables[0].Rows) { var item = new ImageComboBoxItem { Description = row["hotvalue"].ToString(), Value = row["id"].ToString() }; hottype.Properties.Items.Add(item); } hottype.SelectedIndex = 0; } }
protected override void OnRowCellClick(DataRow dr, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Column.Name == "gc_doc_function") //设置权限 { UCFunctionEditor edit = new UCFunctionEditor(); edit.Title = string.Format("设置健康师【{0}】权限", dr["doc_name"]); string doc_function = dr["doc_function"].ToString(); if (string.IsNullOrWhiteSpace(doc_function)) { DataTable dt = Tmo_FakeEntityClient.Instance.GetData("tmo_docgroup", new[] { "group_function" }, null, "group_id", dr["doc_group"].ToString()); if (TmoShare.DataTableIsNotEmpty(dt)) { doc_function = dt.Rows[0][0].ToString(); } } edit.EditValue = doc_function; if (edit.ShowDialog() == DialogResult.OK) {//设置权限 if (doc_function != edit.EditValue) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("doc_function", edit.EditValue); bool suc = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Update, TableName, PrimaryKey, dr[PrimaryKey].ToString(), dic); if (!suc) { DXMessageBox.ShowError("权限设置失败,请重试!"); } else { GetData(); } } } edit.Dispose(); } base.OnRowCellClick(dr, e); }
protected override void OnDelClick(DataRow selectedRow) { string doc_name = selectedRow["doc_name"].ToString(); string pkVal = selectedRow[PrimaryKey].ToString(); if (TmoComm.login_docInfo.doc_id.ToString() == pkVal) { DXMessageBox.ShowInfo("不能删除自身!"); return; } DXMessageBox.btnOKClick += (object sender, EventArgs e) => { DataTable dtcount = Tmo_FakeEntityClient.Instance.GetData("tmo_userinfo", new[] { "count(*) as count" }, "doc_id='" + pkVal + "'"); if (TmoShare.DataTableIsNotEmpty(dtcount)) { int count = dtcount.Rows[0].GetDataRowIntValue("count"); if (count > 0) { DXMessageBox.ShowWarning("该健康师下分配有用户不能删除!"); return; } } bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, pkVal); if (suc) { DXMessageBox.Show("健康师删除成功!", true); Tmo_CommonClient.Instance.RefreshDocChildrenID(); GetData(); } else { DXMessageBox.ShowWarning("删除失败!"); } }; DXMessageBox.ShowQuestion("确定要删除健康师【" + doc_name + "】吗?"); base.OnDelClick(selectedRow); }
public void GetItemData() { string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetItemData, new object[] { "" }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (ds != null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; if (dt == null) { return; } dgvEx.DataSource = dt; if (dgvMainEx.GroupCount > 0) { dgvMainEx.ExpandAllGroups(); } dgvMainEx.MoveFirst(); DataRow dr = dt.Rows[0]; _dicCode = dr["mt_code"].ToString(); _mtValuetype = dr["mt_valuetype"].ToString(); GetData(); } }
void Getdata(string user_id, string user_times) { this.ShowWaitingPanel(() => { try { string xmlreturn = TmoServiceClient.InvokeServerMethodT <string>(funCode.medicQuery, new object[] { "" }); DataSet ds = TmoShare.getDataSetFromXML(xmlreturn); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dt.Columns.Add("cur_value", typeof(string)); FillTree(prodiclist, dt); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public bool UpdateDicUser(DataTable table) { List <string> sqls = new List <string>(); if (TmoShare.DataTableIsNotEmpty(table)) { foreach (DataRow row in table.Rows) { string id = Guid.NewGuid().ToString().Replace("-", ""); string sql = "update tmo_tuijian_user set dicvalue='" + row["dicvalue"].ToString() + "',dic_id='" + row["dic_id"].ToString() + "',dicname='" + row["dicname"].ToString() + "',user_id='" + row["user_id"].ToString() + "',user_times='" + row["user_times"].ToString() + "',input_time='" + TmoShare.DateNow + "' where id='" + row["id"].ToString() + "' "; sqls.Add(sql); } } int num = MySQLHelper.ExecuteSqlList(sqls); if (num > 0) { return(true); } else { return(false); } }
public bool inputUserDic(DataTable table) { List <string> sqls = new List <string>(); if (TmoShare.DataTableIsNotEmpty(table)) { foreach (DataRow row in table.Rows) { string id = Guid.NewGuid().ToString().Replace("-", ""); string sql = "INSERT into tmo_tuijian_user (dicvalue,dic_id,dicname,user_id,user_times,id,input_time) VALUES('" + row["dicvalue"].ToString() + "','" + row["dic_id"].ToString() + "','" + row["dicname"].ToString() + "','" + row["user_id"].ToString() + "','" + row["user_times"].ToString() + "','" + id + "','" + TmoShare.DateNow + "') "; sqls.Add(sql); } } int num = MySQLHelper.ExecuteSqlList(sqls); if (num > 0) { return(true); } else { return(false); } }
public void GetData() { this.ShowWaitingPanel(() => { try { _dsQueryXml = TmoShare.getDataSetFromXML(SubmitXml, true); if (_dsQueryXml.Tables[0].Rows.Count == 0) { _dsQueryXml.Tables[0].Rows.Add(_dsQueryXml.Tables[0].NewRow()); } _dsQueryXml.Tables[0].Rows[0]["doc_code"] = TmoComm.login_docInfo.children_docid; _dsQueryXml.Tables[0].Rows[0]["page_size"] = _pageSize.ToString(); _dsQueryXml.Tables[0].Rows[0]["now_page"] = _currentPage.ToString(); if (!string.IsNullOrEmpty(this.userID.Text)) { _dsQueryXml.Tables[0].Rows[0]["user_id"] = this.userID.Text; } if (!string.IsNullOrEmpty(this.txtName.Text)) { _dsQueryXml.Tables[0].Rows[0]["name"] = this.txtName.Text; } if (Time.Checked) { _dsQueryXml.Tables[0].Rows[0]["date_start"] = datestart.EditValue.ToString(); _dsQueryXml.Tables[0].Rows[0]["date_end"] = dateend.EditValue.ToString(); } string selexml = TmoShare.getXMLFromDataSet(_dsQueryXml); string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetSportDiaryList, new object[] { selexml }); _dsGetDataResult = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(_dsGetDataResult)) { DataTable dtCount = _dsGetDataResult.Tables["Count"]; count = dtCount.Rows[0]["totalRowCount"].ToString(); double countnum = double.Parse(count) / _pageSize; pageCount = Math.Ceiling(countnum).ToString(); return(_dsGetDataResult.Tables[1]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dgcTree.DataSource = dt; if (gridView1.GroupCount > 0) { gridView1.ExpandAllGroups(); } gridView1.MoveFirst(); if (dt == null) { return; } lblCount.Text = string.Format("共[{0}]条", count); lblPageIndex.Text = string.Format("第[{0}]页,共[{1}]页", _currentPage.ToString(), _pageSize.ToString()); txtPageIndex.Text = _currentPage.ToString(); txtPageSize.Text = _pageSize.ToString(); llblUp.Enabled = _currentPage > 1; llblDown.Enabled = _currentPage < int.Parse(pageCount); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
void ReceiveCallback(IAsyncResult ar) { StateObject state = ar.AsyncState as StateObject; bool disposed = false; //是否停止数据接收 try { //服务器发来的消息 int length = state.Socket.EndReceive(ar); byte[] receiveBytes = new byte[length]; Array.Copy(state.Buffer, 0, receiveBytes, 0, length); int head = -1; //消息头码 string strData = null; //String类型消息 if (length >= 4) { //消息头码 head = BitConverter.ToInt32(new[] { receiveBytes[0], receiveBytes[1], receiveBytes[2], receiveBytes[3] }, 0); if (head == 8888) //握手头码 { trustedServer = true; } else if (head == 7777) //心跳包头码 { strData = ParserString(receiveBytes); DateTime serverTime = TmoShare.GetValueFromJson <DateTime>(strData); double dualSec = Math.Abs((serverTime - DateTime.Now).TotalSeconds); if (dualSec > 10) { DateTimeHelper.SetSystemTime(serverTime.AddSeconds(1)); } } else if (head == 9999) //请求断开连接 { serviceClosing = false; serviceClosed = true; ClostSocket(); } else if (head == 0 && trustedServer) //发送来的是消息 { strData = ParserString(receiveBytes); } } InvokeDataReceived(head, receiveBytes, strData); } catch (Exception ex) { if (ex is ObjectDisposedException) { disposed = true; return; //停止接收数据 } if (ex is SocketException) { ClostSocket(); return; } } finally { try { if (!disposed) { //继续接收消息 state.Socket.BeginReceive(state.Buffer, 0, state.Buffer.Length, SocketFlags.None, ReceiveCallback, state); } } catch { ClostSocket(); } } }
void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(isadd)) { string videoUrl = txtvideoUrl.Text; if (string.IsNullOrEmpty(videoUrl)) { DXMessageBox.ShowWarning2("请输入视频路径"); return; } string videoName = txtvideoName.Text; if (string.IsNullOrEmpty(videoName)) { DXMessageBox.ShowWarning2("请输入视频名称"); return; } DataSet ds = TmoShare.getDataSetFromXML(disxml); ds.Tables[0].Rows.Clear(); DataRow dr = ds.Tables[0].NewRow(); dr["video_name"] = videoName; dr["video_url"] = videoUrl; ds.Tables[0].Rows.InsertAt(dr, 0); bool blt = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.AddVideo, new object[] { TmoShare.getXMLFromDataSet(ds) }); if (blt) { DXMessageBox.ShowWarning2("添加项目成功"); } else { DXMessageBox.ShowWarning2("添加项目失败"); } } else { string videoUrl = txtvideoUrl.Text; if (string.IsNullOrEmpty(videoUrl)) { DXMessageBox.ShowWarning2("请输入视频路径"); return; } string videoName = txtvideoName.Text; if (string.IsNullOrEmpty(videoName)) { DXMessageBox.ShowWarning2("请输入视频名称"); return; } DataSet ds = TmoShare.getDataSetFromXML(disxml); ds.Tables[0].Rows.Clear();//isadd DataRow dr = ds.Tables[0].NewRow(); dr["video_name"] = videoName; dr["video_url"] = videoUrl; dr["id"] = isadd; ds.Tables[0].Rows.InsertAt(dr, 0); bool blt = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.UpdateVideo, new object[] { TmoShare.getXMLFromDataSet(ds) }); if (blt) { DXMessageBox.ShowWarning2("修改项目成功!"); } else { DXMessageBox.ShowWarning2("修改项目失败!"); } } }
public void RefData(string userId, string user_times, string quesIDs) { string uptimes = "0"; if (user_times != "1") { uptimes = (int.Parse(user_times) - 1).ToString(); } string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.getScreenData, new object[] { userId, user_times, quesIDs }); DataTable dt = TmoShare.getDataTableFromXML(strmlx); string upxml = TmoServiceClient.InvokeServerMethodT <string>(funCode.getScreenData, new object[] { userId, uptimes, quesIDs }); DataTable updtdd = TmoShare.getDataTableFromXML(upxml); if (TmoShare.DataTableIsNotEmpty(dt)) { foreach (DataRow row in dt.Rows) { string p_id = row["q_id"].ToString(); if (p_id == "D9115BD44B1344B88A45EF121EADCBA5") { } #region 指标结果 if (p_id == "EBE1C353B35842189EF8F4041BE95CB6") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } tizhong.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "D9115BD44B1344B88A45EF121EADCBA5") { float val = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (val == 0) { continue; } if (val > 24) { fpd.Text = "肥胖"; } bmiValue.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "CE8C9F888AD2447487EAA996BBA5A6BF") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } yaowei.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "ADF9331BADAB48BF9147611A9BBD1C79") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald > 5.6 || vald < 3.9) { kong.ForeColor = Color.Red; } kong.Text = vald.ToString(); } if (p_id == "0C1553EA1A274B56A211CCFC5F4A429E") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald > 7.8 || vald < 4.4) { can.ForeColor = Color.Red; } can.Text = vald.ToString(); } if (p_id == "C41F469521E849D8B6314833C6FA92B0") { string[] valds = TmoShare.GetValueFromJson <string[]>(row["qr_result"].ToString()); if (valds != null && valds.Length > 0) { if (!string.IsNullOrEmpty(valds[0]) && !string.IsNullOrEmpty(valds[1])) { float v1 = float.Parse(valds[0]); float v2 = float.Parse(valds[1]); if (v1 > 140 || v1 < 90 || v2 < 60 || v2 > 90) { xueya.ForeColor = Color.Red; } xueya.Text = v1 + "/" + v2; } } } if (p_id == "6E3658E76CE141CEB0264BA1ADEF9664") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald > 5.2 || vald < 3) { zongdangu.ForeColor = Color.Red; } zongdangu.Text = vald.ToString(); } if (p_id == "225368D504EB431CA2E597FAD50D2949") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald > 1.7 || vald < 0) { ganyou.ForeColor = Color.Red; } ganyou.Text = vald.ToString(); } if (p_id == "6A67F0E229964527AB541B5DD318E2C3") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald > 3.12 || vald < 0) { dimi.ForeColor = Color.Red; } dimi.Text = vald.ToString(); } if (p_id == "D2198A7F78CF4DEFA821C4F41893E415") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald > 0.2 || vald < 0.7) { xrTableCell72.ForeColor = Color.Red; } xrTableCell72.Text = vald.ToString(); }//805E2FAC0F3B442DBBBFAFB4BF61F427 if (p_id == "805E2FAC0F3B442DBBBFAFB4BF61F427") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0) { continue; } niaodan.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "4CD308E584744A36BC499CECCADAEB18") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0) { continue; } niaobai.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "6501E7A0165648A6BD9409430028ADEB") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0) { continue; } tongxing.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "C1443DA657174BC696008614A6659A99") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0) { continue; } xuehong.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } #endregion #region 个人疾病史 if (p_id == "02390D277242464192B05F08D03D298B") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { xrTableCell138.Text = "有";//高血压 xrTableCell138.ForeColor = Color.Red; gxy.Text = "已患"; } } if (p_id == "0F58D8725EB5467E91231F0742FF4271") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { shenjing.Text = "已患";//糖尿病神经病变 } } if (p_id == "9407E0C29A914D9795B203968A8050EB") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { tnb.Text = "已患";//糖尿时间 xrTableCell126.Text = "有"; xrTableCell126.ForeColor = Color.Red; } } if (p_id == "16D3E509B9C0400F97F7D88EB91C8247") { DateTime val = TmoShare.GetValueFromJson <DateTime>(row["qr_result"].ToString()); var dtimeValue = val.ToString("yyyy-MM-dd"); if (dtimeValue != "0001-01-01" && dtimeValue != "9999-12-31") { tnb.Text = "已患";//糖尿时间 xrTableCell126.Text = "有"; xrTableCell126.ForeColor = Color.Red; } } if (p_id == "1E39A6F3231E47C7994FCD380F5A6FC6") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { zb.Text = "已患";//糖尿病足病 } } if (p_id == "3289721340EE4EA4BC3EB82366703B75") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { xrTableCell136.Text = "有"; xrTableCell136.ForeColor = Color.Red; xz.Text = "已患";//血脂异常 } } if (p_id == "4E89929897B3449384BAB2DC1B886BE1") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { yb.Text = "已患";//和病眼病 } } if (p_id == "C9541C75D3EE43D9A94124605E4FE70B") { bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString()); if (val) { shenbing.Text = "已患";//肾病 } } if (p_id == "A44EF95BEF084F919FB78FC614E2C58E") { int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString()); if (vals != null && vals.Length > 0) { if (iscontext(vals, 226)) { xrTableCell132.Text = "有"; xrTableCell132.ForeColor = Color.Red; } if (iscontext(vals, 227)) { xrTableCell134.Text = "有"; xrTableCell134.ForeColor = Color.Red; } if (iscontext(vals, 228)) { xrTableCell144.Text = "有"; xrTableCell144.ForeColor = Color.Red; } if (iscontext(vals, 229)) { xrTableCell30.Text = "有"; xrTableCell30.ForeColor = Color.Red; } if (iscontext(vals, 225)) { xrTableCell146.Text = "有"; xrTableCell146.ForeColor = Color.Red; } if (iscontext(vals, 214)) { xrTableCell148.Text = "有"; xrTableCell148.ForeColor = Color.Red; } } } if (p_id == "08EAA9700B0440C2BB8957D3722F9E87")//父亲 { int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString()); if (vals != null && vals.Length > 0) { if (iscontext(vals, 212)) { fugao.Text = "有"; fugao.ForeColor = Color.Red; } if (iscontext(vals, 208)) { futang.Text = "有"; futang.ForeColor = Color.Red; } if (iscontext(vals, 207)) { fuxuezhi.Text = "有"; fuxuezhi.ForeColor = Color.Red; } if (iscontext(vals, 225)) { fujia.Text = "有"; fujia.ForeColor = Color.Red; } if (iscontext(vals, 214)) { guanxin.Text = "有"; guanxin.ForeColor = Color.Red; } if (iscontext(vals, 226)) { naoguanxin.Text = "有"; naoguanxin.ForeColor = Color.Red; } if (iscontext(vals, 227)) { fuzhongliu.Text = "有"; fuzhongliu.ForeColor = Color.Red; } } } if (p_id == "65D243DFF6654CD3BC65900E8467DDA9")//母亲 { int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString()); if (vals != null && vals.Length > 0) { if (iscontext(vals, 212)) { mugao.Text = "有"; mugao.ForeColor = Color.Red; } if (iscontext(vals, 208)) { mutang.Text = "有"; mutang.ForeColor = Color.Red; } if (iscontext(vals, 207)) { muxuezhi.Text = "有"; muxuezhi.ForeColor = Color.Red; } if (iscontext(vals, 225)) { mujia.Text = "有"; mujia.ForeColor = Color.Red; } if (iscontext(vals, 214)) { muguanxin.Text = "有"; muguanxin.ForeColor = Color.Red; } if (iscontext(vals, 226)) { muxinnao.Text = "有"; muxinnao.ForeColor = Color.Red; } if (iscontext(vals, 227)) { muzhongliu.Text = "有"; muzhongliu.ForeColor = Color.Red; } } } if (p_id == "F88D1C04B0F64D6B8D59CDB821AEBB4B")//兄弟姐妹 { int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString()); if (vals != null && vals.Length > 0) { if (iscontext(vals, 212)) { xmgao.Text = "有"; xmgao.ForeColor = Color.Red; } if (iscontext(vals, 208)) { xmtang.Text = "有"; xmtang.ForeColor = Color.Red; } if (iscontext(vals, 207)) { xmxuezhi.Text = "有"; xmxuezhi.ForeColor = Color.Red; } if (iscontext(vals, 225)) { xmjia.Text = "有"; xmjia.ForeColor = Color.Red; } if (iscontext(vals, 214)) { xmgaunxin.Text = "有"; xmgaunxin.ForeColor = Color.Red; } if (iscontext(vals, 226)) { xmxinao.Text = "有"; xmxinao.ForeColor = Color.Red; } if (iscontext(vals, 227)) { xmzhongliu.Text = "有"; xmzhongliu.ForeColor = Color.Red; } } } #endregion } } if (TmoShare.DataTableIsNotEmpty(updtdd)) { #region 判断上次指标结果 foreach (DataRow row in updtdd.Rows) { string p_id = row["q_id"].ToString(); if (p_id == "EBE1C353B35842189EF8F4041BE95CB6") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } tizhongUp.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "D9115BD44B1344B88A45EF121EADCBA5") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } bmiValueUp.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "CE8C9F888AD2447487EAA996BBA5A6BF") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } yaoweiUp.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "ADF9331BADAB48BF9147611A9BBD1C79") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald == 0) { continue; } if (vald > 5.6 || vald < 3.9) { kongup.ForeColor = Color.Red; } kongup.Text = vald.ToString(); } if (p_id == "0C1553EA1A274B56A211CCFC5F4A429E") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald == 0) { continue; } if (vald > 7.8 || vald < 4.4) { canUP.ForeColor = Color.Red; } canUP.Text = vald.ToString(); } if (p_id == "C41F469521E849D8B6314833C6FA92B0") { string[] valds = TmoShare.GetValueFromJson <string[]>(row["qr_result"].ToString()); if (valds != null && valds.Length > 0) { if (!string.IsNullOrEmpty(valds[0]) && !string.IsNullOrEmpty(valds[1])) { float v1 = float.Parse(valds[0]); float v2 = float.Parse(valds[1]); if (v1 > 140 || v1 < 90 || v2 < 60 || v2 > 90) { xueyaUp.ForeColor = Color.Red; } xueyaUp.Text = v1 + "/" + v2; } } } if (p_id == "6E3658E76CE141CEB0264BA1ADEF9664") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald == 0) { continue; } if (vald > 5.2 || vald < 3) { zongdanguUp.ForeColor = Color.Red; } zongdanguUp.Text = vald.ToString(); } if (p_id == "225368D504EB431CA2E597FAD50D2949") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald == 0) { continue; } if (vald > 1.7 || vald < 0) { ganyouUP.ForeColor = Color.Red; } ganyouUP.Text = vald.ToString(); } if (p_id == "6A67F0E229964527AB541B5DD318E2C3") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald == 0) { continue; } if (vald > 3.12 || vald < 0) { dimiUP.ForeColor = Color.Red; } dimiUP.Text = vald.ToString(); } if (p_id == "D2198A7F78CF4DEFA821C4F41893E415") { float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()); if (vald == 0) { continue; } if (vald == 0) { continue; } if (vald > 0.2 || vald < 0.7) { gaomiUp.ForeColor = Color.Red; } gaomiUp.Text = vald.ToString(); } if (p_id == "805E2FAC0F3B442DBBBFAFB4BF61F427") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } nianodanUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "4CD308E584744A36BC499CECCADAEB18") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } niaobaiUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "6501E7A0165648A6BD9409430028ADEB") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } tongxingUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } if (p_id == "C1443DA657174BC696008614A6659A99") { if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0) { continue; } xuehongUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString(); } } #endregion } }
/// <summary> /// 微信 /// </summary> public static bool SendWeChat(object[] infoValue, out string err_tip) { lock (wechatLock) { string openid = infoValue[1].ToString(); string data = infoValue[3].ToString(); string templateID = ConfigHelper.GetConfigString("WX_TEMPLATE_ID"); err_tip = WeChatHelper.WXTemplateMsgSend(new object[] { "admin", openid, templateID, "", TmoShare.RGBToWebColor(Color.Green), data }); return(err_tip.Contains("success")); } }
/// <summary> /// 获取本次体检数据 /// </summary> /// <returns></returns> public void GetNowRisk(string userId, string user_times) { DataSet ds = TmoCommon.TmoShare.getDataSetFromXML(TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(TmoCommon.funCode.GettuiDataUser, new object[] { userId, user_times })); if (TmoShare.DataSetIsNotEmpty(ds)) { foreach (DataRow row in ds.Tables[0].Rows) { string id = row["dic_id"].ToString(); switch (id) { case "18b39361ca0e4003b80aadd9e586be6b": //HbA1c(%) hb.Text = row["dicvalue"].ToString(); break; case "19fc63c7ac35483bbd4b36f75a101316": //TC(mmol/L) tc.Text = row["dicvalue"].ToString(); break; case "1b1fc8684a294e129806f9af58dff5c7": //HDL-C (mmol/L) 男性 hdm.Text = row["dicvalue"].ToString(); break; case "264f761e371747379b14e3109d5fb5c7": //HDL-C (mmol/L) 女性性 hdn.Text = row["dicvalue"].ToString(); break; case "2a4a0ac0e41c4b9796be7449610bc5af": //TG(mmol/L) tg.Text = row["dicvalue"].ToString(); break; case "3e66fbffddcb4249adc43bfda413cf19": //LDL-C (mmol/L)女性 ldnv.Text = row["dicvalue"].ToString(); break; case "41bd36b815f94bb690f870cee6a92ef2": //LDL-C (mmol/L) 男性 ldm.Text = row["dicvalue"].ToString(); break; case "52e77b3317a34c1da6d02d40197c12d5": //尿白蛋白/肌酐比(mg/mmol 女 niaonv.Text = row["dicvalue"].ToString(); break; case "52e77b3317a34c1da6d02d40197c12d34": //尿白蛋白排泄率 niaom.Text = row["dicvalue"].ToString(); break; case "5367ed592bcd4abbbfc381fae7651177": pai.Text = row["dicvalue"].ToString(); break; case "5367ed592bcd4abbbfc381fae7651179": tongxing.Text = row["dicvalue"].ToString(); break; case "5367ed592bcd4abbbfc381fae7651178": qita.Text = row["dicvalue"].ToString(); break; } } } }