def OnNewItem(self,event) : data=[] #try: ##print "cuselrow",self.cuselrow #cu_name=self.m_gridctrl.GetCellValue(self.cuselrow,0).strip() #sql='select * from %s where name=%s;'%(self.maintable,'%s') #value=(cu_name,) ##print value #data=self.getPyData(self.cntx,sql,value) ##print "get key", data[0].keys() #except: #wx.MessageBox("open table error") #print "data is",data #currenttable = self.m_gridctrl.GetTable() #currenttable.InsertRows(self.cuselrow, newdata) #print "self.ptypedata", self.pTypeData newdialog = managerDialog(self,self.titles['new'],data, cntx=self.cntx, colables=self.py_colables, ptype=self.pTypeData, flag='new') newdialog.Centre(wx.BOTH) newdialog.ShowModal() if newdialog._successOut == True: currenttable = self.m_gridctrl.GetTable() currenttable.InsertRows(pos=self.cuselrow) self._UpdateGridData(newdialog) self.m_gridctrl.ForceRefresh()
def OnModifyItem(self,event): try: #print "cuselrow",self.cuselrow cu_name=self.m_gridctrl.GetCellValue(self.cuselrow,0).strip() sql='select * from %s where name=%s;'%(self.maintable,'%s') value=(cu_name,) #print value data=self.getPyData(self.cntx,sql,value) #print "get key", data[0].keys() except: wx.MessageBox("open table error") return #print "data is",data newdialog = managerDialog(self, self.titles['modify'],data, cntx=self.cntx, colables=self.py_colables, ptype=self.pTypeData, flag='modify') newdialog.Centre(wx.BOTH) newdialog.ShowModal() if newdialog._successOut == True: self._UpdateGridData(newdialog) self.m_gridctrl.ForceRefresh() else: return
def OnGridSelDbClicked(self,event): #colables = [(0, u"姓名","name"), (1, u"性别","sex"), (2, u"职位","job"), (3, u"联系电话","mp"), #(4, u'身份证号',"idcard_num"), (5, u"身份证地址","idcard_addr"), (6, u"劳动合同号","labor_contract_num"), #(7, u'紧急联系人',"emergency_contactor"),(8, u'紧急联系人电话',"emergency_mp"),(9,u"出生日期","birth_date"), #(10,u"银行名称","bank_name"),(11,u"银行帐号","bank_account"),(12,u"入职日期","employment_date"),(13,u"离职日期","termination_date"), #(14,u"填表","input_man"),(15,u"填表日期","input_date"),(16,u"当前状态","status"),(17,u"计薪方式","pay_way")] #titles={"total": u"人员管理","new":u"新增人员","read":u"人员查询","modify":u"人员修改"} #data={"maintable":"human","treetable":"organization","colables":colables,"titles":titles} data=[] try: #print "cuselrow",self.cuselrow cu_name=self.m_gridctrl.GetCellValue(self.cuselrow,0).strip() sql='select * from %s where name=%s;'%(self.maintable,'%s') value=(cu_name,) #print value data=self.getPyData(self.cntx,sql,value) #print "get key", data[0].keys() except: wx.MessageBox("open table error") #print self.pTypeData newdialog = managerDialog(self,self.titles['read'],data, cntx=self.cntx, colables=self.py_colables, ptype=self.pTypeData) newdialog.Centre(wx.BOTH) newdialog.ShowModal()