def GPM(guname): while True: print( "\nMenu\n(1)Add Members\n(2)Show Members\n(3)Assign the members to projects\n(4)Pending approvals\n" "(5)Delete Members\n(6)Previous Menu\n") choice = input(">>> ").lower().rstrip() if choice == "1": print('Welcome Please enter the details to signup') User.sign_up(con, 'member', guname) elif choice == "2": Memberclass.show_members(con, guname) elif choice == "3": print('Here you can assign projects to members') Projects.show_projects(con) Memberclass.show_members(con, guname) Projects.Assign_projects(con) elif choice == "4": print('Here you can see all the pending approvals') Memberclass.Approval_pending(con, guname) elif choice == "6": main.Login_master(con) elif choice == "5": Memberclass.show_members(con, guname) Memberclass.delete_member(con) else: print("Invalid choice, please choose again\n")
def test_Assign_projects(self, project_id_input, memuname_input): project_id_input.return_value = 3 memuname_input.return_value = 'member' Projects.project_id_input(self.db) cursorObj = self.con.cursor() cursorObj.execute( 'Select * from Members where projectid=? and username=? and Gpmapproved =?', ( 2, 'member', 1, )) test_assignproject_output = cursorObj.fetchall() self.assertIsNotNone(test_assignproject_output)
def test_sign_up(self, end_date_input, start_date_input, cost_est_input, member_input, area_input, name_input, Type_input): input_array = [ '2019-02-22', '2019-02-21', 2000, 200, 'area', 'name', 'type' ] end_date_input.return_value = input_array[0] start_date_input.return_value = input_array[1] cost_est_input.return_value = input_array[2] member_input.return_value = input_array[3] area_input.return_value = input_array[4] name_input.return_value = input_array[5] Type_input.return_value = input_array[6] Projects.Create_project(self.db) cursorObj = self.con.cursor() cursorObj.execute('''SELECT * from Projects where area=?''', (input_array[4], )) output = cursorObj.fetchone() self.assertIsNotNone(output)
def test_Approve_Projects(self): approve_projects_output = Projects.Approve_Projects(self.db, 'member') self.assertTrue(approve_projects_output)
def test_delete_project(self): Projects.Delete_project(self.con, 13) cursorObj = self.con.cursor() cursorObj.execute('Select * from Projects where Projectid=?', (13, )) output = cursorObj.fetchone() self.assertIsNone(output)
def test_show_projects(self): projects_output = Projects.show_projects(self.db) self.assertTrue(projects_output)
def test_Assign_projects(self, project_id_input, memuname_input): project_id_input.return_value = 2 memuname_input.return_value = 'member' assign_projects_output = Projects.Assign_projects(self.db) self.assertTrue(assign_projects_output)
def BDO(buname): while True: print( "\nMenu\n(1)Create GPM accounts\n(2)Delete GPM accounts\n(3)Update GPM\n(4)Create Project\n(5)Update " "Project\n(6)Delete Project\n(7)Show GPM accounts\n(8)Show Projects\n(9)Show member accounts\n(10)See " "the complaints\n(11)Approve Pending Requests\n(12)Previous Menu" ) choice = input(">>> ").lower().rstrip() if choice == "1": print('Here you can add new GPM accounts') bdoid = buname User.sign_up(con, 'gpm', bdoid) elif choice == "2": print('Here you can delete GPM accounts') gpms = Grama.List_of_gpms(con, buname) pd.set_option('display.width', None) df = pd.DataFrame(gpms) df.columns = [ 'name', 'username', 'area', 'pincode', 'BdoUsername' ] print(df) uname = input("Please enter a username to be deleted : ") User.delete_account(con, uname, 'gpm') elif choice == "3": print('Here you can Update GPM accounts') gpms = Grama.List_of_gpms(con, buname) pd.set_option('display.width', None) df = pd.DataFrame(gpms) df.columns = [ 'name', 'username', 'area', 'pincode', 'BdoUsername' ] print(df) gpmid = input('Enter the GpmId you want to update : ') Grama.Update_GPM(con, buname, gpmid) elif choice == "4": print('Here you can Create a project') Projects.Create_project(con) elif choice == "5": cursorObj = con.cursor() print('Here you can Update a ProjectMain') Projects.show_projects(con) projid = input( 'Enter the id of the project you want to edit : ') cursorObj.execute('SELECT * from Projects where Projectid=?', (projid, )) projects = cursorObj.fetchone() if projects is not None: Projects.Update_project(con, projid) else: print('No project found with the id', projid) elif choice == "6": print('Here you can Delete a project') Projects.show_projects(con) projid = input( 'Enter the id of the project you want to delete : ') Projects.Delete_project(con, projid) elif choice == "7": print('Here you can see all the accounts') gpms = Grama.List_of_gpms(con, buname) pd.set_option('display.width', None) df = pd.DataFrame(gpms) df.columns = [ 'name', 'username', 'area', 'pincode', 'BdoUsername' ] print(df) elif choice == "8": print('Here you can see all the projects') Projects.show_projects(con) elif choice == "9": print('Here you can see all the member accounts') cursorObj = con.cursor() cursorObj.execute( 'SELECT Members.username,Members.Gpmapproved,Members.Bdoapproved,Members.WorkingDays,' 'Members.pincode,Members.wage,Members.attendance,Members.projectid from GPM INNER JOIN ' 'Members on GPM.username=Members.Gpmid ' 'where GPM.Bdo_id=?', (buname, )) member_under_bdos = cursorObj.fetchall() pd.set_option('display.width', None) df = pd.DataFrame(member_under_bdos) df.columns = [ 'Username', 'Gpm_Approved', 'Bdo_Approved', 'WorkingDays', 'Pincode', 'Wage', 'Attendance', 'ProjectId' ] print(df) elif choice == "10": print( 'Here you can see all the issues raised by the member under you' ) cursorObj = con.cursor() cursorObj.execute( 'SELECT Members.username from GPM INNER JOIN Members on GPM.username=Members.Gpmid ' 'where GPM.Bdo_id=?', (buname, )) memberid = cursorObj.fetchall() for member in memberid: cursorObj.execute( 'SELECT * from Complaints where memberid= ? ', (member[0], )) Complaints_received = cursorObj.fetchall() pd.set_option('display.width', None) df = pd.DataFrame(Complaints_received) try: df.columns = [ 'Id', 'Issue', 'MemberId', 'Bdo_remarks', 'Gpm_remarks' ] print(df) except: print('') main.BDO(buname) elif choice == "11": Projects.show_projects(con) cursorObj = con.cursor() cursorObj.execute( 'SELECT Members.username,Members.Gpmapproved,Members.Bdoapproved,Members.WorkingDays,' 'Members.pincode,Members.wage,Members.attendance,Members.projectid from GPM INNER JOIN ' 'Members on GPM.username=Members.Gpmid ' 'where GPM.Bdo_id=?', (buname, )) member_under_bdos = cursorObj.fetchall() pd.set_option('display.width', None) df = pd.DataFrame(member_under_bdos) df.columns = [ 'Username', 'Gpm_Approved', 'Bdo_Approved', 'WorkingDays', 'Pincode', 'Wage', 'Attendance', 'ProjectId' ] print(df) memuname = input( 'Enter the member username you want to approve : ') Projects.Approve_Projects(con, memuname) elif choice == "12": main.Login_master(con) else: print("Invalid choice, please choose again\n")