本文整理匯總了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")