def update_project_metadata(id): try: content = request.json _impact = content['Impact'] _websitePicture = content['WebsitePicture'] _caption = content['Caption'] _latitude = content['Latitude'] _longitude = content['Longitude'] _lastUpdatedBy = content['LastUpdatedBy'] sql = "CALL usp_UpdateProjectMetadata(%s,%s,%s,%s,%s,%s,%s)" data = ( id, _impact, _websitePicture, _caption, _latitude, _longitude, _lastUpdatedBy, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def update_project_notes(id): try: content = request.json _statusDesc = content['StatusDescription'] _projOfficerRec = content['ProjOfficerRecommendation'] _keywords = content['Keywords'] _summary = content['Summary'] _problems = content['Problems'] _strengthsWeaknesses = content['StrengthsWeaknesses'] _financeOtherFunders = content['FinanceOtherFunders'] _localContrib = content['LocalContribution'] _lastUpdatedBy = content['LastUpdatedBy'] sql = "CALL usp_UpdateProjectNotes(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" data = ( id, _statusDesc, _projOfficerRec, _keywords, _summary, _problems, _strengthsWeaknesses, _financeOtherFunders, _localContrib, _lastUpdatedBy, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def delete_projectofficer(id): try: sql = "CALL usp_DeleteProjectOfficer(%s)" data = (id, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def delete_district(id): try: sql = "CALL usp_DeleteDistrict(%s)" data = (id, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def delete_purchaseditem(id): try: sql = "CALL usp_RemovePurchasedItemFromProject(%s)" data = (id, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def delete_otherbody(id): try: sql = "CALL usp_DeleteOtherBody(%s)" data = (id, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def delete_projectfunder(id): try: sql = "CALL usp_RemoveFunderFromProject(%s)" data = (id, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def delete_projectngo(id): try: sql = "CALL usp_RemoveNGOFromProject(%s)" data = (id, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e) from application import application
def otherbody_add(): try: content = request.json _name = content['Name'] sql = "CALL usp_InsertOtherBody(%s)" data = (_name, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def update_statuscode(id): try: content = request.json _code = content['StatusCode'] _desc = content['Description'] sql = "CALL usp_UpdateStatusCode(%s,%s,%s)" data = (id,_code,_desc,) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def relatedproject_add(): try: content = request.json _projectid = content['ProjectId'] _related = content['RelationshipKey'] sql = "CALL usp_AddRelatedProject(%s, %s)" data = (_projectid, _related,) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def update_category(id): try: content = request.json _name = content['CategoryName'] _highlevel = content['HighLevelCategory'] if 'HighLevelCategory' in content else 0 sql = "CALL usp_UpdateCategory(%s, %s, %s)" data = (id,_name,_highlevel,) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return request.json except Exception as e: print(e)
def update_otherbody(id): try: content = request.json _name = content['Name'] sql = "CALL usp_UpdateOtherBody(%s,%s)" data = ( id, _name, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def purchaseditem_update(id): try: content = request.json _purchaseditem = content['PurchasedItem'] _datepurchased = content['DatePurchased'] _itemcost = content['ItemCost'] sql = "CALL usp_UpdatePurchasedItem(%s, %s, %s, %s)" data = (id, _purchaseditem, _datepurchased, _itemcost,) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def project_add(): try: content = request.json print(content) _projectId = content['ProjectIdentifier'] _projectName = content['ProjectName'] _projectDesc = content['ProjectDescription'] _appDate = content['ApplicationDate'] _grantApprovedDate = content['DateGrantApproved'] _grantPaidDate = content['DateGrantPaid'] _targetCompletion = content['TargetCompletionDate'] _grantRequested = content['AmountGrantRequested'] _grantApproved = content['AmountGrantApproved'] _grantRecommended = content['AmountGrantRecommended'] _grantPaid = content['AmountGrantPaid'] _totalCost = content['TotalProjectCost'] _statusCodeId = content['StatusCode_Id'] _statusCodeDate = content['StatusCodeDate'] _regionId = content['Region_Id'] _districtId = content['District_Id'] _projectOfficerId = content['ProjOfficer_Id'] sql = "CALL usp_InsertProject(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" data = ( _projectId, _projectName, _projectDesc, _appDate, _grantApprovedDate, _grantPaidDate, _targetCompletion, _grantRequested, _grantApproved, _grantRecommended, _grantPaid, _totalCost, _statusCodeId, _statusCodeDate, _regionId, _districtId, _projectOfficerId, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def projectngo_add(): try: content = request.json _projectid = content['ProjectId'] _ngoid = content['NgoId'] sql = "CALL usp_AddNGOToProject(%s, %s)" data = ( _projectid, _ngoid, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def projectotherbody_add(): try: content = request.json _projectid = content['ProjectId'] _categoryid = content['OtherBodyId'] sql = "CALL usp_AddOtherBodyToProject(%s, %s)" data = ( _projectid, _categoryid, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def projectfunder_add(): try: content = request.json _projectid = content['ProjectId'] _categoryid = content['FunderId'] _amount = content['AmountFunded'] sql = "CALL usp_AddFunderToProject(%s, %s, %s)" data = ( _projectid, _categoryid, _amount, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def projectvisit_update(id): try: content = request.json _visitstart = content['VisitStart'] _visitend = content['VisitEnd'] _visitor = content['Visitor'] sql = "CALL usp_UpdateVisit(%s, %s, %s, %s)" data = ( id, _visitstart, _visitend, _visitor, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def projectvisit_add(): try: content = request.json _projectId = content['ProjectId'] _visitstart = content['VisitStart'] _visitend = content['VisitEnd'] _visitor = content['Visitor'] sql = "CALL usp_AddVisitToProject(%s, %s, %s, %s)" data = ( _projectId, _visitstart, _visitend, _visitor, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def projectdocument_add(): try: content = request.json _projectid = content['ProjectId'] _docname = content['DocName'] _filepath = content['FilePath'] _description = content['Description'] _doccategory = content['DocCategory'] sql = "CALL usp_AddDocumentToProject(%s, %s, %s, %s, %s)" data = ( _projectid, _docname, _filepath, _description, _doccategory, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)
def update_projectofficer(id): try: content = request.json _firstName = content['FirstName'] _lastName = content['LastName'] _tel = content['Tel'] _mob = content['Mobile'] _add1 = content['Address1'] _add2 = content['Address2'] _add3 = content['Address3'] _town = content['Town'] _county = content['County'] _postcode = content['PostCode'] _maincontact = content['MainContact'] _image = content['Image'] _info = content['Info'] sql = "CALL usp_UpdateProjectOfficer(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" data = ( id, _firstName, _lastName, _tel, _mob, _add1, _add2, _add3, _town, _county, _postcode, _maincontact, _image, _info, ) resp = sqlhelper.do_writedata(sql, data) resp.status_code = 200 return resp except Exception as e: print(e)