Ejemplo n.º 1
0
def modify_donor(inp):
    newrow = []
    our_donors = []
    new_donors = []
    our_donors = donor_data_to_list(our_donors)
    id = inp
    if not any(e[6].lower() == id.lower() for e in our_donors):
        print("ID not found!")
    else:
        for row in our_donors:
            newrow = []
            if id.lower() == row[6].lower():
                print_current_data(row)
                try:
                    newrow = donor_reg.main()
                except donor_reg.UserInterrupt as interruption:
                    newrow = []
                    print(str(interruption))
            if not newrow:
                new_donors.append(row)
            else:
                new_donors.append(newrow)
                print("Donors data has been modified!")
    if new_donors == our_donors or len(new_donors) < len(our_donors):
        write_donors_modified_data_to_csv(our_donors)
    else:
        write_donors_modified_data_to_csv(new_donors)
Ejemplo n.º 2
0
def modify_donor(inp):
    newrow = []
    our_donors = []
    new_donors = []
    our_donors = donor_data_to_list(our_donors)
    id = inp
    if not any(e[6].lower() == id.lower() for e in our_donors):
        print("ID not found!")
    else:
        for row in our_donors:
            newrow = []
            if id.lower() == row[6].lower():
                print_current_data(row)
                try:
                    newrow = donor_reg.main()
                except donor_reg.UserInterrupt as interruption:
                    newrow = []
                    print(str(interruption))
            if not newrow:
                new_donors.append(row)
            else:
                new_donors.append(newrow)
                print("Donors data has been modified!")
    if new_donors == our_donors or len(new_donors) < len(our_donors):
        write_donors_modified_data_to_csv(our_donors)
    else:
        write_donors_modified_data_to_csv(new_donors)
Ejemplo n.º 3
0
def add_donor():
    global connection_obj, cursor_obj
    add_donor = ("INSERT INTO Donors "
               "(name,weight,gender,date_of_birth,last_donation,last_month_sickness,unique_identifier,expiration_of_id,blood_type,hemoglobin,email,mobil) "
               "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s)")
    donors_data = donor_reg.main()
    if donors_data is not None:
        try:
            cursor_obj.execute(add_donor, donors_data)
            connection_obj.commit()
            print("New donor stored successfully")
        except sql.Error as err:
            print(err)
        sleep(3)
Ejemplo n.º 4
0
def add_donor():
    data = donor_reg.main()
    if data:
        donor_csv_writer.store_donor(data)
Ejemplo n.º 5
0
def add_donor():
    data = donor_reg.main()
    if data:
        donor_csv_writer.store_donor(data)