public static PRICERANGE GetPRICERANGEFromDocument(Document doc) { PRICERANGE theVal = new PRICERANGE(); theVal._id = new Oid(doc["_id"].ToString()); theVal.DISPLAYORDER = int.Parse(doc["DISPLAYORDER"].ToString()); theVal.VALUENAME = doc["VALUENAME"].ToString(); theVal.DISPLAYNAME = doc["DISPLAYNAME"].ToString(); theVal.LOWBOUND = int.Parse(doc["LOWBOUND"].ToString()); theVal.HIGHBOUND = int.Parse(doc["HIGHBOUND"].ToString()); theVal.DISPLAY_THIS_RANGE = doc["DISPLAY_THIS_RANGE"].ToString(); return(theVal); }
public static PRICERANGE[] GetPRICERANGEsFromQueryDocument(IMongoCollection <Document> coll, Document query) { PRICERANGE[] arr = null; var cursor = coll.Find(query); if (cursor.Documents.Count() > 0) { arr = new PRICERANGE[cursor.Documents.Count()]; int ind = 0; foreach (Document doc in cursor.Documents) { arr[ind++] = GetPRICERANGEFromDocument(doc); } } return(arr); }
public static bool UpdateDocumentFromMEMBER(IMongoCollection <Document> coll, PRICERANGE val) { bool ret = true; Document doc = new Document(); var q = new Document(); q["_id"] = val._id; doc = coll.FindOne(q); if (doc.Count == 0) { return(false); } doc["DISPLAYORDER"] = val.DISPLAYORDER; doc["VALUENAME"] = val.VALUENAME; doc["DISPLAYNAME"] = val.DISPLAYNAME; doc["LOWBOUND"] = val.LOWBOUND; doc["HIGHBOUND"] = val.HIGHBOUND; doc["DISPLAY_THIS_RANGE"] = val.DISPLAY_THIS_RANGE; coll.Save(doc); return(ret); }
public static bool InsertDocumentFromMEMBER(IMongoCollection <Document> coll, PRICERANGE val) { bool ret = true; Document doc = new Document(); doc["DISPLAYORDER"] = val.DISPLAYORDER; doc["VALUENAME"] = val.VALUENAME; doc["DISPLAYNAME"] = val.DISPLAYNAME; doc["LOWBOUND"] = val.LOWBOUND; doc["HIGHBOUND"] = val.HIGHBOUND; doc["DISPLAY_THIS_RANGE"] = val.DISPLAY_THIS_RANGE; coll.Insert(doc); return(ret); }