📄 opponentcontactform.cpp
字号:
}
BOOL COpponentContactForm::OnInitDialog()
{
CDialog::OnInitDialog();
DWORD style;
style=m_opponentList.GetExStyle();
style=(style|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT)&(~LVS_EX_CHECKBOXES) ;
m_opponentList.SetExtendedStyle(style);
m_opponentList.InsertColumn(0,"编码",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(1,"企业法人",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(2,"单位名称",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(3,"登记日期",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(4,"对手级别",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(5,"行业性质",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(6,"总资产",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(7,"规模",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(8,"网站",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(9,"传真",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(10,"电话",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(11,"邮编",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(12,"帐号",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(13,"地址",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(14,"经营范围",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(15,"经营策略",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(16,"目标市场",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(17,"资源情况",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(18,"发展趋势",LVCFMT_LEFT,100);
m_opponentList.InsertColumn(19,"评价分析",LVCFMT_LEFT,100);
int i=0;
CString strSQL;
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
strSQL="select distinct staffName from staff";
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
while(!(m_pRecordset->adoEOF))
{
m_ourStaffCombo.InsertString(i,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("staffName")));
m_pRecordset->MoveNext();
i++;
}
m_pRecordset->Close();
i=0;
strSQL="select distinct staffName from clientStaff";
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
while(!(m_pRecordset->adoEOF))
{
m_clientStaffCombo.InsertString(i,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("staffName")));
m_pRecordset->MoveNext();
i++;
}
m_pRecordset->Close();
i=0;
_RecordsetPtr m_pOpponentRecordset;
strSQL="select * from opponent";
hTRes = m_pOpponentRecordset.CreateInstance(_T("ADODB.Recordset"));
if (SUCCEEDED(hTRes))
{
hTRes = m_pOpponentRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
while(!(m_pOpponentRecordset->adoEOF))
{
m_opponentList.InsertItem(i,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("opponentID")));
m_opponentList.SetItemText(i,1,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("legalPerson")));
m_opponentList.SetItemText(i,2,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("opponentName")));
m_opponentList.SetItemText(i,3,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("bookinDate")));
m_opponentList.SetItemText(i,4,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("opponentLevel")));
m_opponentList.SetItemText(i,5,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("industryCharacter")));
m_opponentList.SetItemText(i,6,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("allFunds")));
m_opponentList.SetItemText(i,7,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("scale")));
m_opponentList.SetItemText(i,8,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("webSite")));
m_opponentList.SetItemText(i,9,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("telephone")));
m_opponentList.SetItemText(i,10,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("postCode")));
m_opponentList.SetItemText(i,11,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("account")));
m_opponentList.SetItemText(i,12,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("address")));
m_opponentList.SetItemText(i,13,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("manageRange")));
m_opponentList.SetItemText(i,14,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("managePolicy")));
m_opponentList.SetItemText(i,15,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("goalMarket")));
m_opponentList.SetItemText(i,16,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("resourceCondition")));
m_opponentList.SetItemText(i,17,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("developeTend")));
m_opponentList.SetItemText(i,18,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pOpponentRecordset->GetCollect("assess")));
i++;
m_pOpponentRecordset->MoveNext();
}
}
style=m_contactList.GetExStyle();
style=(style|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT)&(~LVS_EX_CHECKBOXES) ;
m_contactList.SetExtendedStyle(style);
m_contactList.InsertColumn(0,"记录编号",LVCFMT_LEFT,100);
m_contactList.InsertColumn(1,"交易时间",LVCFMT_LEFT,100);
m_contactList.InsertColumn(2,"交易地址",LVCFMT_LEFT,100);
m_contactList.InsertColumn(3,"业务来源",LVCFMT_LEFT,100);
m_contactList.InsertColumn(4,"产品名称",LVCFMT_LEFT,100);
m_contactList.InsertColumn(5,"交易单价",LVCFMT_LEFT,100);
m_contactList.InsertColumn(6,"交易数量",LVCFMT_LEFT,100);
m_contactList.InsertColumn(7,"交易金额",LVCFMT_LEFT,100);
m_contactList.InsertColumn(8,"客户代表",LVCFMT_LEFT,100);
m_contactList.InsertColumn(9,"我方代表",LVCFMT_LEFT,100);
m_contactList.InsertColumn(10,"备注",LVCFMT_LEFT,100);
tx_contactDate=GetDlgItem(IDC_contactDate);
tx_contactAddress=GetDlgItem(IDC_contactAddress);
tx_bussinessResource=GetDlgItem(IDC_bussinessResource);
tx_productName=GetDlgItem(IDC_productName);
tx_price=GetDlgItem(IDC_price);
tx_num=GetDlgItem(IDC_num);
tx_total=GetDlgItem(IDC_total);
tx_ourStaff=GetDlgItem(IDC_ourStaff);
tx_clientStaff=GetDlgItem(IDC_clientStaff);
tx_remark=GetDlgItem(IDC_remark);
bt_add=GetDlgItem(IDC_add);
bt_delete=GetDlgItem(IDC_delete);
bt_modify=GetDlgItem(IDC_modify);
bt_save=GetDlgItem(IDC_save);
bt_cancelation=GetDlgItem(IDC_cancelation);
tx_contactDate->EnableWindow(false);
tx_contactAddress->EnableWindow(false);
tx_bussinessResource->EnableWindow(false);
tx_productName->EnableWindow(false);
tx_price->EnableWindow(false);
tx_num->EnableWindow(false);
tx_total->EnableWindow(false);
tx_ourStaff->EnableWindow(false);
tx_clientStaff->EnableWindow(false);
tx_remark->EnableWindow(false);
bt_add->EnableWindow(true);
bt_delete->EnableWindow(false);
bt_modify->EnableWindow(false);
bt_save->EnableWindow(false);
bt_cancelation->EnableWindow(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COpponentContactForm::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
UpdateData(true);
POSITION pos = m_opponentList.GetFirstSelectedItemPosition();
if(pos)
{
int nFirstSelItem = m_opponentList.GetNextSelectedItem(pos);
m_opponentID=m_opponentList.GetItemText(nFirstSelItem,0);
}
m_contactList.DeleteAllItems();
CString strSQL;
strSQL="select * from opponentContact where opponentID='";
strSQL=strSQL+m_opponentID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
int i=0;
while(!(m_pRecordset->adoEOF))
{
CString str;
m_contactList.InsertItem(i, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("recordID")));
COleDateTime contactDate= m_pRecordset->GetCollect("contactDate");
str.Format("%d-%d-%d",contactDate.GetYear(),contactDate.GetMonth(),contactDate.GetDay());
m_contactList.SetItemText(i,1,str);
m_contactList.SetItemText(i,2, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contactAddress")));
m_contactList.SetItemText(i,3, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("businessResource")));
m_contactList.SetItemText(i,4, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productName")));
float price= m_pRecordset->GetCollect("price");
str.Format("%d",price);
m_contactList.SetItemText(i,5,str);
int num= atoi(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num")));
str.Format("%d",num);
float total= m_pRecordset->GetCollect("total");
str.Format("%d",total);
m_contactList.SetItemText(i,6,str);
m_contactList.SetItemText(i,7, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientStaff")));
m_contactList.SetItemText(i,8, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("ourStaff")));
m_contactList.SetItemText(i,9, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark")));
m_pRecordset->MoveNext();
i++;
}
//AfxMessageBox(str);
// CString strSQL;
// strSQL="select * from clientProduct where clientID=";
UpdateData(false);
*pResult = 0;
}
void COpponentContactForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
{
UpdateData(true);
POSITION pos = m_contactList.GetFirstSelectedItemPosition();
if(pos)
{
int nFirstSelItem = m_contactList.GetNextSelectedItem(pos);
m_contactID=m_contactList.GetItemText(nFirstSelItem,0);
}
COpponentContact opponentContact;
opponentContact.GetData(m_opponentID,m_contactID);
m_contactDate = opponentContact.GetContactDate();
m_contactAddress = opponentContact.GetContactAddress();
m_bussinessResource = opponentContact.GetBussinessResource();
m_productName = opponentContact.GetProductName();
m_price = opponentContact.GetPrice();
m_num = opponentContact.GetNum();
m_total = opponentContact.GetTotal();
m_ourStaff = opponentContact.GetOurStaff();
m_clientStaff = opponentContact.GetClientStaff();
m_remark = opponentContact.GetRemark();
tx_contactDate->EnableWindow(false);
tx_contactAddress->EnableWindow(false);
tx_bussinessResource->EnableWindow(false);
tx_productName->EnableWindow(false);
tx_price->EnableWindow(false);
tx_num->EnableWindow(false);
tx_total->EnableWindow(false);
tx_ourStaff->EnableWindow(false);
tx_clientStaff->EnableWindow(false);
tx_remark->EnableWindow(false);
bt_add->EnableWindow(true);
bt_delete->EnableWindow(true);
bt_modify->EnableWindow(true);
bt_save->EnableWindow(false);
bt_cancelation->EnableWindow(false);
UpdateData(false);
*pResult = 0;
}
void COpponentContactForm::Refresh()
{
m_contactList.DeleteAllItems();
CString strSQL;
strSQL="select * from opponentContact where opponentID='";
strSQL=strSQL+m_opponentID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
int i=0;
while(!(m_pRecordset->adoEOF))
{
CString str;
m_contactList.InsertItem(i, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("recordID")));
COleDateTime contactDate= m_pRecordset->GetCollect("contactDate");
str.Format("%d-%d-%d",contactDate.GetYear(),contactDate.GetMonth(),contactDate.GetDay());
m_contactList.SetItemText(i,1,str);
m_contactList.SetItemText(i,2, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contactAddress")));
m_contactList.SetItemText(i,3, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("businessResource")));
m_contactList.SetItemText(i,4, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productName")));
float price= m_pRecordset->GetCollect("price");
str.Format("%d",price);
m_contactList.SetItemText(i,5,str);
int num= atoi(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num")));
str.Format("%d",num);
float total= m_pRecordset->GetCollect("total");
str.Format("%d",total);
m_contactList.SetItemText(i,6,str);
m_contactList.SetItemText(i,7, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientStaff")));
m_contactList.SetItemText(i,8, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("ourStaff")));
m_contactList.SetItemText(i,9, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark")));
m_pRecordset->MoveNext();
i++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -