Subversion Repositories SmartDukaan

Rev

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

Rev 15677 Rev 15678
Line 934... Line 934...
934
            session.close()
934
            session.close()
935
 
935
 
936
class AddAddressToRetailer():
936
class AddAddressToRetailer():
937
    def on_post(self,req,resp, agentId):
937
    def on_post(self,req,resp, agentId):
938
        agentId = int(agentId)
938
        agentId = int(agentId)
939
        try:
-
 
940
            jsonReq = json.loads(req.stream.read(), encoding='utf-8')
939
        jsonReq = json.loads(req.stream.read(), encoding='utf-8')
941
            retailerId = int(jsonReq.get("retailerid"))
940
        retailerId = int(jsonReq.get("retailerid"))
942
            address = jsonReq.get("address")
941
        address = jsonReq.get("address")
943
            storeName = jsonReq.get("storename")
942
        storeName = jsonReq.get("storename")
944
            pin = jsonReq.get("pin")
943
        pin = jsonReq.get("pin")
945
            city = jsonReq.get("city")
944
        city = jsonReq.get("city")
946
            state = jsonReq.get("state")
945
        state = jsonReq.get("state")
947
            updateType = jsonReq.get("updatetype")
946
        updateType = jsonReq.get("updatetype")
948
            addAddressToRetailer(agentId, retailerId, address, storeName, pin, city,state, updateType)
947
        addAddressToRetailer(agentId, retailerId, address, storeName, pin, city,state, updateType)
949
            session.commit()
-
 
950
        finally:
-
 
951
            session.close()
-
 
952
            
948
            
953
def addContactToRetailer(agentId, retailerId, mobile, callType, contactType):
949
def addContactToRetailer(agentId, retailerId, mobile, callType, contactType):
954
    retailerContact = session.query(RetailerContacts).filter_by(retailer_id=retailerId).filter_by(mobile_number=mobile).first()
950
    retailerContact = session.query(RetailerContacts).filter_by(retailer_id=retailerId).filter_by(mobile_number=mobile).first()
955
    if retailerContact is None:
951
    if retailerContact is None:
956
        retailerContact = RetailerContacts()
952
        retailerContact = RetailerContacts()