def GetData(self, loai):
     if loai == 1:
         xldb = Unit()
         dsAll = xldb.DanhSach()
     else:
         xldb = ProductTypeModel()
         dsAll = xldb.DanhSach()
     celldata = []
     if dsAll != None:
         for i in range(0, len(dsAll)):
             cell = dsAll[i]
             if loai == 1 and str(cell['unit_name']) != "":
                 celldata.append(str(cell['unit_name']))
             elif loai == 2 and str(cell['product_type_name']) != "":
                 celldata.append(str(cell['product_type_name']))
     return celldata
    def GetCountRow(self):
        count = 1
        xldb =  Unit()
        kq = xldb.DanhSach()
        if kq!=None:
            count = len(kq)

        return count
    def OnLoadData(self):
        xldb =  Unit()
        dsAll =  xldb.DanhSach()
        if dsAll!=None:
            self.m_gridSource.ClearGrid()
            for i in range (0,len(dsAll)):
                cell = dsAll[i]
                self.m_gridSource.SetCellValue(i,0,str(cell['ID']))
                self.m_gridSource.SetCellValue(i,1,str(cell['unit_code']))
                self.m_gridSource.SetCellValue(i,2,str(cell['unit_name']))

        return