Esempio n. 1
0
        private InvoiceAutoNumberMonthly GetInvoiceAutoNumberMonthly()
        {
            string id = string.Format("{0}{1}", transactionDate.Year.ToString(), transactionDate.Month.ToString().PadLeft(2, '0'));
            MongoCollection <InvoiceAutoNumberMonthly> collection = mongo.MongoDatabase.GetCollection <InvoiceAutoNumberMonthly>(typeof(InvoiceAutoNumberMonthly).Name);
            InvoiceAutoNumberMonthly invoiceAutoNumber            = collection.FindOneAs <InvoiceAutoNumberMonthly>(Query.And(
                                                                                                                        Query.EQ("_id", BsonValue.Create(id)),
                                                                                                                        Query.EQ(COMPANY_ID_FIELD, BsonValue.Create(companyId))));

            if (invoiceAutoNumber == null)
            {
                invoiceAutoNumber = new InvoiceAutoNumberMonthly(id, companyId, transactionDate.Year, transactionDate.Month);
                collection.Save <InvoiceAutoNumberMonthly>(invoiceAutoNumber);
            }

            return(invoiceAutoNumber);
        }
Esempio n. 2
0
 public static InvoiceAutoNumberMonthly Save(this MongoConfig mongo, InvoiceAutoNumberMonthly invAutoNumber)
 {
     mongo.MongoDatabase.GetCollection<InvoiceAutoNumberMonthly>(typeof(InvoiceAutoNumberMonthly).Name).
         Save<InvoiceAutoNumberMonthly>(invAutoNumber);
     return invAutoNumber;
 }
Esempio n. 3
0
 public static InvoiceAutoNumberMonthly Save(this MongoConfig mongo, InvoiceAutoNumberMonthly invAutoNumber)
 {
     mongo.MongoDatabase.GetCollection <InvoiceAutoNumberMonthly>(typeof(InvoiceAutoNumberMonthly).Name).
     Save <InvoiceAutoNumberMonthly>(invAutoNumber);
     return(invAutoNumber);
 }
Esempio n. 4
0
        private InvoiceAutoNumberMonthly GetInvoiceAutoNumberMonthly()
        {
            string id = string.Format("{0}{1}", transactionDate.Year.ToString(), transactionDate.Month.ToString().PadLeft(2, '0'));
            MongoCollection<InvoiceAutoNumberMonthly> collection = mongo.MongoDatabase.GetCollection<InvoiceAutoNumberMonthly>(typeof(InvoiceAutoNumberMonthly).Name);
            InvoiceAutoNumberMonthly invoiceAutoNumber = collection.FindOneAs<InvoiceAutoNumberMonthly>(Query.And(
                Query.EQ("_id", BsonValue.Create(id)),
                Query.EQ(COMPANY_ID_FIELD, BsonValue.Create(companyId))));

            if (invoiceAutoNumber == null)
            {
                invoiceAutoNumber = new InvoiceAutoNumberMonthly(id, companyId, transactionDate.Year, transactionDate.Month);
                collection.Save<InvoiceAutoNumberMonthly>(invoiceAutoNumber);
            }

            return invoiceAutoNumber;
        }