public string UpdateStatusNew(string oldid, double sendid, string sendcmd, string status) { ISqlMapper NewMap = SqlMapper.Instance(); NewMap.BeginTransaction(); try { //删除跟更改调同一个方法。 Sendinfo si = new Sendinfo(); si.SendinfoStatus = Convert.ToDouble(status); si.Sendtocmd = sendcmd; si.Id = sendid; ExecuteUpdateTrans("Sendinfo.UpdateSendinfo", si, NewMap); SendinfoLast sil = new SendinfoLast(); sil.SendinfoStatus = Convert.ToDouble(status); sil.Sendtocmd = sendcmd; sil.OldId = Convert.ToDouble(oldid); ExecuteUpdateTrans("SendinfoLast.UpdateSendinfoLastByOldid", sil, NewMap); NewMap.CommitTransaction(); return("true"); } catch (Exception e) { NewMap.RollBackTransaction(); return("false"); } }
public string UpdateSendInfoTable_Devid(string devid, string UpdatePara, string cmdResult) { try { Sendinfo si = new Sendinfo(); si.DeviceId = devid; si.SendinfoCommand = cmdResult; Sendinfo sinew = (Sendinfo)ExecuteQueryForObject("Sendinfo.SelectSendInfoTable_Devid", si); if (sinew != null) { Sendinfo sis = new Sendinfo(); sis.SendinfoStatus = Convert.ToDouble(UpdatePara); sis.Resultstr = cmdResult; sis.Id = sinew.Id; ExecuteUpdate("Sendinfo.UpdateSendInfoTable_Devid", sis); return("true"); } else { return("false"); } } catch (Exception e) { return("false"); } }
public string UpdateSendInfoFailByOldId(string oldid, string status, string resultStr, double sendId) { ISqlMapper NewMap = SqlMapper.Instance(); NewMap.BeginTransaction(); try { Sendinfo si = new Sendinfo(); si.SendinfoStatus = Convert.ToDouble(status); si.Resultstr = resultStr; si.Id = sendId; ExecuteUpdateTrans("Sendinfo.UpdateSendinfoFail", si, NewMap); SendinfoLast SFL = new SendinfoLast(); SFL.OldId = Convert.ToDouble(oldid); SFL.SendinfoStatus = Convert.ToDouble(status); SFL.Resultstr = resultStr; ExecuteUpdateTrans("SendinfoLast.UpdateSendinfoLastFailByOldId", si, NewMap); NewMap.CommitTransaction(); return("true"); } catch (Exception e) { NewMap.RollBackTransaction(); return("false"); } }
/// <summary> /// 同时插入SendInfo和SendInfoLast表 /// </summary> /// <param name="entity"></param> /// <returns>失败时返回设备ID</returns> public string InsertData(Sendinfo entity, int oldid) { try { return(_iSendinfoDao.InsertDataNew(entity, oldid)); } catch (Exception e) { return(entity.DeviceId); } }
/// <summary> /// 同时插入SendInfo和SendInfoLast表 /// </summary> /// <param name="entity"></param> /// <returns>失败时返回设备ID</returns> public string InsertData(Sendinfo entity) { try { return(_iSendinfoDao.InsertData(entity)); } catch (Exception e) { return(entity.DeviceId); } }
public void Send(string sockInfo, byte[] datagram, int nSize) { Sendinfo sinfo = new Sendinfo(); sinfo.manager = this; sinfo.sockinfo = sockInfo; sinfo.arr = datagram; sinfo.nBytes = nSize; ThreadPool.QueueUserWorkItem(SendFunc, sinfo); }
public string UpdateSendInfoTable(Sendinfo si) { try { ExecuteUpdate("Sendinfo.UpdateSendinfoTable", si); return("true"); } catch (Exception e) { return("false"); } }
private static void SendFunc(object obj) { Sendinfo send = (Sendinfo)obj; if (null != send.manager && null != send.arr && 0 != send.nBytes) { TcpSocketAny any = null; send.manager.Sock_List.TryGetValue(send.sockinfo, out any); if (null != any) { any.Send(send.arr, send.nBytes); } } }
//public int Update(Sendinfo entity) //{ // return _iSendinfoDao.Update(entity); //} //public int Delete(string condition) //{ // return _iSendinfoDao.Delete(condition); //} /// <summary> /// 更新发送命令表 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <param name="resultStr"></param> /// <returns></returns> public string UpdateSendInfoTable(string id, string status, string resultStr) { try { Sendinfo si = new Sendinfo(); si.Id = Convert.ToDouble(id); si.SendinfoStatus = Convert.ToDouble(status); si.Resultstr = resultStr; return(_iSendinfoDao.UpdateSendInfoTable(si)); } catch (Exception e) { return("false"); } }
/// <summary> /// 添加 /// </summary> /// <param name="entity"></param> /// <returns></returns> public string Insert(Sendinfo entity) { try { object o = _iSendinfoDao.Insert(entity); if (o == null) { return("true"); } else { return("false"); } } catch (Exception e) { return(e.Message); } }
public string UpdateSendInfo(string id, string resultStr, string status, double sendId) { ISqlMapper NewMap = SqlMapper.Instance(); NewMap.BeginTransaction(); try { Sendinfo si = new Sendinfo(); si.SendinfoStatus = Convert.ToDouble(status); si.Resultstr = resultStr; si.Id = sendId; ExecuteUpdateTrans("Sendinfo.UpdateSendinfoStatus", si, NewMap); ExecuteUpdateTrans("SendinfoLast.DeleteSendinfoLast", id, NewMap); NewMap.CommitTransaction(); return("true"); } catch (Exception e) { NewMap.RollBackTransaction(); return("false"); } }
public string InsertDataNew(Sendinfo entity, int oldid) { ISqlMapper NewMap = SqlMapper.Instance(); try { NewMap.BeginTransaction(); int reCount = ExecuteUpdateTrans("Sendinfo.UpdateSendInfoStatus6", entity, NewMap); ExecuteInsertTrans("Sendinfo.InsertSendinfo", entity, NewMap); Sendinfo si = (Sendinfo)ExecuteQueryForObjectTrans("Sendinfo.SelectSendinfoStatus1", entity.DeviceId, NewMap); //Sendinfo s = (Sendinfo)ExecuteQueryForObjectTrans("Sendinfo.SelectSendinfoStatus1", entity.DeviceId, NewMap); if (si != null) { //删除SendinfoLast中所有时间大于5的状态=2的此设备的数据, ExecuteUpdateTrans("SendinfoLast.DeleteSendinfoLastStu2T5", entity.DeviceId, NewMap); SendinfoLast sfl = new SendinfoLast(); sfl.SendinfoId = si.Id; sfl.DeviceId = entity.DeviceId; sfl.CarinfoSim = entity.CarinfoSim; sfl.SendinfoCommand = entity.SendinfoCommand; sfl.SendinfoPtime = entity.SendinfoPtime; sfl.SendinfoStatus = entity.SendinfoStatus; sfl.SendinfoUserid = entity.SendinfoUserid; sfl.SendinfoDescription = entity.SendinfoDescription; sfl.ReceiptFlag = entity.ReceiptFlag; sfl.ReceiptTime = entity.ReceiptTime; sfl.ReceiptSuccflag = entity.ReceiptSuccflag; sfl.Wanguan = entity.Wanguan; sfl.Sendmethod = entity.Sendmethod; sfl.Resultstr = entity.Resultstr; sfl.Formvalue = entity.Formvalue; sfl.Isonline = entity.Isonline; sfl.Sendtotime = entity.Sendtotime; sfl.Sendtocmd = entity.Sendtocmd; sfl.Setcount = entity.Setcount; sfl.Type = entity.Type; sfl.Comandtype = entity.Comandtype; sfl.SendGuid = entity.SendGuid; sfl.OldId = oldid; int count = ExecuteUpdateTrans("SendinfoLast.UpdateSendinfoLastAll", sfl, NewMap); if (count == 0) { ExecuteInsertTrans("SendinfoLast.InsertSendinfoLastNew", sfl, NewMap); } NewMap.CommitTransaction(); return("true"); } else { NewMap.RollBackTransaction(); return("数据出错!"); } } catch (Exception e) { NewMap.RollBackTransaction(); return(entity.DeviceId); } }
public int Update(Sendinfo entity) { return(ExecuteUpdate("Sendinfo.UpdateSendinfo", entity)); }
public object Insert(Sendinfo entity) { return(ExecuteInsert("Sendinfo.InsertSendinfo", entity)); }