Example #1
0
    def write_post(self):
        scrn_post_contents = self.ids.scrn_post_contents
        scrn_post_contents.clear_widgets()

        user_name = self.ids.name_field
        company_name = self.ids.company_field
        pckg = self.ids.package_field
        selected = self.ids.selected
        year = self.ids.year
        post = self.ids.post_field

        user_name = user_name.text
        company_name = company_name.text
        pckg = pckg.text
        post = post.text
        year = year.text
        selected = selected.text

        if user_name.strip() == '' or company_name.strip() == '' or pckg.strip(
        ) == '' or post.strip() == '' or year.strip() == '' or selected.strip(
        ) == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            self.posts.insert_one({'UserName': user_name, 'Posts': post})

            com = self.company.find_one({
                'UserName': user_name,
                'CompanyName': company_name,
                'Package': pckg,
                'Year': year
            })
            if com == None:
                self.company.insert_one({
                    'UserName': user_name,
                    'CompanyName': company_name,
                    'Package': pckg,
                    'Status': selected,
                    'Year': year
                })
            else:
                self.notify.add_widget(
                    Label(text=
                          '[color=#FF000][b]Data already present[/b][/color]',
                          markup=True))
                self.notify.open()
                Clock.schedule_once(self.killswitch, 1)

        posts = self.get_Posts()
        posttabel = DataTabel(tabel=posts)
        scrn_post_contents.add_widget(posttabel)

        company = self.get_company()
        DataTabel(tabel=company)
Example #2
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        client = MongoClient()
        db = client.stud
        self.users = db.users
        self.posts = db.posts
        self.ques = db.ques
        self.company = db.company
        self.comp_analysis = db.comp_analysis
        self.notify = Notify()

        content = self.ids.scrn_contents
        users = self.get_user()
        usertabel = DataTabel(tabel=users)
        content.add_widget(usertabel)

        #display_post
        scrn_post_content = self.ids.scrn_post_contents
        posts = self.get_Posts()
        prod_tabel = DataTabel(tabel=posts)
        scrn_post_content.add_widget(prod_tabel)

        #display ques
        scrn_que_content = self.ids.scrn_que_contents
        ques = self.get_question()
        ques_tabel = DataTabel(tabel=ques)
        scrn_que_content.add_widget(ques_tabel)

        #display company
        scrn_company_content = self.ids.scrn_company_contents
        company = self.get_company()
        company_tabel = DataTabel(tabel=company)
        scrn_company_content.add_widget(company_tabel)

        company_name = []
        package = []
        year = []

        spinvals = []

        for comp in self.company.find():
            company_name.append(comp['CompanyName'])
            package.append(comp['Package'])
            year.append(comp['Year'])

        for x in range(len(company_name)):
            line = '|'.join([company_name[x], package[x], year[x]])
            if line not in spinvals:
                spinvals.append(line)
        self.ids.target_company.values = spinvals
Example #3
0
    def remove_company(self, user):
        content = self.ids.scrn_company_contents
        content.clear_widgets()

        if user.strip() == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            com = self.company.find_one({'UserName': user})
            if com == None:
                self.notify.add_widget(
                    Label(text='[color=#FF000][b]Data Not Present[/b][/color]',
                          markup=True))
                self.notify.open()
                Clock.schedule_once(self.killswitch, 1)
            else:
                self.company.remove({'UserName': user})

        company = self.get_company()
        company_tabel = DataTabel(tabel=company)
        content.add_widget(company_tabel)
Example #4
0
    def add_company(self, user, company, pckg, status, year):
        content = self.ids.scrn_company_contents
        content.clear_widgets()

        if user.strip() == '' or company.strip() == '' or pckg.strip(
        ) == '' or status.strip() == '' or year.strip() == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            self.company.insert_one({
                'UserName': user,
                'CompanyName': company,
                'Package': pckg,
                'Status': status,
                'Year': year
            })

        company = self.get_company()
        company_tabel = DataTabel(tabel=company)
        content.add_widget(company_tabel)
Example #5
0
    def update_que(self, user, ques):
        content = self.ids.scrn_que_contents
        content.clear_widgets()

        if user.strip() == '' or ques.strip() == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            com = self.ques.find_one({'UserName': user})
            if com == None:
                self.notify.add_widget(
                    Label(text='[color=#FF000][b]Data Not Present[/b][/color]',
                          markup=True))
                self.notify.open()
                Clock.schedule_once(self.killswitch, 1)
            else:
                self.ques.update_one(
                    {'UserName': user},
                    {'$set': {
                        'UserName': user,
                        'Posts': ques
                    }})

        ques = self.get_question()
        ques_tabel = DataTabel(tabel=ques)
        content.add_widget(ques_tabel)
Example #6
0
    def update_post(self, user, post):
        content = self.ids.scrn_post_contents
        content.clear_widgets()

        if user.strip() == '' or post.strip() == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            com = self.posts.find_one({'UserName': user})
            if com == None:
                self.notify.add_widget(
                    Label(text='[color=#FF000][b]Data Not present[/b][/color]',
                          markup=True))
                self.notify.open()
                Clock.schedule_once(self.killswitch, 1)
            else:
                self.posts.update_one(
                    {'UserName': user},
                    {'$set': {
                        'UserName': user,
                        'Posts': post
                    }})

        posts = self.get_Posts()
        posttabel = DataTabel(tabel=posts)
        content.add_widget(posttabel)
Example #7
0
    def update_user(self, user, pwd, year):
        content = self.ids.scrn_contents
        content.clear_widgets()

        if user.strip() == '' or pwd.strip() == '' or year.strip() == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            com = self.users.find_one({'UserName': user})
            if com == None:
                self.notify.add_widget(
                    Label(text='[color=#FF000][b]Data Not Present[/b][/color]',
                          markup=True))
                self.notify.open()
                Clock.schedule_once(self.killswitch, 1)

            else:

                self.users.update_one({'UserName': user}, {
                    '$set': {
                        'UserName': user,
                        'Password': pwd,
                        'Year': year
                    }
                })

        users = self.get_user()
        usertabel = DataTabel(tabel=users)
        content.add_widget(usertabel)
Example #8
0
    def write_post(self):

        scrn_que_contents = self.ids.scrn_que_contents
        scrn_que_contents.clear_widgets()

        user_name = self.ids.name_field
        year = self.ids.year_field
        post = self.ids.post_field

        user_name = user_name.text
        post = post.text
        year = year.text

        if user_name.strip() == '' or post.strip() == '' or year.strip() == '':
            self.notify.add_widget(
                Label(
                    text=
                    '[color=#FFF00][b]Provide Complete Information[/b][/color]',
                    markup=True))
            self.notify.open()
            Clock.schedule_once(self.killswitch, 1)
        else:
            self.ques.insert_one({'UserName': user_name, 'Posts': post})

        ques = self.get_question()
        questabel = DataTabel(tabel=ques)
        scrn_que_contents.add_widget(questabel)
Example #9
0
    def add_que(self, user, que):
        content = self.ids.scrn_que_contents
        content.clear_widgets()

        self.ques.insert_one({'UserName': user, 'Posts': que})

        ques = self.get_question()
        ques_tabel = DataTabel(tabel=ques)
        content.add_widget(ques_tabel)