// SPLBDlg.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "SPLBDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// SPLBDlg::SPLBDlg(CWnd* pParent /*=NULL*/): CDialog(SPLBDlg::IDD, pParent) { m_edit1 = _T(""); m_mode = 0; } void SPLBDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Text(pDX, IDC_EDIT1, m_edit1); } BEGIN_MESSAGE_MAP(SPLBDlg, CDialog) ON_BN_CLICKED(IDC_BUTadd, OnBUTadd) ON_BN_CLICKED(IDC_BUTdel, OnBUTdel) ON_BN_CLICKED(IDC_BUTTON5, OnButton5) ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1) ON_BN_CLICKED(IDC_BUTadd3, OnBUTadd3) ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1) ON_BN_CLICKED(IDC_BUTadd4, OnBUTadd4) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // SPLBDlg message handlers BOOL SPLBDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect rc; m_List1.GetClientRect(rc); CString strHeadings; if (m_mode == 2 || m_mode == 19) { GetDlgItem(IDOK)->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE); CRect rc3, rc2; GetWindowRect(rc3); GetDlgItem(IDC_BUTadd)->GetWindowRect(rc2); rc3.right = rc2.left; MoveWindow(rc3); } else { GetDlgItem(IDOK)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_HIDE); } if (m_mode == 19)GetDlgItem(IDC_BUTadd4)->ShowWindow(SW_SHOW); if (m_mode == 1 || m_mode == 2) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("景点名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("景点"); GetDlgItem(IDC_STATIC2)->SetWindowText("景点名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加景点"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除景点"); SetWindowText("景点设置"); } else if (m_mode == 3) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("套系类别名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("套系类别"); GetDlgItem(IDC_STATIC2)->SetWindowText("套系类别名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加套系类别"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除套系类别"); SetWindowText("套系类别设置"); } else if (m_mode == 4) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("拍摄名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("拍摄名称"); GetDlgItem(IDC_STATIC2)->SetWindowText("拍摄名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加拍摄名称"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除拍摄名称"); SetWindowText("拍摄名称设置"); } else if (m_mode == 5) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("工作内容,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("工作内容"); GetDlgItem(IDC_STATIC2)->SetWindowText("工作内容:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加工作内容"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除工作内容"); SetWindowText("工作内容设置"); } else if (m_mode == 6) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("二销类别,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("二销类别"); GetDlgItem(IDC_STATIC2)->SetWindowText("二销类别:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加二销类别"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除二销类别"); SetWindowText("二销类别设置"); } else if (m_mode == 7) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("前期类别,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("前期类别"); GetDlgItem(IDC_STATIC2)->SetWindowText("前期类别:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加前期类别"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除前期类别"); SetWindowText("前期类别设置"); } else if (m_mode == 8) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("客户来源名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("客户来源"); GetDlgItem(IDC_STATIC2)->SetWindowText("客户来源名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加客户来源"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除客户来源"); SetWindowText("客户来源设置"); } else if (m_mode == 9) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("流失原因名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("流失原因"); GetDlgItem(IDC_STATIC2)->SetWindowText("流失原因名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加流失原因"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除流失原因"); SetWindowText("流失原因设置"); } else if (m_mode == 10) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("接单点名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("接单点"); GetDlgItem(IDC_STATIC2)->SetWindowText("接单点名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加接单点"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除接单点"); SetWindowText("接单点设置"); } else if (m_mode == 11) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("摆放区域名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("摆放区域"); GetDlgItem(IDC_STATIC2)->SetWindowText("摆放区域名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加摆放区域"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除摆放区域"); SetWindowText("摆放区域设置"); } else if (m_mode == 12) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("套系大类名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("套系大类"); GetDlgItem(IDC_STATIC2)->SetWindowText("套系大类名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加套系大类"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除套系大类"); SetWindowText("套系大类设置"); } else if (m_mode == 13) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("二销项目名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("二销项目"); GetDlgItem(IDC_STATIC2)->SetWindowText("二销项目名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加二销项目"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除二销项目"); SetWindowText("二销项目设置"); } else if (m_mode == 14) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("业务种类名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("业务种类"); GetDlgItem(IDC_STATIC2)->SetWindowText("业务种类名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加业务种类"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除业务种类"); SetWindowText("业务种类设置"); } else if (m_mode == 15) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("业务意向名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("业务意向"); GetDlgItem(IDC_STATIC2)->SetWindowText("业务意向名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加业务意向"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除业务意向"); SetWindowText("业务意向设置"); } else if (m_mode == 16) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("客户类别名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("客户类别"); GetDlgItem(IDC_STATIC2)->SetWindowText("客户类别名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加客户类别"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除客户类别"); SetWindowText("客户类别设置"); } else if (m_mode == 17) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("来单医院名称,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("来单医院"); GetDlgItem(IDC_STATIC2)->SetWindowText("来单医院名称:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加来单医院"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除来单医院"); SetWindowText("来单医院设置"); } else if (m_mode == 18 || m_mode == 19) { GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE); strHeadings.Format("客人要求,%d", rc.Width() - 18); GetDlgItem(IDC_STATIC1)->SetWindowText("客人要求"); GetDlgItem(IDC_STATIC2)->SetWindowText("客人要求:"); GetDlgItem(IDC_BUTadd)->SetWindowText("添加客人要求"); GetDlgItem(IDC_BUTdel)->SetWindowText("删除客人要求"); SetWindowText("客人要求设置"); } else strHeadings.Format("商品类别名称,%d", rc.Width() - 18); m_List1.SetHeadings(strHeadings); FillGrid(); CenterWindow(); return TRUE; } void SPLBDlg::FillGrid() { g_sendhead.bsql = 0; if (m_mode == 1 || m_mode == 2) g_sendhead.code[0] = 149; else if (m_mode == 3) g_sendhead.code[0] = 157; else if (m_mode == 4) g_sendhead.code[0] = 158; else if (m_mode == 5) g_sendhead.code[0] = 159; else if (m_mode == 6) g_sendhead.code[0] = 160; else if (m_mode == 7) g_sendhead.code[0] = 169; else if (m_mode == 8) g_sendhead.code[0] = 186; else if (m_mode == 9) g_sendhead.code[0] = 187; else if (m_mode == 10) g_sendhead.code[0] = 188; else if (m_mode == 11) g_sendhead.code[0] = 190; else if (m_mode == 12) g_sendhead.code[0] = 194; else if (m_mode == 13) g_sendhead.code[0] = 195; else if (m_mode == 14) g_sendhead.code[0] = 200; else if (m_mode == 15) g_sendhead.code[0] = 201; else if (m_mode == 16) g_sendhead.code[0] = 202; else if (m_mode == 17) g_sendhead.code[0] = 203; else if (m_mode == 18 || m_mode == 19) g_sendhead.code[0] = 215; else g_sendhead.code[0] = 2; g_sendhead.tabcount = 1; g_pMainWnd->ProcessChatMessageRequest2(2); if (g_bSendOK == 0)return; DataToArray(&g_List1array); m_List1.DeleteAllItems2(); int ii = 0; { m_List1.m_arLabels.SetSize(g_List1array.GetSize(), 1); for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) m_List1.m_arLabels.ElementAt(ii).Copy(g_List1array.ElementAt(ii)); } m_List1.m_LabelCount = ii; m_List1.SetItemCountEx(ii); if (m_mode == 0) { #ifndef CHILD_VERSION BOOL bFind=0; for(ii=0; iiProcessChatMessageRequest2(sql);if(g_bSendOK==0)return; FillGrid(); } #endif } } void SPLBDlg::OnBUTadd() { UpdateData(); m_edit1.TrimLeft(); m_edit1.TrimRight(); if (m_edit1.IsEmpty()) { if (m_mode == 1 || m_mode == 2) AfxMessageBox("景点名称不能为空!", MB_ICONINFORMATION); else if (m_mode == 3) AfxMessageBox("套系类别名称不能为空!", MB_ICONINFORMATION); else if (m_mode == 4) AfxMessageBox("拍摄名称不能为空!", MB_ICONINFORMATION); else if (m_mode == 5) AfxMessageBox("工作内容不能为空!", MB_ICONINFORMATION); else if (m_mode == 6) AfxMessageBox("二销类别不能为空!", MB_ICONINFORMATION); else if (m_mode == 7) AfxMessageBox("前期类别不能为空!", MB_ICONINFORMATION); else if (m_mode == 8) AfxMessageBox("客户来源不能为空!", MB_ICONINFORMATION); else if (m_mode == 9) AfxMessageBox("流失原因不能为空!", MB_ICONINFORMATION); else if (m_mode == 10) AfxMessageBox("接单点不能为空!", MB_ICONINFORMATION); else if (m_mode == 11) AfxMessageBox("摆放区域不能为空!", MB_ICONINFORMATION); else if (m_mode == 12) AfxMessageBox("套系大类不能为空!", MB_ICONINFORMATION); else if (m_mode == 13) AfxMessageBox("二销项目不能为空!", MB_ICONINFORMATION); else if (m_mode == 14) AfxMessageBox("业务种类不能为空!", MB_ICONINFORMATION); else if (m_mode == 15) AfxMessageBox("业务意向不能为空!", MB_ICONINFORMATION); else if (m_mode == 16) AfxMessageBox("客户类别不能为空!", MB_ICONINFORMATION); else if (m_mode == 17) AfxMessageBox("来单医院不能为空!", MB_ICONINFORMATION); else if (m_mode == 18) AfxMessageBox("客人要求不能为空!", MB_ICONINFORMATION); else AfxMessageBox("商品类别不能为空!", MB_ICONINFORMATION); this->GetDlgItem(IDC_EDIT1)->SetFocus(); return; } if (m_mode == 4) { m_edit1.Replace(",", ""); UpdateData(0); } for (int i = 0; i < m_List1.GetItemCount(); i++) { if (m_List1.GetItemText(i, 0) == m_edit1) { if (m_mode == 1 || m_mode == 2) AfxMessageBox("已有此景点!", MB_ICONINFORMATION); else if (m_mode == 3) AfxMessageBox("已有此套系类别!", MB_ICONINFORMATION); else if (m_mode == 4) AfxMessageBox("已有此拍摄名称!", MB_ICONINFORMATION); else if (m_mode == 5) AfxMessageBox("已有此工作内容!", MB_ICONINFORMATION); else if (m_mode == 6) AfxMessageBox("已有此二销类别!", MB_ICONINFORMATION); else if (m_mode == 7) AfxMessageBox("已有此前期类别!", MB_ICONINFORMATION); else if (m_mode == 8) AfxMessageBox("已有此客户来源!", MB_ICONINFORMATION); else if (m_mode == 9) AfxMessageBox("已有此流失原因!", MB_ICONINFORMATION); else if (m_mode == 10) AfxMessageBox("已有此接单点!", MB_ICONINFORMATION); else if (m_mode == 11) AfxMessageBox("已有此摆放区域!", MB_ICONINFORMATION); else if (m_mode == 12) AfxMessageBox("已有此套系大类!", MB_ICONINFORMATION); else if (m_mode == 13) AfxMessageBox("已有此二销项目!", MB_ICONINFORMATION); else if (m_mode == 14) AfxMessageBox("已有此业务种类!", MB_ICONINFORMATION); else if (m_mode == 15) AfxMessageBox("已有此业务意向!", MB_ICONINFORMATION); else if (m_mode == 16) AfxMessageBox("已有此客户类别!", MB_ICONINFORMATION); else if (m_mode == 17) AfxMessageBox("已有此来单医院!", MB_ICONINFORMATION); else if (m_mode == 18) AfxMessageBox("已有此客人要求!", MB_ICONINFORMATION); else AfxMessageBox("已有此类别!", MB_ICONINFORMATION); this->GetDlgItem(IDC_EDIT1)->SetFocus(); return; } } CString sql; if (m_mode == 1 || m_mode == 2) sql.Format("insert into jd (name)values('%s')", m_edit1); else if (m_mode == 3) sql.Format("insert into txlb (name)values('%s')", m_edit1); else if (m_mode == 4) sql.Format("insert into growthtx (name)values('%s')", m_edit1); else if (m_mode == 5) sql.Format("insert into worktype (name)values('%s')", m_edit1); else if (m_mode == 6) sql.Format("insert into expendtype (name)values('%s')", m_edit1); else if (m_mode == 7) sql.Format("insert into baseexpendtype (name)values('%s')", m_edit1); else if (m_mode == 8) sql.Format("insert into clientfrom (name)values('%s')", m_edit1); else if (m_mode == 9) sql.Format("insert into clientreason (name)values('%s')", m_edit1); else if (m_mode == 10) sql.Format("insert into jdd (name)values('%s')", m_edit1); else if (m_mode == 11) sql.Format("insert into dressarea (name)values('%s')", m_edit1); else if (m_mode == 12) sql.Format("insert into [txlb2] (name)values('%s')", m_edit1); else if (m_mode == 13) sql.Format("insert into [sale2type] (name)values('%s')", m_edit1); else if (m_mode == 14) sql.Format("insert into [businesstype] (name)values('%s')", m_edit1); else if (m_mode == 15) sql.Format("insert into [businessintention] (name)values('%s')", m_edit1); else if (m_mode == 16) sql.Format("insert into [clienttype] (name)values('%s')", m_edit1); else if (m_mode == 17) sql.Format("insert into [hospital] (name)values('%s')", m_edit1); else if (m_mode == 18) sql.Format("insert into [clientqequirement] (name)values('%s')", m_edit1); else sql.Format("insert into shangpinlb (name)values('%s')", m_edit1); g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; FillGrid(); } void SPLBDlg::OnBUTdel() { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { if (m_mode == 1 || m_mode == 2) AfxMessageBox("请选中您要删除的景点!", MB_ICONINFORMATION); else if (m_mode == 3) AfxMessageBox("请选中您要删除的套系类别!", MB_ICONINFORMATION); else if (m_mode == 4) AfxMessageBox("请选中您要删除的拍摄名称!", MB_ICONINFORMATION); else if (m_mode == 5) AfxMessageBox("请选中您要删除的工作内容!", MB_ICONINFORMATION); else if (m_mode == 6) AfxMessageBox("请选中您要删除的二销类别!", MB_ICONINFORMATION); else if (m_mode == 7) AfxMessageBox("请选中您要删除的前期类别!", MB_ICONINFORMATION); else if (m_mode == 8) AfxMessageBox("请选中您要删除的客户来源!", MB_ICONINFORMATION); else if (m_mode == 9) AfxMessageBox("请选中您要删除的流失原因!", MB_ICONINFORMATION); else if (m_mode == 10) AfxMessageBox("请选中您要删除的接单点!", MB_ICONINFORMATION); else if (m_mode == 11) AfxMessageBox("请选中您要删除的摆放区域!", MB_ICONINFORMATION); else if (m_mode == 12) AfxMessageBox("请选中您要删除的套系大类!", MB_ICONINFORMATION); else if (m_mode == 13) AfxMessageBox("请选中您要删除的二销项目!", MB_ICONINFORMATION); else if (m_mode == 14) AfxMessageBox("请选中您要删除的业务种类!", MB_ICONINFORMATION); else if (m_mode == 15) AfxMessageBox("请选中您要删除的业务意向!", MB_ICONINFORMATION); else if (m_mode == 16) AfxMessageBox("请选中您要删除的客户类别!", MB_ICONINFORMATION); else if (m_mode == 17) AfxMessageBox("请选中您要删除的来单医院!", MB_ICONINFORMATION); else if (m_mode == 18) AfxMessageBox("请选中您要删除的客人要求!", MB_ICONINFORMATION); else AfxMessageBox("请选中您要删除的类别!", MB_ICONINFORMATION); return; } if (AfxMessageBox("确认删除吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return; int iItem = m_List1.GetNextSelectedItem(pos); CString name = m_List1.GetItemText(iItem, 0); CString sql; if (m_mode == 1 || m_mode == 2) sql.Format("delete from jd where name='%s'", name); else if (m_mode == 3) sql.Format("delete from txlb where name='%s'", name); else if (m_mode == 4) sql.Format("delete from growthtx where name='%s'", name); else if (m_mode == 5) sql.Format("delete from worktype where name='%s'", name); else if (m_mode == 6) sql.Format("delete from expendtype where name='%s'", name); else if (m_mode == 7) sql.Format("delete from baseexpendtype where name='%s'", name); else if (m_mode == 8) sql.Format("delete from clientfrom where name='%s'", name); else if (m_mode == 9) sql.Format("delete from clientreason where name='%s'", name); else if (m_mode == 10) sql.Format("delete from jdd where name='%s'", name); else if (m_mode == 11) sql.Format("delete from dressarea where name='%s'", name); else if (m_mode == 12) sql.Format("delete from [txlb2] where name='%s'", name); else if (m_mode == 13) sql.Format("delete from [sale2type] where name='%s'", name); else if (m_mode == 14) sql.Format("delete from businesstype where name='%s'", name); else if (m_mode == 15) sql.Format("delete from businessintention where name='%s'", name); else if (m_mode == 16) sql.Format("delete from [clienttype] where name='%s'", name); else if (m_mode == 17) sql.Format("delete from [hospital] where name='%s'", name); else if (m_mode == 18) sql.Format("delete from [clientqequirement] where name='%s'", name); else sql.Format("delete from shangpinlb where name='%s'***delete from shangpin where splb='%s'", name, name); g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; FillGrid(); } void SPLBDlg::OnOK() { if (m_mode == 19) // 19=选片时的客户要求; { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { return; } int iItem = m_List1.GetNextSelectedItem(pos); m_edit1 = m_List1.GetItemText(iItem, 0); CDialog::OnOK(); return; } if (m_mode != 2) { CDialog::OnCancel(); return; } POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请先选中景点!", MB_ICONINFORMATION); return; } int iItem; m_array.RemoveAll(); while (pos) { iItem = m_List1.GetNextSelectedItem(pos); m_array.Add(m_List1.GetItemText(iItem, 0)); } CDialog::OnOK(); } void SPLBDlg::OnButton5() { CDialog::OnCancel(); } void SPLBDlg::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) { OnOK(); *pResult = 0; } void SPLBDlg::OnBUTadd3() { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请选中您要修改的类别!", MB_ICONINFORMATION); return; } int iItem = m_List1.GetNextSelectedItem(pos); CString name = m_List1.GetItemText(iItem, 0); UpdateData(); m_edit1.TrimLeft(); m_edit1.TrimRight(); if (m_edit1.IsEmpty()) { AfxMessageBox("商品类别不能为空!", MB_ICONINFORMATION); this->GetDlgItem(IDC_EDIT1)->SetFocus(); return; } if (m_edit1 == name)return; if (AfxMessageBox("确认修改吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return; CString sql, sql2; sql.Format("update shangpinlb set name='%s' where name='%s'", m_edit1, name); sql2.Format("update shangpin set splb='%s' where splb='%s'", m_edit1, name); sql += "***" + sql2; g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; FillGrid(); } void SPLBDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { return; } int iItem = m_List1.GetNextSelectedItem(pos); m_edit1 = m_List1.GetItemText(iItem, 0); UpdateData(0); *pResult = 0; } void SPLBDlg::OnBUTadd4() { SPLBDlg dlg; dlg.m_mode = 18; dlg.DoModal(); FillGrid(); }