C源码(Kit9011)
void khjb::OnAdd()
{
this->enbalewin(true);
this->enablebutton(false);
this->clearall();
this->autonum();
}
void khjb::OnCancel()
{
this->enbalewin(false);
this->enablebutton(true);
khjbxiugai=0;
this->datatotext();
this->texttowin();
}
void khjb::OnDelete()
{
ado rst;
CString ss,aa;
this->m_txxpNewedit1.GetWindowText(aa);
if(aa.IsEmpty())
{MessageBox("不能为空","提示");
return;}
if(MessageBox("删除后数据将丢失","提示
",MB_txxpNewYESNO)==IDYES)
{
ss.Format("delete from tb_txxpNewClient_txxpNewkhjb where
khjb_txxpNewid = '%s'",aa);
rst.ExecuteSQL(ss);
m_txxpNewlist.DeleteAllItems();
this->loadlist();
this->datatotext();
this->texttowin();
}免费分享源码大全
}
void khjb::OnExit()
{
this->EndDialog(true);
}
void khjb::OnUpdate()
{
CString ss,aa;
this->m_txxpNewedit1.GetWindowText(aa);
if(aa.IsEmpty())
{MessageBox("不能为空","提示");
return;}
this->enbalewin(true);
this->enablebutton(false);
khjbxiugai=1;
}
void khjb::OnSave()
{
ado rst;
this->wintotext();
CString ss,srept;
srept.Format("select  from tb_txxpNewClient_txxpNewkhjb where
khjb_txxpNewjbmc='%s'",edit2);
rst.rstOpen(srept);
if(rst.GetRecordCount()>0)
{
MessageBox("这个级别名称已经存在了","提示");
return;
}
if(khjbxiugai==1)
{ss.Format("UPDATE tb_txxpNewClient_txxpNewkhjb set
khjb_txxpNewjbmc='%s',khjb_txxpNewzdywl='%s',khjb_txxpNewbz='%s' where khjb_txxpNewid='%s'",edit2,edit3,edit4,edit1);}
else
{ss.Format("INSERT INTO tb_txxpNewClient_txxpNewkhjb
values('%s','%s','%s','%s')",edit1,edit2,edit3,edit4);}
rst.ExecuteSQL(ss);
m_txxpNewlist.DeleteAllItems();
this->loadlist();
this->datatotext();
this->texttowin();
this->enbalewin(false);
this->enablebutton(true);
khjbxiugai=0;
}
void khjb::clearall()
{
this->m_txxpNewedit1.SetWindowText("");
this->m_txxpNewedit2.SetWindowText("");
this->m_txxpNewedit3.SetWindowText("");
this->m_txxpNewedit4.SetWindowText("");
}
void khjb::enablebutton(bool butn)
{
toolbar.EnableButton(ID_txxpNewADD,butn);
toolbar.EnableButton(ID_txxpNewUPDATE,butn);
toolbar.EnableButton(ID_txxpNewDELETE,butn);
toolbar.EnableButton(ID_txxpNewSAVE,!butn);
toolbar.EnableButton(ID_txxpNewCANCEL,!butn);
}
void khjb::enbalewin(bool wi)
{
this->m_txxpNewedit1.EnableWindow(wi);
this->m_txxpNewedit2.EnableWindow(wi);
this->m_txxpNewedit3.EnableWindow(wi);
this->m_txxpNewedit4.EnableWindow(wi);
}
void khjb::texttowin()
{
this->m_txxpNewedit1.SetWindowText(edit1);
this->m_txxpNewedit2.SetWindowText(edit2);
this->m_txxpNewedit3.SetWindowText(edit3);
this->m_txxpNewedit4.SetWindowText(edit4);
}
void khjb::wintotext()
{
this->m_txxpNewedit1.GetWindowText(edit1);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。