コード例 #1
0
        public List <FerroFTS.Data.last_location> GetVehicleRoute(string sOu, string sidVehicle, string svehicle, DateTime sStartDate, DateTime sEndDate)
        {
            MongoDB.Driver.FilterDefinition <FerroFTS.Data.last_location> oFilter;
            FerroData.Mongo.DataMongo <FerroFTS.Data.last_location>       oData    = new FerroData.Mongo.DataMongo <FerroFTS.Data.last_location>();
            MongoDB.Driver.FindOptions <FerroFTS.Data.last_location>      oOptions = new MongoDB.Driver.FindOptions <FerroFTS.Data.last_location>();
            List <FerroFTS.Data.last_location> oList;

            try
            {
                oFilter = new MongoDB.Bson.BsonDocument("ou", sOu);
                //Vamos a buscar bien por indicativo bien por vehículo
                if (!string.IsNullOrEmpty(sidVehicle))
                {
                    oFilter = (oFilter & new MongoDB.Bson.BsonDocument("indicative", sidVehicle));
                }
                if (!string.IsNullOrEmpty(svehicle))
                {
                    oFilter = (oFilter & new MongoDB.Bson.BsonDocument("vehicle", svehicle));
                }

                oFilter       = (oFilter & new MongoDB.Bson.BsonDocument("utc_datetime", new MongoDB.Bson.BsonDocument("$gte", sStartDate)));
                oFilter       = (oFilter & new MongoDB.Bson.BsonDocument("utc_datetime", new MongoDB.Bson.BsonDocument("$lte", sEndDate)));
                oData.Session = this._Session;
                oList         = oData.Find(oFilter, oOptions);
                return(oList);
            }
            catch (Exception ex)
            {
                throw new Exception((ex.StackTrace.Substring((ex.StackTrace.LastIndexOf("\r\n") + 4)) + ("\r\n" + ex.Message)));
            }
        }
コード例 #2
0
        public List <FerroFTS.Data.service> GetVehicleServices(string sOu, string sOuService, DateTime sStartDate, DateTime sEndDate)
        {
            MongoDB.Driver.FilterDefinition <FerroFTS.Data.service> oFilter;
            FerroData.Mongo.DataMongo <FerroFTS.Data.service>       oData    = new FerroData.Mongo.DataMongo <FerroFTS.Data.service>();
            MongoDB.Driver.FindOptions <FerroFTS.Data.service>      oOptions = new MongoDB.Driver.FindOptions <FerroFTS.Data.service>();
            List <FerroFTS.Data.service> oList = new List <Data.service>();

            try
            {
                //*****************************************************************
                //Convertimos fechas
                //*****************************************************************
                sStartDate = Data.Common.ParseUTC(sStartDate);
                sEndDate   = Data.Common.ParseUTC(sEndDate);

                /*'*****************************************************************
                 * Agregamos datos al filtro
                 ******************************************************************'*/
                oFilter = new MongoDB.Bson.BsonDocument("ou", sOu);
                oFilter = (oFilter & new MongoDB.Bson.BsonDocument("ou_service", sOuService));
                oFilter = (oFilter & new MongoDB.Bson.BsonDocument("utc_datetime", new MongoDB.Bson.BsonDocument("$gte", sStartDate)));
                oFilter = (oFilter & new MongoDB.Bson.BsonDocument("utc_datetime", new MongoDB.Bson.BsonDocument("$gte", sStartDate)));

                oData.Session = this._Session;
                oList         = oData.Find(oFilter, oOptions);
                return(oList);
            }
            catch (Exception ex)
            {
                throw new Exception((ex.StackTrace.Substring((ex.StackTrace.LastIndexOf("\r\n") + 4)) + ("\r\n" + ex.Message)));
            }
        }
コード例 #3
0
        public List <FerroFTS.Data.last_location> GetLastLocations(string sOu, string sOuService, DateTime sStartDate)
        {
            MongoDB.Driver.FilterDefinition <FerroFTS.Data.last_location> oFilter;
            FerroData.Mongo.DataMongo <FerroFTS.Data.last_location>       oData    = new FerroData.Mongo.DataMongo <FerroFTS.Data.last_location>();
            MongoDB.Driver.FindOptions <FerroFTS.Data.last_location>      oOptions = new MongoDB.Driver.FindOptions <FerroFTS.Data.last_location>();
            List <FerroFTS.Data.last_location> oList;

            try
            {
                oFilter       = new MongoDB.Bson.BsonDocument("ou", sOu);
                oFilter       = (oFilter & new MongoDB.Bson.BsonDocument("ou_service", sOuService));
                oFilter       = (oFilter & new MongoDB.Bson.BsonDocument("utc_datetime", new MongoDB.Bson.BsonDocument("$gte", sStartDate)));
                oData.Session = this._Session;
                oList         = oData.Find(oFilter, oOptions);
                return(oList);
            }
            catch (Exception ex)
            {
                throw new Exception((ex.StackTrace.Substring((ex.StackTrace.LastIndexOf("\r\n") + 4)) + ("\r\n" + ex.Message)));
            }
        }