public void BindProductor(String QueueName,SmsBindTemp temp,SmsBind vo) { try { m_mq.CreateProducer(false, QueueName + temp.getHostName()); List<Property> m_lstProperty = new List<Property>(); //TODO//等待完成 Property sn; sn.name = "sn"; sn.value = temp.getSn(); m_lstProperty.Add(sn); Property uuid; uuid.name = "uuid"; uuid.value =temp.getUuid(); m_lstProperty.Add(uuid); Property name; name.name = "name"; name.value = temp.getName(); m_lstProperty.Add(name); Property userId; userId.name = "userId"; userId.value = temp.getUserId(); m_lstProperty.Add(userId); Property phone; phone.name = "phone"; phone.value = temp.getPhone(); m_lstProperty.Add(phone); Property address; address.name = "address"; address.value = temp.getAddress(); m_lstProperty.Add(address); Property idNumber; idNumber.name = "idNumber"; idNumber.value = temp.getIdNumber(); Property content; content.name = "content"; content.value = vo.getContent(); m_lstProperty.Add(content); Property state; state.name = "state"; state.value = vo.getState(); m_lstProperty.Add(state); Property userMessageId; userMessageId.name = "userMessageId"; userMessageId.value = temp.getUserMessageId(); m_lstProperty.Add(userMessageId); m_mq.SendMQMessage("", m_lstProperty); Program.logWriter.WriteLine("=============MQ队列写入完成 电话号码:"+temp.getPhone()+"============="); } catch (Exception ex) { Program.logWriter.WriteLine("BindProductor Exception:" + ex.Message); Program.mqconnection = false; } }
public static SmsBindTemp TosmsBindTempObject(IMessage message) { SmsBindTemp smsBindTemp = new SmsBindTemp(); String sn = message.Properties.GetString("sn"); String uuid = message.Properties.GetString("uuid"); String name = message.Properties.GetString("name"); String userMessageId = message.Properties.GetString("userMessageId"); String phone = message.Properties.GetString("phone"); String address = message.Properties.GetString("address"); String idNumber = message.Properties.GetString("idNumber"); String userId = message.Properties.GetString("userId"); String hostName = message.Properties.GetString("hostName"); smsBindTemp.setSn(sn); smsBindTemp.setUuid(uuid); smsBindTemp.setName(name); smsBindTemp.setUserId(userId); smsBindTemp.setUserMessageId(userMessageId); smsBindTemp.setPhone(phone); smsBindTemp.setAddress(address); smsBindTemp.setIdNumber(idNumber); smsBindTemp.setHostName(hostName); smsBindTemp.setCreateTime(DateTime.Now); return smsBindTemp; }
public static List<SmsBindTemp> TosmsBindTempObject(DataSet ds) { List<SmsBindTemp> smsList = new List<SmsBindTemp>(); if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { SmsBindTemp obj = new SmsBindTemp(); obj.setSn(dr["sn"].ToString()); obj.setUuid(dr["uuid"].ToString()); obj.setName(dr["name"].ToString()); obj.setUserId(dr["userid"].ToString()); obj.setUserMessageId(dr["usermessageid"].ToString()); obj.setPhone(dr["phone"].ToString()); obj.setAddress(dr["address"].ToString()); obj.setIdNumber(dr["idnumber"].ToString()); obj.setHostName(dr["hostname"].ToString()); obj.setReceiveFlag(int.Parse(dr["receiveflag"].ToString())); obj.setCounter(int.Parse(dr["counter"].ToString())); obj.setCreateTime(DateTime.Parse(dr["createtime"].ToString())); obj.setId(long.Parse(dr["id"].ToString())); smsList.Add(obj); } } return smsList; }
public static Boolean UpdateCount(SmsBindTemp obj) { String sql = "update sms_bind_temp set counter=" + obj.getCounter() + " where id=" + obj.getId(); if (MySqlDB.ExcCommand(sql)) return true; else { Program.logWriter.WriteLine("UpdateCount sql执行失败"); return false; } }
public static void UpdateSmsBindTempReceiveFlag(String flag,SmsBindTemp temp) { String sql = "update sms_bind_temp set receiveFlag=" + flag + " where id=" + temp.getId(); if (MySqlDB.ExcCommand(sql)==false) Program.logWriter.WriteLine("UpdateSmsBindTempReceiveFlag sql执行失败"); }
private void successHandler(string content, SmsBindTemp temp, int type) { SmsBind sms = MTO.ToSmsBindObject(content, "success", type); sms.setBindphone(temp.getPhone()); sms.setSn(temp.getSn()); sms.setUuid(temp.getUuid()); DbAction.InsertSmsBind(sms); this.cust.BindProductor("BIND_IDNO_RESPONSE_", temp, sms); DbAction.UpdateSmsBindTempReceiveFlag("1", temp); }
private void failedHandler(string content, SmsBindTemp temp, int type) { SmsBind sms = MTO.ToSmsBindObject(content, "unsuccess", type); sms.setBindphone(temp.getPhone()); sms.setSn(temp.getSn()); sms.setUuid(temp.getUuid()); DbAction.InsertSmsBind(sms); this.cust.BindProductor("BIND_IDNO_RESPONSE_", temp, sms); DbAction.UpdateSmsBindTempReceiveFlag("2", temp); if (type == 5||type==3) { SendMail("*****@*****.**", "浦廷钧", "[email protected];[email protected];[email protected]", "Error", content, "tingjun.pu", "listandmount", "smtp.ym.163.com", ""); } }