Esempio n. 1
0
    def getData(self):
        """"""

        bookDict = {}

        #moved down to direct input
        #title = self.titleTxt.GetValue()

        #comment = self.commentTxt.GetValue()

        is_list = self.is_list_chkBox.GetValue()

        if is_list:

            config_value = json.dumps(self.getListDict(), ensure_ascii=True)

        else:
            config_value = self.config_valueTxt.GetValue()

        if self.titleTxt.GetValue() == "":
            commonDlgs.showMessageDlg("Title is Required!", "Error")
            return

        #if "-" in config_value:
        #config_value = config_value.replace("-", "")
        bookDict["title"] = self.titleTxt.GetValue()
        bookDict["config_value"] = config_value
        bookDict["comment"] = self.commentTxt.GetValue()
        bookDict["is_list"] = is_list

        return bookDict
    def getData(self):
        """
        Method to get the values from the text boxes and store them in dictionay objects.
        """
        dictAuthor = {}
        dictBook = {}

        fName = self.txtFirstName.GetValue()
        lName = self.txtLastName.GetValue()
        title = self.txtTitle.GetValue()
        isbn = self.txtIsbn.GetValue()
        publisher = self.txtPublisher.GetValue()

        if fName == "" or title == "":
            commonDlgs.showMessageDlg("Author and Title are required!",
                                      "Error!")
            return

        if "-" in isbn:
            isbn = isbn.replace("-", "_")

        dictAuthor['first_name'] = fName
        dictAuthor['last_name'] = lName
        dictBook['title'] = title
        dictBook['isbn'] = isbn
        dictBook['publisher'] = publisher

        return dictAuthor, dictBook
Esempio n. 3
0
    def getData(self):
        """"""
        authorDict = {}
        bookDict = {}

        fName = self.authorFirstTxt.GetValue()
        lName = self.authorLastTxt.GetValue()
        title = self.titleTxt.GetValue()
        isbn = self.isbnTxt.GetValue()
        publisher = self.publisherTxt.GetValue()

        if fName == "" or title == "":
            commonDlgs.showMessageDlg("Author and Title are Required!",
                                      "Error")
            return

        if "-" in isbn:
            isbn = isbn.replace("-", "")
        authorDict["first_name"] = fName
        authorDict["last_name"] = lName
        bookDict["title"] = title
        bookDict["isbn"] = isbn
        bookDict["publisher"] = publisher

        return authorDict, bookDict
Esempio n. 4
0
 def getData(self):
     """"""
     authorDict = {}
     bookDict = {}
                     
     fName = self.authorFirstTxt.GetValue()
     lName = self.authorLastTxt.GetValue()
     title = self.titleTxt.GetValue()
     isbn = self.isbnTxt.GetValue()
     publisher = self.publisherTxt.GetValue()
     
     if fName == "" or title == "":
         commonDlgs.showMessageDlg("Author and Title are Required!",
                                   "Error")
         return
         
     if "-" in isbn:
         isbn = isbn.replace("-", "")
     authorDict["first_name"] = fName
     authorDict["last_name"] = lName
     bookDict["title"] = title
     bookDict["isbn"] = isbn
     bookDict["publisher"] = publisher
     
     return authorDict, bookDict
Esempio n. 5
0
 def onEdit(self):
     """"""
     personDict = self.getData()
     logic.editRecord(self.selectedRow.mail, personDict)
     commonDlgs.showMessageDlg("Contact Edited Successfully!", "Success",
                               wx.ICON_INFORMATION)
     self.Destroy()
Esempio n. 6
0
 def onEdit(self):
     """"""
     authorDict, bookDict = self.getData()
     comboDict = dict(authorDict.items() + bookDict.items())
     controller.editRecord(self.selectedRow.id, comboDict)
     commonDlgs.showMessageDlg("Book Edited Successfully!", "Success",
                               wx.ICON_INFORMATION)
     self.Destroy()
Esempio n. 7
0
 def onEdit(self):
     """"""
     bookDict = self.getData()
     #comboDict = dict(authorDict.items() + bookDict.items())
     controller.editRecord(self.selectedRow.id, bookDict)
     commonDlgs.showMessageDlg("Config Item Edited Successfully!",
                               "Success", wx.ICON_INFORMATION)
     self.Destroy()
Esempio n. 8
0
 def onDelete(self, event):
     """
     Delete a record
     """
     selectedRow = self.bookResultsOlv.GetSelectedObject()
     if selectedRow == None:
         commonDlgs.showMessageDlg("No row selected!", "Error")
         return
     controller.deleteRecord(selectedRow.id)
     self.showAllRecords()
Esempio n. 9
0
 def onDelete(self, event):
     """
     Delete a record
     """
     selectedRow = self.bookResultsOlv.GetSelectedObject()
     if selectedRow == None:
         commonDlgs.showMessageDlg("No row selected!", "Error")
         return
     controller.deleteRecord(selectedRow.id)
     self.showAllRecords()
Esempio n. 10
0
 def onDelete(self, event):
     """
     Delete a record
     """
     selectedRow = self.personResultsOlv.GetSelectedObject()
     if selectedRow == None:
         commonDlgs.showMessageDlg("No row selected!", "Error")
         return
     logic.deleteRecord(selectedRow.mail)
     self.showAllRecords()
Esempio n. 11
0
 def onEditRecord(self, event):
     """
     Edit a record
     """
     selectedRow = self.bookResultsOlv.GetSelectedObject()
     if selectedRow == None:
         commonDlgs.showMessageDlg("No row selected!", "Error")
         return
     dlg = addModRecord.AddModRecDialog(selectedRow, title="Modify",
                                        addRecord=False)
     dlg.ShowModal()
     dlg.Destroy()
     self.showAllRecords()
Esempio n. 12
0
 def onEditRecord(self, event):
     """
     Edit a record
     """
     selectedRow = self.personResultsOlv.GetSelectedObject()
     if selectedRow == None:
         commonDlgs.showMessageDlg("No row selected!", "Error")
         return
     dlg = addModRecord.AddModRecDialog(selectedRow, title="Modify",
                                        addRecord=False)
     dlg.ShowModal()
     dlg.Destroy()
     self.showAllRecords()
Esempio n. 13
0
 def onAdd(self):
     """
     Add the record to the database
     """
     authorDict, bookDict = self.getData()
     data = ({"author":authorDict, "book":bookDict})
     controller.addRecord(data)
     
     # show dialog upon completion
     commonDlgs.showMessageDlg("Book Added",
                               "Success!", wx.ICON_INFORMATION)
     
     # clear dialog so we can add another book
     for child in self.GetChildren():
         if isinstance(child, wx.TextCtrl):
             child.SetValue("")
Esempio n. 14
0
    def onAdd(self):
        """
        Add the record to the database
        """
        bookDict = self.getData()
        data = ({"book": bookDict})
        controller.addRecord(data)

        # show dialog upon completion
        commonDlgs.showMessageDlg("Config value added", "Success!",
                                  wx.ICON_INFORMATION)

        # clear dialog so we can add another book
        for child in self.GetChildren():
            if isinstance(child, wx.TextCtrl):
                child.SetValue("")
    def onEdit(self):
        """ 
        Method to edit data from the database
        """
        # Get the text input fields from the form.
        dictAuthor, dictBook = self.getData()

        # Create a dictonary of dictonaries.
        data = ({'author': dictAuthor, 'book': dictBook})
        controller.editRecord(self.selectedRow.id, data)

        # display a dialog to notify the end user that the record has been updated.
        commonDlgs.showMessageDlg("Edited Successfully!", "Success!",
                                  wx.ICON_INFORMATION)

        self.Destroy()
    def onAdd(self):
        """ 
        Method to add a record to the database.
        """
        # Get the text input fields from the form.
        dictAuthor, dictBook = self.getData()

        # Create a dictonary of dictonaries.
        data = ({'author': dictAuthor, 'book': dictBook})
        controller.addRecord(data)

        # display a dialog to notify the end user that the record has been added.
        commonDlgs.showMessageDlg("Book Added!", "Success!",
                                  wx.ICON_INFORMATION)

        # clear the text fields to add another record.
        for child in self.GetChildren():
            if isinstance(child, wx.TextCtrl):
                child.SetValue("")
Esempio n. 17
0
 def getData(self):
   
     personDict = {}
                     
     fName = self.first_nameTxt.GetValue()
     lName = self.last_nameTxt.GetValue()
     mail = self.mailTxt.GetValue()
     contact_number = self.contact_numberTxt.GetValue()
     
     if fName == "" or mail == "" or contact_number == "":
         commonDlgs.showMessageDlg("First Name or E-mail or Contact Number are Required!",
                                   "Error")
         return
    
     personDict["first_name"] = fName
     personDict["last_name"] = lName
     personDict["mail"] = mail
     personDict["contact_number"] = contact_number
     
     return personDict
Esempio n. 18
0
 def onExport(self, event):
     selectedRow = self.bookResultsOlv.GetSelectedObjects()
     if not selectedRow:
         commonDlgs.showMessageDlg("No row selected!", "Error")
     else:
         result=self.export2excel(selectedRow)