def car_details(self, Reg_N0):
        try:
            # call the getconnection to connect  the database
            connect = self.getconnection()
            cursor = connect.cursor()
            logging.info("connect the database successfully")

            query = 'select Reg_Num,Colour,NumOfDoors,Modelname,ManufactureName from Car,Model,Manufacture where Model.Manudacture_id = Manufacture.Manufacture_id and Model.Model_id =Car.Model_id and Car.Reg_Num =?'

            cursor.execute(query, (Reg_N0, ))
            record = cursor.fetchall()
            # print(record)

            logging.info("successfully fetching the data")
            cursor.close()

            car = Car(record[0][0], record[0][1], record[0][2])
            carmodel = CarModel(model_name=record[0][3])
            manufacture = Manufacture(manufacturename=record[0][4])

            car_detalis_list = [car, carmodel, manufacture]
            return car_detalis_list

        except (Exception, sqlite3.Error) as error:
            logging.error('%s error fetching data', error)

        finally:
            self.close_connection(connect)
    def non_SaleCar_RegNum(self):
        try:
            # call the getconnection to connect  the database
            connect = self.getconnection()
            cursor = connect.cursor()
            logging.info("connect the database successfully")

            query = 'select Reg_Num from Car where Reg_Num not in (select Reg_Num from Sale)'
            cursor.execute(query)
            record = cursor.fetchall()

            logging.info("successfully fetching the data")
            cursor.close()

            car_List = []
            for row in record:
                reg_Num = row[0]

                car = Car(Reg_Num=reg_Num)
                car_List.append(car)

            return car_List

        except (Exception, sqlite3.Error) as error:
            logging.error('%s error fetching reg_Num', error)

        finally:
            self.close_connection(connect)
Exemple #3
0
    def get_modelId(self, modelName):
        try:
            # call the getconnection to connect  the database
            connect = self.getconnection()
            cursor = connect.cursor()
            logging.info("connect the database successfully")

            query = "select Model_id from Model where Modelname = ?"

            cursor.execute(query, (modelName,))
            record = cursor.fetchall()

            logging.info("successfully fetch the Model_id")
            cursor.close()
            # Model_id = record[0][0]
            for i in record:
                # print(i[0])
                Modelid = i[0]
                # print(Modelid)

                add_Car = Car(Model_id=Modelid)

            return add_Car

        except(Exception, sqlite3.Error) as error:
            logging.error('%s error fetching data', error)

        finally:
            self.close_connection(connect)
Exemple #4
0
    def ViewUpgrade(self):


        if self.combo_car_RegNo.get() == "":
            mb.showwarning("Error","Select the Reg_Num")
        else:
            reg_Num=self.combo_car_RegNo.get()
            car=Car(reg_Num)
            Upgrade_detail=Seller().selected_Upgrade_Details(car)
            for i in Upgrade_detail:
                self.fld_view_Upgrade.insert(END,i)
                self.fld_view_Upgrade.insert(END,',')
    def delete(self):
        if self.combo_select_Car.get() == "":
            mb.showwarning("System message",
                           "Select the reg_Num in the combo box")
        else:
            select_car = self.combo_select_Car.get()
            car = Car(Reg_Num=select_car)
            output = Officestaff().deleteCar(car)

            if output:
                mb.showinfo("System message", "Delete successfully")
            else:
                mb.showwarning("System message", " Not successfully deleted")
Exemple #6
0
 def ViewCar(self):
     if self.combo_car_RegNo.get() == "":
         mb.showwarning("Error","Select the Reg_Num")
     else:
         reg_Num=self.combo_car_RegNo.get()
         car=Car(reg_Num)
         car_Sale=Seller().selected_Cardetails(car)
         # print(car_Sale)
         self.fld_Reg_No.insert(END,car_Sale[0])
         self.fld_Colour.insert(END,car_Sale[1])
         self.fld_Num_Doors.insert(END,car_Sale[2])
         self.fld_Modelname.insert(END,car_Sale[3])
         self.fld_ManufactureName.insert(END,car_Sale[4])
Exemple #7
0
 def submit(self):
     if self.combo_Reg_Num.get() == "" or self.combo_componentName.get(
     ) == "":
         mb.showwarning("System message", "Check the field and fill it")
     else:
         reg_Num = self.combo_Reg_Num.get()
         component_name = self.combo_componentName.get()
         car = Car(reg_Num)
         accessories = Accessories(component_Name=component_name)
         results = Officestaff().add_Upgrade(car, accessories)
         if results:
             mb.showinfo("Successful", "insert Sccessful")
         else:
             mb.showwarning("Error message", "insert not successful")
Exemple #8
0
    def add(self):
        if self.fld_Reg_Num.get()=="" or self.fld_Colour.get()=="" or self.fld_Num_Doors.get() =="" or self.combo_Model_name.get()=="":
           mb.showwarning("System message","Check the field and fill it")
        else:
            Reg_Num = self.fld_Reg_Num.get()
            Colour = self.fld_Colour.get()
            Num_Doors = self.fld_Num_Doors.get()
            modelname= self.combo_Model_name.get()

            car = Car(Reg_Num, Colour, Num_Doors)
            carModel=CarModel(model_name=modelname)


            outPut = Officestaff().Addcardetails(car,carModel)
            if outPut:
                mb.showinfo("Successful", "insert Succesfull")
            else:
                    mb.showwarning("Error message", "insert is not successful")
Exemple #9
0
 def Sale(self):
     car=Car(Reg_Num=self.combo_car_RegNo.get())
     final_price=Seller().get_Final_price(car)
     Saleview(car.getRegNum(),final_price)