Beispiel #1
0
        public string GetSubObjectsDemand(string locationId = null)
        {
            locationId = (locationId != null && locationId != "") ? locationId : "";

            string         queryFunction = "getSubObjectsDemand ( \"" + locationId + "\")";
            BsonJavaScript SubFunction   = new BsonJavaScript(queryFunction);

            //Calling the stores Mongo Function
            MongoConection      conection = (MongoConection)Conection.getConection();
            BsonArray           result    = conection.getDataBase().Eval(SubFunction).AsBsonArray;
            List <BsonDocument> documents = new List <BsonDocument>();

            foreach (BsonDocument document in result)
            {
                document.Set("_id", document.GetElement("_id").Value.ToString());
                try
                {
                    document.Set("CreatedTimeStamp", document.GetElement("CreatedTimeStamp").Value.ToString());
                }
                catch (Exception ex) { }

                documents.Add(document);
            }

            return(documents.ToJson());
        }
Beispiel #2
0
 public getReports(string table)
     : base("Reports")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
     //collection.EnsureIndex(IndexKeys.Ascending("_id"), IndexOptions.SetUnique(true));
 }
        public DemandReport(string table) : base("Demand")
        {
            conection  = (MongoConection)Conection.getConection();
            conection1 = (MongoConection)Conection.getConection();
            conection2 = (MongoConection)Conection.getConection();

            collection = conection.getCollection(table);
        }
Beispiel #4
0
        public string GetIdUnico()
        {
            string         queryFunction = "getIDOne()";
            BsonJavaScript SubFunction   = new BsonJavaScript(queryFunction);

            //Calling the stores Mongo Function
            MongoConection conection = (MongoConection)Conection.getConection();
            double         result    = conection.getDataBase().Eval(SubFunction).AsDouble;

            return(result.ToString());
        }
Beispiel #5
0
        public string GetAlldemandsFolio(string objid = null)
        {
            objid = (objid != null && objid != "") ? objid : "";

            string         queryFunction = "getAllDemandsOfObject ( \"" + objid + "\")";
            BsonJavaScript SubFunction   = new BsonJavaScript(queryFunction);

            //Calling the stores Mongo Function
            MongoConection conection = (MongoConection)Conection.getConection();
            String         result    = conection.getDataBase().Eval(SubFunction).AsString;

            return(result);
        }
Beispiel #6
0
        public String NewObjectEPC(String idObjRef, String IdClient)
        {
            String result = "";

            if (idObjRef != null && IdClient != null)
            {
                string         queryFunction = "NewObjectBaseEPC ( '" + IdClient + "', '" + idObjRef + "' )";
                BsonJavaScript JoinFunction  = new BsonJavaScript(queryFunction);

                //Calling the stores Mongo Function
                MongoConection conection = (MongoConection)Conection.getConection();
                result = conection.getDataBase().Eval(JoinFunction).AsString;
            }
            return(result);
        }
Beispiel #7
0
        public String getEPC(String idObjRef, String numEtiq)
        {
            String newepc = "";

            if (idObjRef != null && numEtiq != null)
            {
                string         queryFunction = "generateEPC ( '" + idObjRef + "', " + numEtiq + " )";
                BsonJavaScript JoinFunction  = new BsonJavaScript(queryFunction);

                //Calling the stores Mongo Function
                MongoConection conection = (MongoConection)Conection.getConection();
                BsonDocument   result    = conection.getDataBase().Eval(JoinFunction).AsBsonDocument;

                newepc = result.ToJson();
            }
            return(newepc);
        }
Beispiel #8
0
        /// <summary>
        /// Returns all objects from a location and the locations whitin
        /// </summary>
        /// <param name="locationId"></param>
        /// <returns></returns>
        public string GetSubObjects(string locationId = null, bool filter = false)
        {
            locationId = (locationId != null && locationId != "") ? locationId : "";

            string         queryFunction = "getSubObjects ( \"" + locationId + "\")";
            BsonJavaScript SubFunction   = new BsonJavaScript(queryFunction);

            //Calling the stores Mongo Function
            MongoConection      conection = (MongoConection)Conection.getConection();
            BsonArray           result    = conection.getDataBase().Eval(SubFunction).AsBsonArray;
            List <BsonDocument> documents = new List <BsonDocument>();

            foreach (BsonDocument document in result)
            {
                document.Set("_id", document.GetElement("_id").Value.ToString());
                try
                {
                    document.Set("CreatedTimeStamp", document.GetElement("CreatedTimeStamp").Value.ToString());
                }
                catch (Exception ex) { }
                string type = "true";
                if (filter)
                {
                    try
                    {
                        type = document.GetElement("system_status").Value.ToString().ToLower();
                    }
                    catch { }
                }
                if (filter && type == "false")
                {
                }
                else
                {
                    documents.Add(document);
                }
            }

            return(documents.ToJson());
        }
Beispiel #9
0
        public int GetNumObjects(String idlocation)
        {
            int       result = 0;
            BsonArray objs   = new BsonArray();

            if (idlocation == null || idlocation == "")
            {
                idlocation = "null";
            }

            string         queryFunction = "getSubObjects ('" + idlocation + "' )";
            BsonJavaScript JoinFunction  = new BsonJavaScript(queryFunction);

            //Calling the stores Mongo Function
            MongoConection conection = (MongoConection)Conection.getConection();

            objs = conection.getDataBase().Eval(JoinFunction).AsBsonArray;

            result = objs.Count;

            return(result);
        }
Beispiel #10
0
 public ProfileTable(string table = "Profiles") : base("Profiles")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
Beispiel #11
0
 public LocationsReport(string table)
     : base("Locations")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
Beispiel #12
0
 /// <summary>
 ///     Intilializes the model, sets the collection to users
 /// </summary>
 public UserTable()
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection("Users");
 }
Beispiel #13
0
 /// <summary>
 ///     Initializes the model and sets the Customer collection
 /// </summary>
 public CustomerTable()
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection("Customers");
 }
Beispiel #14
0
 public InventoryReport(string table)
     : base("Inventory")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
Beispiel #15
0
 public MovementReport(string table) : base("MovementProfiles")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
 public MessageReport(string table) : base("Messages")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
 /// <summary>
 ///     Initializes the models
 /// </summary>
 public ObjectPrototypeTable()
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection("ObjectPrototype");
 }
Beispiel #18
0
 public HwReport(string table) : base("Hardware")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
Beispiel #19
0
 /// <summary>
 ///     Initializes the model
 /// </summary>
 /// <param name="collectionname">
 ///     the mongo's collections where the data is
 /// </param>
 public ListTable()
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection("Lists");
 }
 public ObjectsRefReport(string table)
     : base("ReferenceObjects")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }
 public ProccessReport(string table) : base("Processes")
 {
     conection  = (MongoConection)Conection.getConection();
     collection = conection.getCollection(table);
 }