Ejemplo n.º 1
0
        public CommonResponse Process(CommandResponse pRequest)
        {
            CommonResponse response = new CommonResponse();

            try
            {
                response.ResultCode = 0;
                DefaultSQLHelper       _sqlHelper = new DefaultSQLHelper(ConfigurationManager.AppSettings["MobileLogConn"]);
                MobileCommandRecordDAO DAO        = new MobileCommandRecordDAO(new Base.MobileDeviceManagementUserInfo(), _sqlHelper);
                var entity = DAO.GetByID(pRequest.CommandID);
                if (entity != null)
                {
                    entity.CommandResponseCount++;
                    entity.ResponseJson = pRequest.ToJSON();
                    if (pRequest.ResponseCode < 100)
                    {
                        entity.Status       = 100;
                        entity.ResponseCode = 0;
                    }
                    else
                    {
                        entity.Status       = 2;
                        entity.ResponseCode = 1;
                        if (entity.CommandResponseCount >= 3)
                        {
                            entity.Status = 3;
                        }
                    }
                    if (pRequest.NeedRepeat)
                    {
                        entity.LastUpdateTime = DateTime.Now;
                    }
                    DAO.Update(entity);
                }
                else
                {
                    throw new Exception("未找到命令");
                }
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                response.Message    = ex.Message;
                response.ResultCode = 200;
            }
            return(response);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(MobileCommandRecordEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }