Ejemplo n.º 1
0
        private InvoiceAutoNumberDefault GetInvoiceAutoNumberDefault()
        {
            MongoCollection <InvoiceAutoNumberDefault> collection = mongo.MongoDatabase.GetCollection <InvoiceAutoNumberDefault>(typeof(InvoiceAutoNumberDefault).Name);
            InvoiceAutoNumberDefault invoiceAutoNumber            = collection.FindOneAs <InvoiceAutoNumberDefault>(Query.And(
                                                                                                                        Query.EQ("_id", BsonValue.Create(typeof(InvoiceAutoNumberDefault).Name)),
                                                                                                                        Query.EQ(COMPANY_ID_FIELD, BsonValue.Create(companyId))));

            if (invoiceAutoNumber == null)
            {
                invoiceAutoNumber = new InvoiceAutoNumberDefault(typeof(InvoiceAutoNumberDefault).Name, companyId);
                collection.Save <InvoiceAutoNumberDefault>(invoiceAutoNumber);
            }

            return(invoiceAutoNumber);
        }
Ejemplo n.º 2
0
        private InvoiceAutoNumberDefault GetInvoiceAutoNumberDefault()
        {
            MongoCollection<InvoiceAutoNumberDefault> collection = mongo.MongoDatabase.GetCollection<InvoiceAutoNumberDefault>(typeof(InvoiceAutoNumberDefault).Name);
            InvoiceAutoNumberDefault invoiceAutoNumber = collection.FindOneAs<InvoiceAutoNumberDefault>(Query.And(
                Query.EQ("_id", BsonValue.Create(typeof(InvoiceAutoNumberDefault).Name)),
                Query.EQ(COMPANY_ID_FIELD, BsonValue.Create(companyId))));

            if (invoiceAutoNumber == null)
            {
                invoiceAutoNumber = new InvoiceAutoNumberDefault(typeof(InvoiceAutoNumberDefault).Name, companyId);
                collection.Save<InvoiceAutoNumberDefault>(invoiceAutoNumber);
            }

            return invoiceAutoNumber;
        }
Ejemplo n.º 3
0
 public static InvoiceAutoNumberDefault Save(this MongoConfig mongo, InvoiceAutoNumberDefault invAutoNumber)
 {
     mongo.MongoDatabase.GetCollection<InvoiceAutoNumberDefault>(typeof(InvoiceAutoNumberDefault).Name).
         Save<InvoiceAutoNumberDefault>(invAutoNumber);
     return invAutoNumber;
 }
Ejemplo n.º 4
0
 public static InvoiceAutoNumberDefault Save(this MongoConfig mongo, InvoiceAutoNumberDefault invAutoNumber)
 {
     mongo.MongoDatabase.GetCollection <InvoiceAutoNumberDefault>(typeof(InvoiceAutoNumberDefault).Name).
     Save <InvoiceAutoNumberDefault>(invAutoNumber);
     return(invAutoNumber);
 }