public static DEALERSHIP GetDEALERSHIPFromDocument(Document doc) { DEALERSHIP theVal = new DEALERSHIP(); theVal._id = new Oid(doc["_id"].ToString()); theVal.DEALER_NAME = doc["DEALER_NAME"].ToString(); theVal.DEALER_URL = doc["DEALER_URL"].ToString(); theVal.PARSER_TYPE = doc["PARSER_TYPE"].ToString(); theVal.MARKET_AREA_NAME = doc["MARKET_AREA_NAME"].ToString(); return(theVal); }
public static DEALERSHIP[] GetDEALERSHIPsFromQueryDocument(IMongoCollection <Document> coll, Document query) { DEALERSHIP[] arr = null; var cursor = coll.Find(query); if (cursor.Documents.Count() > 0) { arr = new DEALERSHIP[cursor.Documents.Count()]; int ind = 0; foreach (Document doc in cursor.Documents) { arr[ind++] = GetDEALERSHIPFromDocument(doc); } } return(arr); }
public static bool UpdateDocumentFromMEMBER(IMongoCollection <Document> coll, DEALERSHIP 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["DEALER_NAME"] = val.DEALER_NAME; doc["DEALER_URL"] = val.DEALER_URL; doc["PARSER_TYPE"] = val.PARSER_TYPE; doc["MARKET_AREA_NAME"] = val.MARKET_AREA_NAME; coll.Save(doc); return(ret); }
public static bool InsertDocumentFromMEMBER(IMongoCollection <Document> coll, DEALERSHIP val) { bool ret = true; Document doc = new Document(); doc["DEALER_NAME"] = val.DEALER_NAME; doc["DEALER_URL"] = val.DEALER_URL; doc["PARSER_TYPE"] = val.PARSER_TYPE; doc["MARKET_AREA_NAME"] = val.MARKET_AREA_NAME; coll.Insert(doc); return(ret); }