📄 opponentproductform.cpp
字号:
// OpponentProductForm.cpp : implementation file
//
#include "stdafx.h"
#include "ClientRelationship.h"
#include "OpponentProductForm.h"
#include "OpponentProduct.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COpponentProductForm dialog
COpponentProductForm::COpponentProductForm(CWnd* pParent /*=NULL*/)
: CDialog(COpponentProductForm::IDD, pParent)
{
//{{AFX_DATA_INIT(COpponentProductForm)
m_issueDate = COleDateTime::GetCurrentTime();
m_productID = _T("");
m_productName = _T("");
m_productShortenedName = _T("");
m_standard = _T("");
m_price = 0;
m_model = _T("");
m_marketQuota = _T("");
m_marketFlection = _T("");
m_marketProspect = _T("");
m_function = _T("");
//}}AFX_DATA_INIT
}
void COpponentProductForm::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COpponentProductForm)
DDX_Control(pDX, IDC_LIST2, m_productList);
DDX_Control(pDX, IDC_LIST1, m_opponentList);
DDX_DateTimeCtrl(pDX, IDC_issueDate, m_issueDate);
DDX_Text(pDX, IDC_productID, m_productID);
DDX_Text(pDX, IDC_productName, m_productName);
DDX_Text(pDX, IDC_productShortenedName, m_productShortenedName);
DDX_Text(pDX, IDC_standard, m_standard);
DDX_Text(pDX, IDC_price, m_price);
DDX_Text(pDX, IDC_model, m_model);
DDX_Text(pDX, IDC_marketQuote, m_marketQuota);
DDX_Text(pDX, IDC_marketFlection, m_marketFlection);
DDX_Text(pDX, IDC_marketProspect, m_marketProspect);
DDX_Text(pDX, IDC_function, m_function);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COpponentProductForm, CDialog)
//{{AFX_MSG_MAP(COpponentProductForm)
ON_BN_CLICKED(IDC_add, OnAdd)
ON_BN_CLICKED(IDC_delete, OnDelete)
ON_BN_CLICKED(IDC_modify, OnModify)
ON_BN_CLICKED(IDC_save, OnSave)
ON_BN_CLICKED(IDC_cancelation, OnCancelation)
ON_BN_CLICKED(IDC_exit, OneExit)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COpponentProductForm message handlers
BOOL COpponentProductForm::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_pOpponentRecordset;
strSQL="select * from opponent";
HRESULT hTRes;
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_productList.GetExStyle();
style=(style|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT)&(~LVS_EX_CHECKBOXES) ;
m_productList.SetExtendedStyle(style);
m_productList.InsertColumn(0,"产品编码",LVCFMT_LEFT,100);
m_productList.InsertColumn(1,"产品名称",LVCFMT_LEFT,100);
m_productList.InsertColumn(2,"产品简称",LVCFMT_LEFT,100);
m_productList.InsertColumn(3,"规格",LVCFMT_LEFT,100);
m_productList.InsertColumn(4,"型号",LVCFMT_LEFT,100);
m_productList.InsertColumn(5,"发布日期",LVCFMT_LEFT,100);
m_productList.InsertColumn(6,"产品价格",LVCFMT_LEFT,100);
m_productList.InsertColumn(7,"市场份额",LVCFMT_LEFT,100);
m_productList.InsertColumn(8,"市场反应",LVCFMT_LEFT,100);
m_productList.InsertColumn(9,"市场前景",LVCFMT_LEFT,100);
m_productList.InsertColumn(10,"功能介绍",LVCFMT_LEFT,100);
tx_issueDate=GetDlgItem(IDC_issueDate);
tx_productID=GetDlgItem(IDC_productID);
tx_productName=GetDlgItem(IDC_productName);
tx_productShortenedName=GetDlgItem(IDC_productShortenedName);
tx_standard=GetDlgItem(IDC_standard);
tx_price=GetDlgItem(IDC_price);
tx_model=GetDlgItem(IDC_model);
tx_marketQuota=GetDlgItem(IDC_marketQuote);
tx_marketFlection=GetDlgItem(IDC_marketFlection);
tx_marketProspect=GetDlgItem(IDC_marketProspect);
tx_function=GetDlgItem(IDC_function);
bt_add=GetDlgItem(IDC_add);
bt_modify=GetDlgItem(IDC_modify);
bt_delete=GetDlgItem(IDC_delete);
bt_save=GetDlgItem(IDC_save);
bt_cancelation=GetDlgItem(IDC_cancelation);
tx_issueDate->EnableWindow(false);
tx_productID->EnableWindow(false);
tx_productName->EnableWindow(false);
tx_productShortenedName->EnableWindow(false);
tx_standard->EnableWindow(false);
tx_price->EnableWindow(false);
tx_model->EnableWindow(false);
tx_marketQuota->EnableWindow(false);
tx_marketFlection->EnableWindow(false);
tx_marketProspect->EnableWindow(false);
tx_function->EnableWindow(false);
bt_add->EnableWindow(true);
bt_modify->EnableWindow(false);
bt_delete->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 COpponentProductForm::OnAdd()
{
tx_issueDate->EnableWindow(true);
tx_productID->EnableWindow(false);
tx_productName->EnableWindow(true);
tx_productShortenedName->EnableWindow(true);
tx_standard->EnableWindow(true);
tx_price->EnableWindow(true);
tx_model->EnableWindow(true);
tx_marketQuota->EnableWindow(true);
tx_marketFlection->EnableWindow(true);
tx_marketProspect->EnableWindow(true);
tx_function->EnableWindow(true);
bt_add->EnableWindow(false);
bt_modify->EnableWindow(false);
bt_delete->EnableWindow(false);
bt_save->EnableWindow(true);
bt_cancelation->EnableWindow(true);
CString m_formID;
int formID=((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->GetCollect("opponentProductID").intVal;
if(formID<10)
m_formID.Format("JZDSCP0000%d",formID);
else if(formID<100&&formID>9)
m_formID.Format("JZDSCP000%d",formID);
else if(formID<1000&&formID>99)
m_formID.Format("JZDSCP00%d",formID);
CString str;
str.Format("%d",formID+1);
((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->PutCollect("opponentProductID",_variant_t(str));
((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->Update();
m_productID=m_formID;
m_issueDate = COleDateTime::GetCurrentTime();
m_productName = _T("");
m_productShortenedName = _T("");
m_standard = _T("");
m_price = 0;
m_model = _T("");
m_marketQuota = _T("");
m_marketFlection = _T("");
m_marketProspect = _T("");
m_function = _T("");
flag=1;
UpdateData(false);
}
void COpponentProductForm::OnDelete()
{
COpponentProduct opponentProduct;
opponentProduct.sqlDelete(m_opponentID,m_productID);
Refresh();
tx_issueDate->EnableWindow(false);
tx_productID->EnableWindow(false);
tx_productName->EnableWindow(false);
tx_productShortenedName->EnableWindow(false);
tx_standard->EnableWindow(false);
tx_price->EnableWindow(false);
tx_model->EnableWindow(false);
tx_marketQuota->EnableWindow(false);
tx_marketFlection->EnableWindow(false);
tx_marketProspect->EnableWindow(false);
tx_function->EnableWindow(false);
bt_add->EnableWindow(true);
bt_modify->EnableWindow(false);
bt_delete->EnableWindow(false);
bt_save->EnableWindow(false);
bt_cancelation->EnableWindow(false);
m_issueDate = COleDateTime::GetCurrentTime();
m_productID = _T("");
m_productName = _T("");
m_productShortenedName = _T("");
m_standard = _T("");
m_price = 0;
m_model = _T("");
m_marketQuota = _T("");
m_marketFlection = _T("");
m_marketProspect = _T("");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -