Subversion Repositories SmartDukaan

Rev

Rev 13630 | Rev 13642 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13630 Rev 13639
Line 21... Line 21...
21
    data['brand'] = data['brand'].strip().upper()
21
    data['brand'] = data['brand'].strip().upper()
22
    query.append({"brand":data['brand']})
22
    query.append({"brand":data['brand']})
23
    query.append({"category_id":data['category_id']})
23
    query.append({"category_id":data['category_id']})
24
    r = collection.find({"$and":query})
24
    r = collection.find({"$and":query})
25
    if r.count() > 0:
25
    if r.count() > 0:
26
        return {"0":"Brand & Category info already present."}
26
        return {0:"Brand & Category info already present."}
27
    else:
27
    else:
28
        collection.insert(data)
28
        collection.insert(data)
29
        return {"1":"Data added successfully"}
29
        return {1:"Data added successfully"}
30
 
30
 
31
def getAllCategoryDiscount():
31
def getAllCategoryDiscount():
32
    data = []
32
    data = []
33
    collection = get_mongo_connection().Dtr.CategoryDiscount
33
    collection = get_mongo_connection().Dtr.CategoryDiscount
34
    cursor = collection.find()
34
    cursor = collection.find()
Line 38... Line 38...
38
 
38
 
39
def addSchemeDetailsForSku(data):
39
def addSchemeDetailsForSku(data):
40
    collection = get_mongo_connection().Dtr.SkuSchemeDetails
40
    collection = get_mongo_connection().Dtr.SkuSchemeDetails
41
    data['addedOn'] = to_java_date(datetime.now())
41
    data['addedOn'] = to_java_date(datetime.now())
42
    collection.insert(data)
42
    collection.insert(data)
43
    return {"1":"Data added successfully"}
43
    return {1:"Data added successfully"}
44
 
44
 
45
def getAllSkuWiseSchemeDetails():
45
def getAllSkuWiseSchemeDetails():
46
    data = []
46
    data = []
47
    collection = get_mongo_connection().Dtr.SkuSchemeDetails
47
    collection = get_mongo_connection().Dtr.SkuSchemeDetails
48
    cursor = collection.find()
48
    cursor = collection.find()
Line 52... Line 52...
52
 
52
 
53
def addSkuDiscountInfo(data):
53
def addSkuDiscountInfo(data):
54
    collection = get_mongo_connection().Dtr.SkuDiscountInfo
54
    collection = get_mongo_connection().Dtr.SkuDiscountInfo
55
    cursor = collection.find({"sku":data['sku']})
55
    cursor = collection.find({"sku":data['sku']})
56
    if cursor.count > 0:
56
    if cursor.count > 0:
57
        return {"0":"Sku information already present."}
57
        return {0:"Sku information already present."}
58
    else:
58
    else:
59
        collection.insert(data)
59
        collection.insert(data)
60
        return {"1":"Data added successfully"}
60
        return {1:"Data added successfully"}
61
 
61
 
62
def getallSkuDiscountInfo():
62
def getallSkuDiscountInfo():
63
    data = []
63
    data = []
64
    collection = get_mongo_connection().Dtr.SkuDiscountInfo
64
    collection = get_mongo_connection().Dtr.SkuDiscountInfo
65
    cursor = collection.find()
65
    cursor = collection.find()
Line 69... Line 69...
69
 
69
 
70
def addExceptionalNlc(data):
70
def addExceptionalNlc(data):
71
    collection = get_mongo_connection().Dtr.ExceptionalNlc
71
    collection = get_mongo_connection().Dtr.ExceptionalNlc
72
    cursor = collection.find({"sku":data['sku']})
72
    cursor = collection.find({"sku":data['sku']})
73
    if cursor.count > 0:
73
    if cursor.count > 0:
74
        return {"0":"Sku information already present."}
74
        return {0:"Sku information already present."}
75
    else:
75
    else:
76
        collection.insert(data)
76
        collection.insert(data)
77
        return {"1":"Data added successfully"}
77
        return {1:"Data added successfully"}
78
 
78
 
79
def getAllExceptionlNlcItems():
79
def getAllExceptionlNlcItems():
80
    data = []
80
    data = []
81
    collection = get_mongo_connection().Dtr.SkuDiscountInfo
81
    collection = get_mongo_connection().Dtr.ExceptionalNlc
82
    cursor = collection.find()
82
    cursor = collection.find()
83
    for val in cursor:
83
    for val in cursor:
84
        data.append(val)
84
        data.append(val)
85
    return data
85
    return data
86
 
86