def upload(self):
        # 일괄 데이터 업로드
        print("clicked upload button")
        file = QtUtil.showFileDialog(self)
        if (file):
            load_wb = openpyxl.load_workbook(file)
            mylist = []
            for load_ws in load_wb:
                mylist = [[c.value for c in r] for r in load_ws]
                break

            doubleList = []
            for i in range(1, len(mylist)):
                if (mylist[i][1] != ''):
                    checked = rdbms.checkID(mylist[i][1])
                    if (checked != None):
                        if (checked[0]):
                            doubleList.append(
                                (mylist[i][1], checked[1], mylist[i][2]))
                        else:
                            mbr = Member()
                            mbr.MBR_ID = mylist[i][1]
                            mbr.TALK = mylist[i][2]
                            mbr.COIN = mylist[i][3]
                            mbr.PURCHASE = mylist[i][4]
                            mbr.DEPOSIT = mylist[i][5]
                            mbr.SALE = mylist[i][6]
                            mbr.WITHDRAW = mylist[i][7]
                            mbr.RESERVE = mylist[i][8]
                            mbr.TOTAL_PUR = mylist[i][9]
                            mbr.TOTAL_SAL = mylist[i][10]
                            mbr.REVENUE = mylist[i][11]
                            mbr.RATING = mylist[i][12]
                            mbr.WALLET = mylist[i][13]

                            rdbms.excute_sql(mbr.toInsertSql())

            self.showData()

            if len(doubleList) == 0:
                QMessageBox.about(self, "일괄업로드", "정상적으로 업로드를 완료하였습니다.")
            else:
                strList = "\n".join(map(str, doubleList))
                outputFile = os.path.abspath(os.path.join(
                    file, os.pardir)) + "\FailedList.txt"
                print(outputFile)
                fw = open(outputFile, "w")
                fw.write(strList)
                fw.close()

                self.tableWidget2.setRowCount(len(doubleList))

                for i in range(self.tableWidget2.rowCount()):
                    self.tableWidget2.setItem(i, 0,
                                              QTableWidgetItem(doubleList[0]))

                QMessageBox.about(
                    self, "일괄업로드",
                    "업로드를 완료하였지만, 일부 중복데이터가 존재합니다.\n아래 파일을 확인하세요.\n" +
                    outputFile)
    def upload(self):
        # 일괄 데이터 업로드
        print("clicked upload button")
        file = QtUtil.showFileDialog(self)
        if(file):
            load_wb = openpyxl.load_workbook(file)
            mylist = []
            for load_ws in load_wb:
                mylist = [ [c.value for c in r]  for r in load_ws ]
                break

            doubleList = []
            for i in range(1, len(mylist)):
                if(mylist[i][1] != ''):
                    checked = rdbms.checkID(mylist[i][1])
                    if(checked != None):
                        if(checked[0]):
                            doubleList.append((mylist[i][1],checked[1],mylist[i][2]))
                        else:
                            mbr = Member()
                            mbr.MBR_ID = mylist[i][1]
                            mbr.TALK = mylist[i][2]
                            mbr.COIN = mylist[i][3]
                            mbr.PURCHASE = mylist[i][4]
                            mbr.DEPOSIT = mylist[i][5]
                            mbr.SALE = mylist[i][6]
                            mbr.WITHDRAW = mylist[i][7]
                            mbr.RESERVE = mylist[i][8]
                            mbr.TOTAL_PUR = mylist[i][9]
                            mbr.TOTAL_SAL = mylist[i][10]
                            mbr.REVENUE = mylist[i][11]
                            mbr.RATING = mylist[i][12]
                            mbr.WALLET = mylist[i][13]

                            rdbms.excute_sql(mbr.toInsertSql())

            self.showData()

            if len(doubleList) == 0:
                QMessageBox.about(self, "일괄업로드", "정상적으로 업로드를 완료하였습니다.")
            else:
                strList = "\n".join(map(str, doubleList))
                outputFile = os.path.abspath(os.path.join(file, os.pardir))+"\FailedList.txt"
                print(outputFile)
                fw = open(outputFile, "w")
                fw.write(strList)
                fw.close()

                self.tableWidget2.setRowCount(len(doubleList))

                for i in range()
                self.tableWidget2.setItem(i, j, QTableWidgetItem(c))

                QMessageBox.about(self, "일괄업로드", "업로드를 완료하였지만, 일부 중복데이터가 존재합니다.\n아래 파일을 확인하세요.\n"+outputFile)

    def closeEvent(self, event):
       event.accept()
    

    def double_check(self):
        print("clicked double check")
        if(self.formDialog.edit_id.text() != ''):
            checked = rdbms.checkID(self.formDialog.edit_id.text())
            if(checked[0]):
                QMessageBox.warning(self.formDialog, "Warning", f"단톡방 [{checked[1]}] 에 ID가 이미 존재 합니다.")
                self.formDialog.button_doubleCheck.setStyleSheet(staticValues.redButtonStyleSheet)
                self.formDialog.button_doubleCheck.setEnabled(True)
                self.dc = False
            else:
                QMessageBox.about(self.formDialog, "중복체크", "등록가능한 ID 입니다.")
                self.formDialog.button_doubleCheck.setStyleSheet(staticValues.grayButtonStyleSheet)
                self.formDialog.button_doubleCheck.setEnabled(False)
                self.formDialog.edit_id.setEnabled(False)
                self.formDialog.edit_id.setStyleSheet(staticValues.solidStyleSheet+";background-color: #aaaaaa;")
                self.dc = True
        else:
            QMessageBox.warning(self.formDialog, "Warning", "ID 를 입력해주세요.")


    def submit(self):
        if(self.formDialog.edit_id.text() == '' or self.formDialog.edit_talk.text() == ''):
            QMessageBox.warning(self.formDialog, "필수등록", "ID 와 단톡방은 필수 입력사항입니다.")
            return

        if(self.dc):
            mbr = Member()
            mbr.MBR_ID = self.formDialog.edit_id.text()
            mbr.TALK = self.formDialog.edit_talk.text()
            mbr.COIN = self.formDialog.edit_coin.text()
            mbr.PURCHASE = self.formDialog.edit_pur.text()
            mbr.DEPOSIT = self.formDialog.edit_dep.text()
            mbr.SALE = self.formDialog.edit_sal.text()
            mbr.WITHDRAW = self.formDialog.edit_withd.text()
            mbr.RESERVE = self.formDialog.edit_reserve.text()
            mbr.TOTAL_PUR = self.formDialog.edit_totpur.text()
            mbr.TOTAL_SAL = self.formDialog.edit_totsal.text()
            mbr.REVENUE = self.formDialog.edit_revenue.text()
            mbr.RATING = self.formDialog.edit_rating.text()
            mbr.WALLET = self.formDialog.edit_wallet.text()
            
            rdbms.excute_sql(mbr.toInsertSql())
            
            if rdbms.checkID(self.formDialog.edit_id.text())[0]:
                QMessageBox.about(self.formDialog, "회원등록", "회원이 정상적으로 등록되었습니다.")
                self.formDialog.close()
            else:
                QMessageBox.warning(self.formDialog, "회원등록", "회원 등록을 실패하였습니다.")
                self.formDialog.close()
            
            self.showData()
        else:
            QMessageBox.about(self.formDialog, "중복체크", "등록전 중복체크를 하세요")
    

    def update(self, id):
        if(self.formDialog.edit_id.text() == '' or self.formDialog.edit_talk.text() == ''):
            QMessageBox.warning(self.formDialog, "필수등록", "ID 와 단톡방은 필수 입력사항입니다.")
            return

        mbr = Member()
        mbr.MBR_ID = self.formDialog.edit_id.text()
        mbr.TALK = self.formDialog.edit_talk.text()
        mbr.COIN = self.formDialog.edit_coin.text()
        mbr.PURCHASE = self.formDialog.edit_pur.text()
        mbr.DEPOSIT = self.formDialog.edit_dep.text()
        mbr.SALE = self.formDialog.edit_sal.text()
        mbr.WITHDRAW = self.formDialog.edit_withd.text()
        mbr.RESERVE = self.formDialog.edit_reserve.text()
        mbr.TOTAL_PUR = self.formDialog.edit_totpur.text()
        mbr.TOTAL_SAL = self.formDialog.edit_totsal.text()
        mbr.REVENUE = self.formDialog.edit_revenue.text()
        mbr.RATING = self.formDialog.edit_rating.text()
        mbr.WALLET = self.formDialog.edit_wallet.text()
        
        rdbms.excute_sql(mbr.toUpdateSql())

        if rdbms.checkID(self.formDialog.edit_id.text())[0]:
            QMessageBox.about(self.formDialog, "회원수정", "회원이 정상적으로 수정되었습니다.")
            self.formDialog.close()
        else:
            QMessageBox.warning(self.formDialog, "회원수정", "회원 수정을 실패하였습니다.")
            self.formDialog.close()

        self.showData()
    

    def showData(self):
        print("showData")
        datas = rdbms.selectAll()
        if not datas:
            QMessageBox.warning(self, "초기DB생성", "보유중인 DB가 없어 새로 생성합니다.")
            return False
        self.tableWidget.setRowCount(len(datas))
        for i, d in enumerate(datas):
            for j, c in enumerate(d):
                self.tableWidget.setItem(i, j, QTableWidgetItem(c))

    def search(self):
        print("search")
        search_id = self.edit_search.text()
        if search_id != "":
            for i in range(self.tableWidget.rowCount()):
                if(self.tableWidget.item(i,0).text() == self.edit_search.text()):
                    self.tableWidget.setCurrentCell(i,1)
                    return
            
            QMessageBox.warning(self, "검색", "해당 ID가 존재하지 않습니다.")
        else:
            QMessageBox.warning(self, "검색", "검색할 ID를 입력해주세요.")