📄 opponentinfoform.cpp
字号:
tx_opponentName->EnableWindow(false);
tx_bookinDate->EnableWindow(false);
tx_opponentLevel->EnableWindow(false);
tx_legalPerson->EnableWindow(false);
tx_area->EnableWindow(false);
tx_address->EnableWindow(false);
tx_postCode->EnableWindow(false);
tx_telephone->EnableWindow(false);
tx_fax->EnableWindow(false);
tx_webSite->EnableWindow(false);
tx_manageRange->EnableWindow(false);
tx_industryCharacter->EnableWindow(false);
tx_allFunds->EnableWindow(false);
tx_scale->EnableWindow(false);
tx_managePolicy->EnableWindow(false);
tx_goalMarket->EnableWindow(false);
tx_resourceCondition->EnableWindow(false);
tx_developTend->EnableWindow(false);
tx_assess->EnableWindow(false);
bt_add->EnableWindow(true);
bt_delete->EnableWindow(false);
bt_modify->EnableWindow(false);
bt_cancelation->EnableWindow(false);
bt_save->EnableWindow(false);
m_opponentName = _T("");
m_bookinDate = COleDateTime::GetCurrentTime();
m_opponentLevel = _T("");
m_legalPerson = _T("");
m_area = _T("");
m_address = _T("");
m_postCode = _T("");
m_telephone = _T("");
m_fax = _T("");
m_webSite = _T("");
m_manageRange = _T("");
m_industryCharacter = _T("");
m_allFunds = 0.0f;
m_scale = _T("");
m_managePolicy = _T("");
m_goalMarket = _T("");
m_resourceCondition = _T("");
m_developTend = _T("");
m_assess = _T("");
}
void COpponentInfoForm::OnExit()
{
this->OnCancel();
}
BOOL COpponentInfoForm::OnInitDialog()
{
CDialog::OnInitDialog();
DWORD style;
style=m_list.GetExStyle();
style=(style|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT)&(~LVS_EX_CHECKBOXES) ;
m_list.SetExtendedStyle(style);
m_list.InsertColumn(0,"编码",LVCFMT_LEFT,100);
m_list.InsertColumn(1,"企业法人",LVCFMT_LEFT,100);
m_list.InsertColumn(2,"单位名称",LVCFMT_LEFT,100);
m_list.InsertColumn(3,"登记日期",LVCFMT_LEFT,100);
m_list.InsertColumn(4,"对手级别",LVCFMT_LEFT,100);
m_list.InsertColumn(5,"行业性质",LVCFMT_LEFT,100);
m_list.InsertColumn(6,"总资产",LVCFMT_LEFT,100);
m_list.InsertColumn(7,"规模",LVCFMT_LEFT,100);
m_list.InsertColumn(8,"网站",LVCFMT_LEFT,100);
m_list.InsertColumn(9,"传真",LVCFMT_LEFT,100);
m_list.InsertColumn(10,"电话",LVCFMT_LEFT,100);
m_list.InsertColumn(11,"邮编",LVCFMT_LEFT,100);
m_list.InsertColumn(12,"帐号",LVCFMT_LEFT,100);
m_list.InsertColumn(13,"地址",LVCFMT_LEFT,100);
m_list.InsertColumn(14,"经营范围",LVCFMT_LEFT,100);
m_list.InsertColumn(15,"经营策略",LVCFMT_LEFT,100);
m_list.InsertColumn(16,"目标市场",LVCFMT_LEFT,100);
m_list.InsertColumn(17,"资源情况",LVCFMT_LEFT,100);
m_list.InsertColumn(18,"发展趋势",LVCFMT_LEFT,100);
m_list.InsertColumn(19,"评价分析",LVCFMT_LEFT,100);
CString strSQL;
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
strSQL="select distinct areaName from area";
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
int i=0;
while(!(m_pRecordset->adoEOF))
{
m_areaCombo.InsertString(i,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("areaName")));
m_pRecordset->MoveNext();
i++;
}
m_pRecordset->Close();
strSQL="select * from opponent ";
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
i=0;
while(!(m_pRecordset->adoEOF))
{
CString str;
m_list.InsertItem(i, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentID")));
COleDateTime bookinDate= m_pRecordset->GetCollect("bookinDate");
str.Format("%d-%d-%d",bookinDate.GetYear(),bookinDate.GetMonth(),bookinDate.GetDay());
m_list.SetItemText(i,3, str);
m_list.SetItemText(i,4, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentLevel")));
m_list.SetItemText(i,2, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentName")));
m_list.SetItemText(i,1, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("legalPerson")));
m_list.SetItemText(i,5, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("industryCharacter")));
m_list.SetItemText(i,6, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address")));
float allFunds= m_pRecordset->GetCollect("allFunds");
str.Format("%f",allFunds);
m_list.SetItemText(i,7,str);
m_list.SetItemText(i,8, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("scale")));
m_list.SetItemText(i,9, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("webSite")));
m_list.SetItemText(i,10, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("fax")));
m_list.SetItemText(i,11, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("telephone")));
m_list.SetItemText(i,12, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("postCode")));
// m_list.SetItemText(i,13, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("account")));
m_list.SetItemText(i,13, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address")));
m_list.SetItemText(i,14, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageRange")));
m_list.SetItemText(i,15, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("managePolicy")));
m_list.SetItemText(i,16, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("goalMarket")));
m_list.SetItemText(i,17, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("resourceCondition")));
m_list.SetItemText(i,18, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("developeTend")));
m_list.SetItemText(i,19, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("assess")));
m_pRecordset->MoveNext();
i++;
}
tx_opponentID=GetDlgItem(IDC_opponentID);
tx_opponentName=GetDlgItem(IDC_opponentName);
tx_bookinDate=GetDlgItem(IDC_bookinDate);
tx_opponentLevel=GetDlgItem(IDC_opponentLevel);
tx_legalPerson=GetDlgItem(IDC_legalPerson);
tx_area=GetDlgItem(IDC_area);
tx_address=GetDlgItem(IDC_address);
tx_postCode=GetDlgItem(IDC_postcode);
tx_telephone=GetDlgItem(IDC_telephone);
tx_fax=GetDlgItem(IDC_fax);
tx_webSite=GetDlgItem(IDC_webSite);
tx_manageRange=GetDlgItem(IDC_manageRange);
tx_industryCharacter=GetDlgItem(IDC_industryCharacter);
tx_allFunds=GetDlgItem(IDC_allFunds);
tx_scale=GetDlgItem(IDC_scale);
tx_managePolicy=GetDlgItem(IDC_managePolicy);
tx_goalMarket=GetDlgItem(IDC_goalMarket);
tx_resourceCondition=GetDlgItem(IDC_resourceCondition);
tx_developTend=GetDlgItem(IDC_developTend);
tx_assess=GetDlgItem(IDC_assess);
bt_add=GetDlgItem(IDC_add);
bt_delete=GetDlgItem(IDC_delete);
bt_modify=GetDlgItem(IDC_modify);
bt_cancelation=GetDlgItem(IDC_cancelation);
bt_save=GetDlgItem(IDC_save);
tx_opponentID->EnableWindow(false);
tx_opponentName->EnableWindow(false);
tx_bookinDate->EnableWindow(false);
tx_opponentLevel->EnableWindow(false);
tx_legalPerson->EnableWindow(false);
tx_area->EnableWindow(false);
tx_address->EnableWindow(false);
tx_postCode->EnableWindow(false);
tx_telephone->EnableWindow(false);
tx_fax->EnableWindow(false);
tx_webSite->EnableWindow(false);
tx_manageRange->EnableWindow(false);
tx_industryCharacter->EnableWindow(false);
tx_allFunds->EnableWindow(false);
tx_scale->EnableWindow(false);
tx_managePolicy->EnableWindow(false);
tx_goalMarket->EnableWindow(false);
tx_resourceCondition->EnableWindow(false);
tx_developTend->EnableWindow(false);
tx_assess->EnableWindow(false);
if(is_search==0)
{
bt_add->EnableWindow(true);
bt_delete->EnableWindow(false);
bt_modify->EnableWindow(false);
bt_cancelation->EnableWindow(false);
bt_save->EnableWindow(false);
}
else if(is_search==1)
{
COpponentInfo opponentInfo;
opponentInfo.GetData(m_opponentID);
m_opponentName = opponentInfo.GetOpponentName();
m_bookinDate = opponentInfo.GetBookinDate();
m_opponentLevel = opponentInfo.GetOpponentLevel();
m_legalPerson = opponentInfo.GetLegalPerson();
m_area = opponentInfo.GetArea();
m_address = opponentInfo.GetAddress();
m_postCode = opponentInfo.GetPostCode();
m_telephone = opponentInfo.GetTelephone();
m_fax = opponentInfo.GetFax();
m_webSite = opponentInfo.GetWebSite();
m_manageRange = opponentInfo.GetManageRange();
m_industryCharacter = opponentInfo.GetIndustryCharacter();
m_allFunds = opponentInfo.GetAllFunds();
m_scale = opponentInfo.GetScale();
m_managePolicy = opponentInfo.GetManagePolicy();
m_goalMarket = opponentInfo.GetGoalMarket();
m_resourceCondition = opponentInfo.GetResourceCondition();
m_developTend = opponentInfo.GetDevelopTend();
m_assess = opponentInfo.GetAssess();
bt_add->EnableWindow(true);
bt_delete->EnableWindow(true);
bt_modify->EnableWindow(true);
bt_cancelation->EnableWindow(false);
bt_save->EnableWindow(false);
}
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COpponentInfoForm::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
UpdateData(true);
POSITION pos = m_list.GetFirstSelectedItemPosition();
if(pos)
{
int nFirstSelItem = m_list.GetNextSelectedItem(pos);
m_opponentID=m_list.GetItemText(nFirstSelItem,0);
}
COpponentInfo opponentInfo;
opponentInfo.GetData(m_opponentID);
m_opponentName = opponentInfo.GetOpponentName();
m_bookinDate = opponentInfo.GetBookinDate();
m_opponentLevel = opponentInfo.GetOpponentLevel();
m_legalPerson = opponentInfo.GetLegalPerson();
m_area = opponentInfo.GetArea();
m_address = opponentInfo.GetAddress();
m_postCode = opponentInfo.GetPostCode();
m_telephone = opponentInfo.GetTelephone();
m_fax = opponentInfo.GetFax();
m_webSite = opponentInfo.GetWebSite();
m_manageRange = opponentInfo.GetManageRange();
m_industryCharacter = opponentInfo.GetIndustryCharacter();
m_allFunds = opponentInfo.GetAllFunds();
m_scale = opponentInfo.GetScale();
m_managePolicy = opponentInfo.GetManagePolicy();
m_goalMarket = opponentInfo.GetGoalMarket();
m_resourceCondition = opponentInfo.GetResourceCondition();
m_developTend = opponentInfo.GetDevelopTend();
m_assess = opponentInfo.GetAssess();
tx_opponentID->EnableWindow(false);
tx_opponentName->EnableWindow(false);
tx_bookinDate->EnableWindow(false);
tx_opponentLevel->EnableWindow(false);
tx_legalPerson->EnableWindow(false);
tx_area->EnableWindow(false);
tx_address->EnableWindow(false);
tx_postCode->EnableWindow(false);
tx_telephone->EnableWindow(false);
tx_fax->EnableWindow(false);
tx_webSite->EnableWindow(false);
tx_manageRange->EnableWindow(false);
tx_industryCharacter->EnableWindow(false);
tx_allFunds->EnableWindow(false);
tx_scale->EnableWindow(false);
tx_managePolicy->EnableWindow(false);
tx_goalMarket->EnableWindow(false);
tx_resourceCondition->EnableWindow(false);
tx_developTend->EnableWindow(false);
tx_assess->EnableWindow(false);
bt_add->EnableWindow(true);
bt_delete->EnableWindow(true);
bt_modify->EnableWindow(true);
bt_cancelation->EnableWindow(false);
bt_save->EnableWindow(false);
UpdateData(false);
*pResult = 0;
}
void COpponentInfoForm::Refresh()
{
m_list.DeleteAllItems();
CString strSQL;
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
strSQL="select * from opponent ";
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_list.InsertItem(i, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentID")));
COleDateTime bookinDate= m_pRecordset->GetCollect("bookinDate");
str.Format("%d-%d-%d",bookinDate.GetYear(),bookinDate.GetMonth(),bookinDate.GetDay());
m_list.SetItemText(i,3, str);
m_list.SetItemText(i,4, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentLevel")));
m_list.SetItemText(i,2, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentName")));
m_list.SetItemText(i,1, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("legalPerson")));
m_list.SetItemText(i,5, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("industryCharacter")));
m_list.SetItemText(i,6, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address")));
float allFunds= m_pRecordset->GetCollect("allFunds");
str.Format("%f",allFunds);
m_list.SetItemText(i,7,str);
m_list.SetItemText(i,8, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("scale")));
m_list.SetItemText(i,9, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("webSite")));
m_list.SetItemText(i,10, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("fax")));
m_list.SetItemText(i,11, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("telephone")));
m_list.SetItemText(i,12, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("postCode")));
// m_list.SetItemText(i,13, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("account")));
m_list.SetItemText(i,13, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address")));
m_list.SetItemText(i,14, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageRange")));
m_list.SetItemText(i,15, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("managePolicy")));
m_list.SetItemText(i,16, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("goalMarket")));
m_list.SetItemText(i,17, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("resourceCondition")));
m_list.SetItemText(i,18, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("developeTend")));
m_list.SetItemText(i,19, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("assess")));
m_pRecordset->MoveNext();
i++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -