//发送消息 public void sendPerson(string message_title, string message_content, string emp_id, string taskId) { try { tbl_sys_employee lstEmp = BF <bll_sys_employee> .Instance.GetModel(emp_id); tbl_ep_message tbl = new tbl_ep_message(); tbl.message_id = Guid.NewGuid().ToString(); tbl.message_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); tbl.message_title = message_title; tbl.message_content = message_content; tbl.message_status = 0; tbl.emp_id = lstEmp.emp_id; tbl.emp_name = lstEmp.emp_name; tbl.message_type = "任务"; tbl.message_order_id = taskId; //tbl.send_emp_id = "admin"; //tbl.send_emp_name = "系统管理员"; BF <bll_ep_message> .Instance.Add(tbl); } catch (Exception ex) { //DialogHelper.DlgError("发送消息错误:" + ex); return; } }
public void GetMessagesDetail(string tokenId, string mid) { HttpContext.Current.Response.ContentType = "application/json;charset=utf-8"; var jsonCallBackFunName = HttpContext.Current.Request.Params["jsoncallback"].ToString(); Dugufeixue.Common.SystemConfig.ConnectionStringKey = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStringDes"].ToString(); //判断TokenId是否合法 if (Common.VerifyTokenId(tokenId)) { //查询接班人 MySqlCommand sqlcom = new MySqlCommand { CommandText = "SELECT * FROM ep_message WHERE message_id = @message_id" }; MySqlParameter[] commandParameters = new MySqlParameter[] { new MySqlParameter("@message_id", mid) }; try { var Info = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, sqlcom.CommandText, commandParameters).Tables[0].DefaultView; if (Info != null && Info.Table.Rows.Count >= 1) //信息存在 { var json = Common.DataTableToJson(Info.Table); //信息的Json形式 HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(1, json)); tbl_ep_message tbl = BF <bll_ep_message> .Instance.GetModel(mid); tbl.message_status = 1; BF <bll_ep_message> .Instance.Update(tbl); return; } else //不存在或已删除 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "员工信息不存在")); return; } } catch (Exception e) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "系统异常")); DLog.w("系统异常:" + e.Message); return; } } else//TokenId过期 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "TokenId过期")); return; } }
public void SendTask(string tokenId, string userlogin, string content, string sceneId, string sceneName) { HttpContext.Current.Response.ContentType = "application/json;charset=utf-8"; var jsonCallBackFunName = HttpContext.Current.Request.Params["jsoncallback"]; Dugufeixue.Common.SystemConfig.ConnectionStringKey = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStringDes"].ToString(); //判断TokenId是否合法 if (Common.VerifyTokenId(tokenId)) { //查询接班人 MySqlCommand sqlcom = new MySqlCommand { CommandText = "SELECT * FROM sys_employee WHERE user_login = @user_login" }; MySqlParameter[] commandParameters = new MySqlParameter[] { new MySqlParameter("@user_login", userlogin) }; try { var Info = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, sqlcom.CommandText, commandParameters).Tables[0].DefaultView; if (Info != null && Info.Table.Rows.Count >= 1) //信息存在 { tbl_ep_task tbl = new tbl_ep_task(); tbl.task_id = Guid.NewGuid().ToString(); tbl.task_content = content; tbl.scene_id = sceneId; tbl.scene_name = sceneName; tbl.emp_id = Info.Table.Rows[0]["emp_id"].ToString(); tbl.emp_name = Info.Table.Rows[0]["emp_name"].ToString(); tbl.task_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); tbl.task_status = 0; tbl.accept_task_status = 0; MySqlCommand sqlmess = new MySqlCommand { CommandText = "INSERT INTO ep_task (task_id ,emp_id,emp_name,scene_id,scene_name,task_time,task_content,task_status,accept_task_status)" + " VALUES (@task_id ,@emp_id,@emp_name,@scene_id,@scene_name,@task_time,@task_content,@task_status,@accept_task_status)" }; MySqlParameter[] commandParametersmess = new MySqlParameter[] { new MySqlParameter("@task_id", tbl.task_id), new MySqlParameter("@emp_id", tbl.emp_id), new MySqlParameter("@emp_name", tbl.emp_name), new MySqlParameter("@scene_id", tbl.scene_id), new MySqlParameter("@scene_name", tbl.scene_name), new MySqlParameter("@task_time", tbl.task_time), new MySqlParameter("@task_content", tbl.task_content), new MySqlParameter("@task_status", tbl.task_status), new MySqlParameter("@accept_task_status", tbl.accept_task_status), }; var Info2 = MySqlHelper.ExecuteNonQuery(MySqlHelper.Conn, CommandType.Text, sqlmess.CommandText, commandParametersmess); if (Info2 == 1) //信息存在 { List <tbl_ep_scene_employee> lstEmp = BF <bll_ep_scene_employee> .Instance.GetModelList("scene_id='" + tbl.scene_id + "'", ""); foreach (tbl_ep_scene_employee emp in lstEmp) { tbl_sys_employee tblemp = BF <bll_sys_employee> .Instance.GetModel(emp.emp_id); tbl_ep_message tbl_message = new tbl_ep_message(); tbl_message.message_id = Guid.NewGuid().ToString(); tbl_message.emp_id = tblemp.emp_id; tbl_message.emp_name = tblemp.emp_name; tbl_message.message_title = "接收到一条新任务"; tbl_message.message_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); tbl_message.message_status = 0; tbl_message.message_content = tbl.emp_name + "发布了一条新任务,请查看!"; tbl_message.message_type = "任务"; tbl_message.message_order_id = tbl.task_id; BF <bll_ep_message> .Instance.Add(tbl_message); } // var json = Common.DataTableToJson(Info.Table); //信息的Json形式 HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(1, "发表成功")); return; } } else //不存在或已删除 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "发表失败")); return; } } catch (Exception e) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "系统异常")); DLog.w("系统异常:" + e.Message); return; } } else//TokenId过期 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "TokenId过期")); return; } }
public void getMessageRepair(string tokenId, string id) { HttpContext.Current.Response.ContentType = "application/json;charset=utf-8"; var jsonCallBackFunName = HttpContext.Current.Request.Params["jsoncallback"]; Dugufeixue.Common.SystemConfig.ConnectionStringKey = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStringDes"].ToString(); //判断TokenId是否合法 if (Common.VerifyTokenId(tokenId)) { try { tbl_ep_message tbl = BF <bll_ep_message> .Instance.GetModel(id); if (tbl == null) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "信息不存在")); return; } string msgOrderId = tbl.message_order_id; tbl_ep_report_repair tblRepair = BF <bll_ep_report_repair> .Instance.GetModel(msgOrderId); if (tblRepair == null) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "报修信息不存在")); return; } else { var json = "[{\"from_path\":\"" + tblRepair.from_path + "\""; if (tblRepair.from_path == "报警") { tbl_ep_warning_log tblWarning = BF <bll_ep_warning_log> .Instance.GetModel(tblRepair.warning_log_id); string lbMemo = tblWarning.warning_level + "级报警"; string lbSceneName = tblWarning.scene_name; string lbEquipmentName = tblWarning.equipment_name; string lbComponentName = tblWarning.component_name; string lbTime = tblWarning.warning_datetime.ToString(); string lbPointName = tblWarning.collection_point_description; string lbType = tblWarning.warning_type; string lbValue = tblWarning.warning_value; json += ",\"memo\":\"" + lbMemo + "\""; json += ",\"SceneName\":\"" + lbSceneName + "\""; json += ",\"EquipmentName\":\"" + lbEquipmentName + "\""; json += ",\"ComponentName\":\"" + lbComponentName + "\""; json += ",\"Time\":\"" + lbTime + "\""; json += ",\"PointName\":\"" + lbPointName + "\""; json += ",\"Type\":\"" + lbType + "\""; json += ",\"Value\":\"" + lbValue + "\""; } else if (tblRepair.from_path == "故障") { tbl_ep_equipment_component_status tblGuZhang = BF <bll_ep_equipment_component_status> .Instance.GetModel(tblRepair.warning_log_id); string lbMemo = tblGuZhang.status_memo; string lbSceneName = tblGuZhang.scene_name; string lbEquipmentName = tblGuZhang.equipment_name; string lbComponentName = ""; if (Dugufeixue.Common.Verification.IsNumbericChar(tblGuZhang.equipment_component_code) == false) { lbComponentName = tblGuZhang.component_name + "(" + tblGuZhang.equipment_component_code + ")"; } else { lbComponentName = tblGuZhang.component_name; } string lbTime = tblGuZhang.start_time; json += ",\"memo\":\"" + lbMemo + "\""; json += ",\"SceneName\":\"" + lbSceneName + "\""; json += ",\"EquipmentName\":\"" + lbEquipmentName + "\""; json += ",\"ComponentName\":\"" + lbComponentName + "\""; json += ",\"Time\":\"" + lbTime + "\""; } json += "}]"; HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(1, json)); return; } } catch (Exception e) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "系统异常")); DLog.w("系统异常:" + e.Message); return; } } else//TokenId过期 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "TokenId过期")); return; } }
public void SendMessage(string tokenId, string sendno, string empno, string messagecontent, string emp_name) { HttpContext.Current.Response.ContentType = "application/json;charset=utf-8"; var jsonCallBackFunName = HttpContext.Current.Request.Params["jsoncallback"].ToString(); Dugufeixue.Common.SystemConfig.ConnectionStringKey = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStringDes"].ToString(); //判断TokenId是否合法 if (Common.VerifyTokenId(tokenId)) { //查询接班人 MySqlCommand sqlcom = new MySqlCommand { CommandText = "SELECT * FROM sys_employee WHERE user_login = @user_login" }; MySqlParameter[] commandParameters = new MySqlParameter[] { new MySqlParameter("@user_login", sendno) }; try { var Info = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, sqlcom.CommandText, commandParameters).Tables[0].DefaultView; if (Info != null && Info.Table.Rows.Count >= 1) //信息存在 { tbl_ep_message tbl = new tbl_ep_message(); tbl.message_id = Guid.NewGuid().ToString(); tbl.message_content = messagecontent; tbl.emp_id = empno; tbl.emp_name = emp_name; tbl.message_status = 0; tbl.message_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); tbl.message_title = "聊天信息"; tbl.message_type = "聊天记录"; tbl.send_emp_id = Info.Table.Rows[0]["emp_id"].ToString(); tbl.send_emp_name = Info.Table.Rows[0]["emp_name"].ToString(); MySqlCommand sqlmess = new MySqlCommand { CommandText = "INSERT INTO ep_message (message_id ,message_content,emp_id,emp_name,message_status,message_time,message_title,send_emp_id,send_emp_name) VALUES (@message_id ,@message_content,@emp_id,@emp_name,@message_status,@message_time,@message_title,@send_emp_id,@send_emp_name)" }; MySqlParameter[] commandParametersmess = new MySqlParameter[] { new MySqlParameter("@message_id", tbl.message_id), new MySqlParameter("@message_content", tbl.message_content), new MySqlParameter("@emp_id", tbl.emp_id), new MySqlParameter("@emp_name", emp_name), new MySqlParameter("@message_status", tbl.message_status), new MySqlParameter("@message_time", tbl.message_time), new MySqlParameter("@message_title", tbl.message_title), new MySqlParameter("@send_emp_id", tbl.send_emp_id), new MySqlParameter("@send_emp_name", tbl.send_emp_name), }; var Info2 = MySqlHelper.ExecuteNonQuery(MySqlHelper.Conn, CommandType.Text, sqlmess.CommandText, commandParametersmess); if (Info2 == 1) //信息存在 { // var json = Common.DataTableToJson(Info.Table); //信息的Json形式 HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(1, "发送成功")); return; } } else //不存在或已删除 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "接收人的工号不存在")); return; } } catch (Exception e) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "系统异常")); DLog.w("系统异常:" + e.Message); return; } } else//TokenId过期 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "TokenId过期")); return; } }