本文整理汇总了Python中DBManager.DBManager.addProduct方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.addProduct方法的具体用法?Python DBManager.addProduct怎么用?Python DBManager.addProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.addProduct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddStock
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import addProduct [as 别名]
#.........这里部分代码省略.........
hbox2 = wx.BoxSizer( wx.HORIZONTAL )
txt_descr = wx.StaticText(self, -1, "Descripcion")
self.ctr_descr = wx.TextCtrl(self, -1, "")
hbox2.Add(txt_descr, wx.EXPAND, 1)
hbox2.Add(self.ctr_descr, wx.EXPAND, 1)
vbox.Add(hbox2, wx.EXPAND)
hbox3 = wx.BoxSizer( wx.HORIZONTAL )
txt_marca = wx.StaticText(self, -1, "Marca")
self.ctr_marca = wx.TextCtrl(self, -1, "")
hbox3.Add(txt_marca, wx.EXPAND, 1)
hbox3.Add(self.ctr_marca, wx.EXPAND, 1)
vbox.Add(hbox3, wx.EXPAND)
hbox4 = wx.BoxSizer( wx.HORIZONTAL )
txt_precio = wx.StaticText(self, -1, "Precio")
self.ctr_precio = wx.TextCtrl(self, -1, "")
hbox4.Add(txt_precio, wx.EXPAND, 1)
hbox4.Add(self.ctr_precio, wx.EXPAND, 1)
vbox.Add(hbox4, wx.EXPAND)
hbox5 = wx.BoxSizer( wx.HORIZONTAL )
txt_ppedido = wx.StaticText(self, -1, "Punto Pedido")
self.ctr_ppedido = wx.TextCtrl(self, -1, "")
hbox5.Add(txt_ppedido, wx.EXPAND, 1)
hbox5.Add(self.ctr_ppedido, wx.EXPAND, 1)
vbox.Add(hbox5, wx.EXPAND)
hbox6 = wx.BoxSizer( wx.HORIZONTAL )
txt_cantidad = wx.StaticText(self, -1, "Cantidad")
self.ctr_cantidad = wx.TextCtrl(self, -1, "")
hbox6.Add(txt_cantidad, wx.EXPAND, 1)
hbox6.Add(self.ctr_cantidad, wx.EXPAND, 1)
vbox.Add(hbox6, wx.EXPAND)
hbox7 = wx.BoxSizer( wx.HORIZONTAL )
btn_agregar = wx.Button(self, -1, "AGREGAR")
hbox7.Add(btn_agregar, flag=wx.CENTER)
vbox.Add(hbox7, flag=wx.CENTER)
self.Bind(wx.EVT_BUTTON, self.OnAdd, btn_agregar)
self.SetSizer( vbox )
self.Show(True)
def OnAdd( self, evt ):
codigo = self.ctr_codigo.GetValue()
descr = self.ctr_descr.GetValue()
marca = self.ctr_marca.GetValue()
precio = self.ctr_precio.GetValue()
ppedido = self.ctr_ppedido.GetValue()
cantidad = self.ctr_cantidad.GetValue()
try:
tmp = float(precio)
except:
wx.MessageBox('El formato de precio debe ser: 0.00',
'No es un precio valido',
wx.OK | wx.ICON_ERROR)
return
try:
tmp = int(ppedido)
except:
wx.MessageBox('Punto de pedido debe ser un numero',
'No es un numero',
wx.OK | wx.ICON_ERROR)
return
try:
tmp = int(cantidad)
except:
wx.MessageBox('Cantidad debe ser un numero', 'No es un numero',
wx.OK | wx.ICON_ERROR)
return
if codigo == '' or \
descr == '' or \
marca == '' or \
precio == '' or \
cantidad == '' or \
ppedido == '':
wx.MessageBox('Hay campos en blanco', 'Error en la carga de datos',
wx.OK | wx.ICON_ERROR)
return
else:
cod, msg = self.DBM.addProduct(codigo,
descr,
marca,
precio,
ppedido,
cantidad)
if not cod:
wx.MessageBox(msg, 'Error en la carga de datos',
wx.OK | wx.ICON_ERROR)
self.Destroy()
Publisher().sendMessage(("producto_agregado"), "refresh")