Exemplo n.º 1
0
def search_date():
    print("……………………………………………………………………………|")
    print("**** Search projects  **** |")
    print("……………………………………………………………………………|")
    date = input("Enter date for project (dd-mm-yyyy) : ")
    while not have_value(date) or not is_valid_date(date):
        print("Enter Date With Correct format")
        date = input("Enter start date for project (dd-mm-yyyy) : ")
    search = {}
    f = open("projects.txt", "r")
    data_from_file = f.read()
    data_from_file = json.loads(data_from_file)
    for key in data_from_file.keys():
        if convert_to_date(
                data_from_file[key]
            ["start_date"]) <= convert_to_date(date) and convert_to_date(
                data_from_file[key]["end_date"]) >= convert_to_date(date):
            search[f"{key}"] = data_from_file[key]

    if len(search) > 0:
        for key in search:
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|title        |{key}                                       ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|Owner        |{data_from_file[key]['owner']}              ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|details      |{data_from_file[key]['details']}            ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|total target |{data_from_file[key]['total_target']}       ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|start date   |{data_from_file[key]['start_date']}         ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|end date     |{data_from_file[key]['end_date']}           ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
        import projects
        projects.pro_page()
    else:
        print("not found any projects")
        import projects
        projects.pro_page()
Exemplo n.º 2
0
def Create_Pro():
    print("…………………………………………………………………………|")
    print("**** Create project **** |")
    print("…………………………………………………………………………|")

    title = input("Enter title of project : ")
    while not is_alpha(title) or not have_value(title):
        print("title not valid")
        title = input("Enter title of project : ")

    details = input("Enter deatils about project : ")
    while not have_value(details):
        print("details not valid")
        details = input("Enter deatils about project : ")

    total_target = input("Enter total target of project : ")
    while not is_digit(total_target) or not have_value(total_target):
        print("total not valid")
        total_target = input("Enter total target of project : ")

    start_date = input("Enter start date for project (dd-mm-yyyy) : ")
    while not have_value(start_date) or not is_valid_date(start_date):
        print("Enter Date With Correct format")
        start_date = input("Enter start date for project (dd-mm-yyyy) : ")

    end_date = input("Enter end date for project (dd-mm-yyyy) : ")
    while not have_value(end_date) or not is_valid_date(end_date):
        print("Enter Date With Correct format")
        end_date = input("Enter end date for project (dd-mm-yyyy) : ")

    pro1 = Project(title=title,
                   details=details,
                   total_target=total_target,
                   start_date=start_date,
                   end_date=end_date,
                   owner=name)
    # print(pro1.convert_to_dict())
    if not pro_is_exists(title):
        pro1.save_pro(pro1.convert_to_dict())
        print("…………………………………………………………………………………………|")
        print("**** Data Saved Successfully **** |")
        print("…………………………………………………………………………………………|")
        import projects
        projects.pro_page()
    else:
        print("project is exists")
        import projects
        projects.pro_page()
Exemplo n.º 3
0
def View_Pro():
    print("……………………………………………………………………………|")
    print("**** View all projects  **** |")
    print("……………………………………………………………………………|")
    f = open("projects.txt", "r")
    data_from_file = f.read()
    if not data_from_file == "":
        data_from_file = json.loads(data_from_file)
        for key in data_from_file:
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|title        |{key}                                       ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|Owner        |{data_from_file[key]['owner']}              ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|details      |{data_from_file[key]['details']}            ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|total target |{data_from_file[key]['total_target']}       ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|start date   |{data_from_file[key]['start_date']}         ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
            print(
                f"|end date     |{data_from_file[key]['end_date']}           ")
            print(
                "|…………………………………|……………………………………………………………………………………………………………………")
        import projects
        projects.pro_page()
    else:
        print("no Projects found")
        import projects
        projects.pro_page()
Exemplo n.º 4
0
def login():
    global name
    print("……………………………………………|")
    print("**** Login  **** |")
    print("……………………………………………|")
    name = input("Enter User Name : ")
    password = input("Enter Password : "******"users.txt", "r")
    data_from_file = f.read()
    data_from_file = json.loads(data_from_file)
    if name in data_from_file:
        if password == data_from_file[f"{name}"]["password"]:
            #print("you logged in")
            import projects
            projects.pro_page()
        else:
            print("password incorrect")
            login()
    else:
        print("user name not found")
        import Start
Exemplo n.º 5
0
def delete_Pro():
    print("……………………………………………………………………………|")
    print("**** Delete projects  **** |")
    print("……………………………………………………………………………|")
    del_pro = input("Enter title of project for Delete it :")
    if pro_is_exists(del_pro):
        f = open("projects.txt", "r")
        data_from_file = f.read()
        data_from_file = json.loads(data_from_file)
        if data_from_file[f"{del_pro}"]["owner"] == name:
            data_from_file.pop(f"{del_pro}")

            f = open("projects.txt", "w")
            data_to_file = json.dumps(data_from_file)
            f.write(data_to_file)
            f.close()

            print("Project deleted Successfully")
            import projects
            projects.pro_page()
        else:
            print("you can delete your projects only")
            import projects
            projects.pro_page()
    else:
        print("project not exists")
        import projects
        projects.pro_page()
Exemplo n.º 6
0
def edit_Pro():
    print("……………………………………………………………………………|")
    print("**** Edit projects  **** |")
    print("……………………………………………………………………………|")
    edit_pro = input("Enter title of project for edit it :")
    if pro_is_exists(edit_pro):
        f = open("projects.txt", "r")
        data_from_file = f.read()
        data_from_file = json.loads(data_from_file)
        if data_from_file[f"{edit_pro}"]["owner"] == name:
            data_from_file.pop(f"{edit_pro}")

            f = open("projects.txt", "w")
            data_to_file = json.dumps(data_from_file)
            f.write(data_to_file)
            f.close()

            title = input("Enter title of project : ")
            while not is_alpha(title) or not have_value(title):
                print("title not valid")
                title = input("Enter title of project : ")

            details = input("Enter deatils about project : ")
            while not have_value(details):
                print("details not valid")
                details = input("Enter deatils about project : ")

            total_target = input("Enter total target of project : ")
            while not is_digit(total_target) or not have_value(total_target):
                print("total not valid")
                total_target = input("Enter total target of project : ")

            start_date = input("Enter start date for project (dd-mm-yyyy) : ")
            while not have_value(start_date) or not is_valid_date(start_date):
                print("Enter Date With Correct format")
                start_date = input(
                    "Enter start date for project (dd-mm-yyyy) : ")

            end_date = input("Enter end date for project (dd-mm-yyyy) : ")
            while not have_value(end_date) or not is_valid_date(end_date):
                print("Enter Date With Correct format")
                end_date = input("Enter end date for project (dd-mm-yyyy) : ")

            pro1 = Project(title=title,
                           details=details,
                           total_target=total_target,
                           start_date=start_date,
                           end_date=end_date,
                           owner=name)
            # print(pro1.convert_to_dict())

            pro1.save_pro(pro1.convert_to_dict())
            print("…………………………………………………………………………………………|")
            print("**** Data Edited Successfully **** |")
            print("…………………………………………………………………………………………|")
            import projects
            projects.pro_page()
        else:
            print("you can edit your projects only")
            import projects
            projects.pro_page()
    else:
        print("project not exists")
        import projects
        projects.pro_page()