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 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");
            }
        }
 public string Insert(SendinfoLast entity)
 {
     try
     {
         object o = _iSendinfoLastDao.Insert(entity);
         if (o == null)
         {
             return("true");
         }
         else
         {
             return("false");
         }
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
        //public int Update(SendinfoLast entity)
        //{
        //    return _iSendinfoLastDao.Update(entity);
        //}

        //public int Delete(string condition)
        //{
        //    return _iSendinfoLastDao.Delete(condition);
        //}



        /// <summary>
        /// ·¢ËÍÃüÁîºó¡¢ÃüÁîÖ´Ðгɹ¦ºó¡¢ÃüÁîÖ´ÐÐʧ°ÜµÈ¸üÐÂ״̬
        /// </summary>
        /// <param name="id"></param>
        /// <param name="sendcmd"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public string UpdateStatus(string id, string sendcmd, string status)
        {
            try
            {
                SendinfoLast SFSel = new SendinfoLast();
                SFSel.Id = Convert.ToDouble(id);
                SendinfoLast si = _iSendinfoLastDao.GetSendinfoLast(SFSel);
                if (si != null)
                {
                    return(_iSendinfoLastDao.UpdateStatus(id, si.SendinfoId, sendcmd, status));
                }
                else
                {
                    return("false");
                }
            }
            catch (Exception e)
            {
                return("false");
            }
        }
 /// <summary>
 /// ÃüÁî·¢ËÍʧ°Ü´¦Àí
 /// </summary>
 /// <param name="id"></param>
 /// <param name="status"></param>
 /// <param name="resultStr"></param>
 /// <returns></returns>
 public string UpdateSendInfoFail(string id, string status, string resultStr)
 {
     try
     {
         SendinfoLast SFL = new SendinfoLast();
         SFL.Id = Convert.ToDouble(id);
         SendinfoLast si = _iSendinfoLastDao.GetSendinfoLast(SFL);
         if (si != null)
         {
             return(_iSendinfoLastDao.UpdateSendInfoFail(id, status, resultStr, si.SendinfoId));
         }
         else
         {
             return("false");
         }
     }
     catch (Exception)
     {
         return("false");
     }
 }
 /// <summary>
 /// ·¢ËÍÃüÁîºó¡¢ÃüÁîÖ´Ðгɹ¦ºó¡¢ÃüÁîÖ´ÐÐʧ°ÜµÈ¸üÐÂ״̬
 /// </summary>
 /// <param name="id"></param>
 /// <param name="sendcmd"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public string UpdateStatusNew(string oldid, string sendcmd, string status)
 {
     try
     {
         //SendinfoLast SFSel = new SendinfoLast();
         //SFSel.OldId = Convert.ToDouble(oldid);
         SendinfoLast si = _iSendinfoLastDao.GetSendinfoLastByOldId(oldid);
         if (si != null)
         {
             return(_iSendinfoLastDao.UpdateStatusNew(oldid, si.SendinfoId, sendcmd, status));
         }
         else
         {
             return("false");
         }
     }
     catch (Exception e)
     {
         return("false");
     }
 }
 /// <summary>
 /// ÃüÁî»ØÖ´ºóÖ´Ðгɹ¦µÄÃüÁî´¦Àí¡£¸üз¢ËÍÃüÁîÀúÊ·±í£¬É¾³ý´ý·¢ËÍÃüÁî±í¼Ç¼
 /// </summary>
 /// <param name="id"></param>
 /// <param name="status"></param>
 /// <param name="resultStr"></param>
 /// <returns></returns>
 public string UpdateSendInfoByOldId(string oldid, string status, string resultStr)
 {
     try
     {
         //SendinfoLast SFL = new SendinfoLast();
         //SFL.Id = Convert.ToDouble(oldid);
         SendinfoLast si = _iSendinfoLastDao.GetSendinfoLastByOldId(oldid);
         //SendinfoLast si = _iSendinfoLastDao.GetSendinfoLast(SFL);
         if (si != null)
         {
             return(_iSendinfoLastDao.UpdateSendInfoByOldid(oldid, resultStr, status, si.SendinfoId));
         }
         else
         {
             return("false");
         }
     }
     catch (Exception e)
     {
         return("false");
     }
 }
 public SendinfoLast GetSendinfoLast(SendinfoLast sendinfoLast)
 {
     return((SendinfoLast)ExecuteQueryForObject("SendinfoLast.SelectSendinfoLast", sendinfoLast));
 }
        public int GetSendinfoLastCountByTerNos(SendinfoLast s)
        {
            object count = ExecuteQueryForObject("SendinfoLast.SelectSendinfoLastCountByTerNos", s);

            return((int)count);
        }
 public IList <SendinfoLast> GetSendinfoLastPageByTerNos(SendinfoLast s)
 {
     return(ExecuteQueryForList <SendinfoLast>("SendinfoLast.SelectSendinfoLastPageByTerNos", s));
 }
 public object Insert(SendinfoLast entity)
 {
     return(ExecuteInsert("SendinfoLast.InsertSendinfoLast", entity));
 }
        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 GetSendinfoLastCountByTerNos(SendinfoLast o)
 {
     return(_iSendinfoLastDao.GetSendinfoLastCountByTerNos(o));
 }
        //public IList<SendinfoLast> GetSendinfoLastPage(object o)
        //{
        //    return _iSendinfoLastDao.GetSendinfoLastPage(o);
        //}

        //public int GetSendinfoLastCount(object o)
        //{
        //    return _iSendinfoLastDao.GetSendinfoLastCount(o);
        //}

        /// <summary>
        /// ¸ù¾ÝÖն˱àºÅ²éѯ´ý·¢ËÍÃüÁî
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public IList <SendinfoLast> GetSendinfoLastPageByTerNos(SendinfoLast o)
        {
            return(_iSendinfoLastDao.GetSendinfoLastPageByTerNos(o));
        }