コード例 #1
0
    def login_function(self):

        reg = epm.Product().login_function(self.txt_email_val.get(), self.txt_password_val.get())
        if reg:
            messagebox.showinfo("Success", "Welcome", parent=self.root)
            self.root.destroy()
            root = Tk()
            ob = Product(root)

            import clothing
コード例 #2
0
    def fetch_data(self):
        # Helps to fetch data

        self.Product_table.delete(*self.Product_table.get_children())
        info = sorting.sorting_data(epm.Product().fetch_data())

        for i in info:
            self.Product_table.insert("",
                                      "end",
                                      text=i[0],
                                      values=(i[0], i[1], i[2], i[3], i[4],
                                              i[5], i[6]))
コード例 #3
0
    def fetch_data(self):

        try:
            self.Product_table.delete(*self.Product_table.get_children())
            info = epm.Product().fetch_data()
            for i in info:
                self.Product_table.insert("",
                                          "end",
                                          text=i[0],
                                          values=(i[0], i[1], i[2], i[3], i[4],
                                                  i[5], i[6]))
        except Exception as es:
            print(es)
コード例 #4
0
    def delete_data(self):
        # Helps to delete data

        try:
            if self.id_var.get() != "" or self.name_var.get() != "" or self.type_var.get() != "" \
                    or self.price_var.get() != "" or self.qty_var.get() != "" or self.payment_var.get() != "" \
                    or self.delivery_var.get() != "":
                epm.Product().delete_data(self.id_var.get())
                messagebox.showinfo("Success", "Data deleted successfully")
                self.clear()
                self.fetch_data()
            else:
                messagebox.showerror("Error", "Data field is empty")

        except Exception as es:
            print(es)
コード例 #5
0
    def search_data(self):
        # Helps to search data

        try:
            if self.search_txt.get() != '':
                se = epm.Product().search_data(self.search_by.get(),
                                               self.search_txt.get())
                if len(se) != 0:
                    self.Product_table.delete(
                        *self.Product_table.get_children())
                    for row in se:
                        self.Product_table.insert('', END, values=row)

                else:
                    messagebox.showerror("No Results",
                                         "Invalid product details")

            else:
                messagebox.showerror("Empty", "It cannot be empty")
        except Exception as es:
            print(es)
コード例 #6
0
    def register_data(self):
        try:
            if (self.txt_fname.get() == "" or self.txt_email.get() == ""
                    or self.txt_lname.get() == ""
                    or self.txt_contact.get() == ""
                    or self.txt_password.get() == ""
                    or self.txt_cpassword.get() == ""):
                messagebox.showerror("Error",
                                     "All Fields Are Required",
                                     parent=self.root)

            elif self.txt_password.get() != self.txt_cpassword.get():
                messagebox.showerror(
                    "Error",
                    "Password & Confirm Password should be same",
                    parent=self.root)
            elif self.var_chk.get() == 0:
                messagebox.showerror(
                    "Error",
                    "Please agree to the terms and conditions first",
                    parent=self.root)

            if epm.Product().register_data(self.txt_fname.get(),
                                           self.txt_lname.get(),
                                           self.txt_contact.get(),
                                           self.txt_email.get(),
                                           self.txt_password.get()):
                messagebox.showinfo("Success",
                                    "Registration Successful",
                                    parent=self.root)
                self.clear()
                self.root.destroy()
                import Login

        except Exception as es:
            print(es)
コード例 #7
0
    def update_data(self):
        # Helps to update data

        try:
            if self.id_var.get() != "" or self.name_var.get() != "" or self.type_var.get() != "" or \
                    self.price_var.get() != "" or self.qty_var.get() != "" or self.payment_var.get() != "" \
                    or self.delivery_var.get() != "":

                if epm.Product().update_details(self.type_var.get(),
                                                self.name_var.get(),
                                                self.price_var.get(),
                                                self.qty_var.get(),
                                                self.payment_var.get(),
                                                self.delivery_var.get(),
                                                self.id_var.get()):
                    messagebox.showinfo("Success", "Info updated successfully")

                    self.fetch_data()
                    self.clear()

            else:
                messagebox.showerror("Error", "All fields are required")
        except Exception as es:
            print(es)
コード例 #8
0
    def add_product(self):
        # Helps to add the products

        try:
            if self.id_var.get() != "" or self.name_var.get() != "" or self.type_var.get() != "" or \
                    self.price_var.get() != "" or self.qty_var.get() != "" or self.payment_var.get() != ""\
                    or self.delivery_var.get() != "":

                if epm.Product().add_product(self.id_var.get(),
                                             self.type_var.get(),
                                             self.name_var.get(),
                                             self.price_var.get(),
                                             self.qty_var.get(),
                                             self.payment_var.get(),
                                             self.delivery_var.get()):
                    messagebox.showinfo("Success", "Record has been inserted")
                    self.fetch_data()
                    self.clear()

            else:
                messagebox.showerror("Error", "All fields are required")

        except Exception as es:
            print(es)