Beispiel #1
0
def deleteItemsFromMap(request, template_name="uploadFile.html"):
    action = 'deleteItemsFromMap'
    if request.method == 'POST':
        form = UploadFileForm(request.POST, request.FILES)
        if form.is_valid():
            try:
                deleteItemFromMap(-1, request.FILES['file'],True)
                return HttpResponseRedirect('/success/')
            except Exception:
                return HttpResponseRedirect('/error/')
    else:
        form = UploadFileForm()
        return render(request,'uploadFile.html', {'form':form, 'action':action})
Beispiel #2
0
def test_methods(arg):
    if  arg == "dbfill": 
      import testdbinfo 
      testdbinfo.populate_db()
    elif arg == "acc":
      from LOG import accountAccess
      accountAccess.setAccess('vall', '6')
      accountAccess.setAccess('vall', '10')
      accountAccess.setAccess('vall', '20')
    
    elif arg == "getacc":
      from LOG import accountAccess
      array = accountAccess.getAccess('vall')
      work = array.split(',')
      print work
    
    elif arg == "delacc":
      from LOG import accountAccess
      accountAccess.removeAcess('vall', '20')
    elif arg == "addGlasses":
      from INV import addGlasses
      from LOG import insertRegions
      from MAP import addMapAcc
      insertRegions.insertIntoDb("../teamwait/LOG/regionData.csv")
      addMapAcc.insertIntoDb("../teamwait/MAP/MapAccounts.csv", False)
      addGlasses.addGlasses(Maps.objects.get(account_num = 2),2,45,'g','Francis','Clr',42,21,'CC','NA')
      addGlasses.addGlasses(Maps.objects.get(account_num = 1),1,45,'g','Francis','Clr',42,21,'CC','NA')
      addGlasses.addGlasses(Maps.objects.get(account_num = 1),2,44,'ng','Francis','Clr',42,22,'CC','NA')

    elif arg == "deleteGlasses":
      from INV import deleteGlasses
      deleteGlasses.deleteGlasses(1,1)
    
    elif arg == "addItemToMap":
        from INV import addItemToMap
        from LOG import insertRegions
        from MAP import addMapAcc
        insertRegions.insertIntoDb("../teamwait/LOG/regionData.csv")
        addMapAcc.insertIntoDb("../teamwait/MAP/MapAccounts.csv", False)
        addItemToMap.addItemToMap(-1,"SampleGlassesInv.csv")

    elif arg == "deleteItemFromMap":
        from INV import deleteItemFromMap
        from LOG import insertRegions
        from MAP import addMapAcc
        insertRegions.insertIntoDb("../teamwait/LOG/regionData.csv")
        addMapAcc.insertIntoDb("../teamwait/MAP/MapAccounts.csv", False)
        deleteItemFromMap.deleteItemFromMap(1,"sample.csv")
            
   # elif arg == "addMap"
        #addMap test code here
    
    elif arg == "modifyItemStatus":
        from INV import modifyItemStatus
        modifyItemStatus.modifyItemStatus(1, 1, "reorder")
    
    elif arg == "exportToCSV":
      from INV import exportToCSV
      import os
      exportToCSV.exportToCSV('val')

    elif arg == "InitializeToUnsold":
      from INV import changeStatus
      changeStatus.initializeToUnsold(1)

    elif arg == "changeStatus":
      from INV import changeStatus
      changeStatus.changeStatus(1,1,23,"sold")
	  
    elif arg == "addDateOfSale":
      from INV import addDateOfSale
      addDateOfSale.addDateOfSale(1,1,23,'2003-12-12')
	  
    elif arg == "retailerAddRegNum":
      from INV import retailerRegNum
      retailerRegNum.rAddRegNum(2, 1, 1234)
      retailerRegNum.rAddRegNum(1, 1, 1234)
      print 'There should be an error above about duplicate reg numbers'
	  
    elif arg == "retailerEditRegNum":
      from INV import retailerRegNum
      retailerRegNum.rAddRegNum(1, 1, 9876)
      retailerRegNum.rEditRegNum(1,1,9876,80085)
      retailerRegNum.rEditRegNum(1,1,1111111,80085)
      print 'There should be an error in the console above this about incorrect reg number'