当前位置: 首页>>代码示例>>Python>>正文


Python DBManager.deleteProductByCode方法代码示例

本文整理汇总了Python中DBManager.DBManager.deleteProductByCode方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.deleteProductByCode方法的具体用法?Python DBManager.deleteProductByCode怎么用?Python DBManager.deleteProductByCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBManager.DBManager的用法示例。


在下文中一共展示了DBManager.deleteProductByCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StockAdmin

# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import deleteProductByCode [as 别名]

#.........这里部分代码省略.........
        self.DBM       = DBManager()

        self.__generateContent()

    def __generateContent( self, myfilter=None ):
        rows = list()

        try:
           for row in self.DBM.getProductos(myfilter):
              rows.append( (row[1],
                            row[3],
                            row[2], 
                            str(row[4]), 
                            str(row[6]),
                            str(row[5])) )
        except TypeError:
              rows.append( ('Vacio', '', '', '', '', '') )

        self.list_ctrl.InsertColumn(0, "Codigo")
        self.list_ctrl.InsertColumn(1, "Marca")
        self.list_ctrl.InsertColumn(2, "Descripcion")
        self.list_ctrl.InsertColumn(3, "Precio")
        self.list_ctrl.InsertColumn(4, "Stock")
        self.list_ctrl.InsertColumn(5, "P-Pedido")

        index = 0
        for row in rows:
            if row[0] != '1000':
               self.list_ctrl.InsertStringItem(index, row[0])
               self.list_ctrl.SetStringItem(index, 1, row[1])
               self.list_ctrl.SetStringItem(index, 2, row[2])
               self.list_ctrl.SetStringItem(index, 3, row[3])
               self.list_ctrl.SetStringItem(index, 4, row[4])
               self.list_ctrl.SetStringItem(index, 5, row[5])
             
               if int( row[4] ) <= int( row[5] ):
                   self.list_ctrl.SetItemBackgroundColour(index, "red")
               else:
                   if index % 2:
                       self.list_ctrl.SetItemBackgroundColour(index, "white")
                   else:
                       self.list_ctrl.SetItemBackgroundColour(index, "gray")

               index += 1

        self.Bind(wx.EVT_BUTTON, self.onSearch, self.btn_cal)
        self.Bind(wx.EVT_BUTTON, self.onAdd, self.btn_add)
        self.Bind(wx.EVT_BUTTON, self.onPrint, self.btn_prt)
        self.Bind(wx.EVT_BUTTON, self.onDel, self.btn_del)

        sizer  = wx.BoxSizer(wx.VERTICAL)
        sizer2 = wx.BoxSizer(wx.HORIZONTAL)

        sizer2.Add(self.btn_cal, 0, wx.ALL, 1)
        sizer2.Add(self.btn_add, 0, wx.ALL, 1)
        sizer2.Add(self.btn_del, 0, wx.ALL, 1)
        sizer2.Add(self.btn_mod, 0, wx.ALL, 1)
        sizer2.Add(self.btn_prt, 0, wx.ALL, 1)
        sizer.Add(sizer2, 0, wx.ALL, 1)
        sizer.Add(self.list_ctrl, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Show(True)

        Publisher().subscribe(self.onSearch, ("producto_buscado"))
        Publisher().subscribe(self.refreshAfterAdd, ("producto_agregado"))

    def onSearch( self, evt ):
        self.list_ctrl.ClearAll()
        search_stock = SearchStock(self, -1, "Buscar")
        self.__generateContent(evt.data)

    def onAdd( self, evt ):
        add_stock = AddStock(self, -1, "Agregar producto")

    def onDel( self, evt ):
        item = self.list_ctrl.GetItem( self.list_ctrl.GetFirstSelected() )
        product = item.GetText()
        result = self.DBM.deleteProductByCode( product )        
        self.Destroy()

    def onPrint( self, evt ):
        dlg = wx.FileDialog(
                            self, message="Choose a file",
                            defaultFile="reporte-tifosi.pdf",
                            wildcard="*.pdf",
                            style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR
        )
        if dlg.ShowModal() == wx.ID_OK:
           paths = dlg.GetPaths()
           path = None
           for path in paths:
              path = path
        dlg.Destroy()

        RPTR = Reporter( path, self.DBM.getProductos(), "stock" )
        RPTR.doReport()

    def refreshAfterAdd( self, evt ):
        self.list_ctrl.ClearAll()
        self.__generateContent()
开发者ID:gaccardo,项目名称:canchas,代码行数:104,代码来源:CanchasMenuStock.py


注:本文中的DBManager.DBManager.deleteProductByCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。