C++开发源码分析(9402)

?C++开发源码分析(9402)
C++ Source Part One
DataYG.cpp: implementation of the CDataYG class.
#include "stdafx.h"
#include "a1.h"
#include "DataYG.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
ConstructionDestruction
CDataYG::CDataYG()
{
m_pstrlistFields_Names=new CStringList[2];
m_sTableName="tabyginfo";
m_sKeyField="yg_id";
m_pstrlistFields_Names[0].AddTail("yg_id"); m_pstrlistFields_Names[1].AddTail("员工编号");
m_pstrlistFields_Names[0].AddTail("yg_name"); m_pstrlistFields_Names[1].AddTail("员工姓名");
m_pstrlistFields_Names[0].AddTail("sex"); m_pstrlistFields_Names[1].AddTail("员工性别");
m_pstrlistFields_Names[0].AddTail("sort"); m_pstrlistFields_Names[1].AddTail("员工类别");
m_pstrlistFields_Names[0].AddTail("position"); m_pstrlistFields_Names[1].AddTail("职务");
m_pstrlistFields_Names[0].AddTail("rq"); m_pstrlistFields_Names[1].AddTail("聘用日期");
m_pstrlistFields_Names[0].AddTail("salary"); m_pstrlistFields_Names[1].AddTail("薪金");
m_pstrlistFields_Names[0].AddTail("memo"); m_pstrlistFields_Names[1].AddTail("备注");
this->data.yg_id="";
this->data.yg_name="";
this->data.memo="";
this->data.position="";
this->data.rq="";
this->data.salary=0.0;
this->data.sex="";
this->data.sort="";
}
CDataYG::~CDataYG()
{
delete [] m_pstrlistFields_Names;
}
bool CDataYG::InsertCurValue()
{
if(this->IsCurValueIn())
{
AfxMessageBox("无法插入,有此字段");
return false;
}
CString sql;
sql.Format("insert into %s(yg_id,yg_name,sex,sort,position,rq,salary,memo) values('%s','%s','%s','%s','%s','%s',%f,'%s')"
,this->m_sTableName,data.yg_id,data.yg_name,data.sex,data.sort,data.position,data.rq,data.salary,data.memo);

return m_runsql.RunSQL(sql);
}
bool CDataYG::UpdateCurValue()
{
if(!this->IsCurValueIn())
{
AfxMessageBox("无法更新,没有此字段");
return false;
}
CString sql;
sql.Format("update %s set yg_name='%s',sex='%s',sort='%s',position='%s',rq='%s',salary=%f,memo='%s' where %s = '%s'"
,this->m_sTableName,data.yg_name,data.sex,data.sort,data.position,data.rq,data.salary,data.memo,this->m_sKeyField,this->data.yg_id);
return m_runsql.RunSQL(sql);
}
bool CDataYG::DeleteCurValue()
{
if(!IsCurValueIn())
{
AfxMessageBox("无法删除,没有此字段");
return false;
}
CString sql;
_variant_t value;
CString yg_name;
sql.Format("select from tabyginfo where yg_id = '%s'",data.yg_id);
if(!m_runsql.CheckSQLResult(sql))return false;
value=m_runsql.m_recordset->GetCollect("yg_name");
sql.Format("delete from %s where %s = '%s'",
this->m_sTableName,this->m_sKeyField,this->data.yg_id);
m_runsql.RunSQL(sql);
yg_name=(char)(_bstr_t)value;
sql.Format("update tabck set yg_id='' where yg_id='%s'",data.yg_id);
if(!m_runsql.RunSQL(sql))return false;
this->data=data_yg();
return true;
}
bool CDataYG::IsCurValueIn()
{
CString sql;

sql.Format("select from %s where %s = '%s'",this->m_sTableName,this->m_sKeyField,this->data.yg_id);
return this->m_runsql.CheckSQLResult(sql);
}

#if !defined(AFX_TRAINDLG_H__BA980502_96AE_4EB3_B5BD_CAD797CEDFBF__INCLUDED_)
#define AFX_TRAINDLG_H__BA980502_96AE_4EB3_B5BD_CAD797CEDFBF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
TrainDlg.h : header file
CTrainDlg dialog
class CTrainDlg : public CDialog
{
Construction
public:
CTrainDlg(CWnd pParent = NULL); standard constructor
CBrush m_brush_static;label
CBrush m_brush_dlg;dlg
Dialog Data
{{AFX_DATA(CTrainDlg)
enum { IDD = IDD_TRAIN_DLG };
CComboBox m_cbpxteacher;
CString m_strpxcl;
CString m_strpxpxlb;
CString m_strpxteacher;
CTime m_timepxdjrq;
CTime m_timepxend;
CTime m_timepxstart;
CString m_strpxcx;
CString m_strpxdjr;
CString m_strpxid;
CString m_strpxmark;
CString m_strpxpxqs;
CString m_strpxsc;
CString m_strpxzjh;
CString m_strpxname;
}}AFX_DATA
Overrides
ClassWizard generated virtual function overrides
{{AFX_VIRTUAL(CTrainDlg)
protected:
virtual void DoDataExchange(CDataExchange pDX); DDXDDV support
}}AFX_VIRTUAL
Implementation
protected:
Generated message map functions
{{AFX_MSG(CTrainDlg)
afx_msg void OnButtonPxSave();
virtual BOOL OnInitDialog();
afx_msg void OnButtonPxLookfor();
afx_msg HBRUSH OnCtlColor(CDC pDC, CWnd pWnd, UINT nCtlColor);
}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_TRAINDLG_H__BA980502_96AE_4EB3_B5BD_CAD797CEDFBF__INCLUDED_)

C++ Source Part Three
DataYP.cpp: implementation of the CDataYP class.
#include "stdafx.h"
#include "a1.h"
#include "DataYP.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
ConstructionDestruction
CDataYP::CDataYP()
{
m_pstrlistFields_Names=new CStringList[2];
m_sTableName="tabypinfo";
m_sKeyField="yp_id";
m_pstrlistFields_Names[0].AddTail("yp_id"); m_pstrlistFields_Names[1].AddTail("药品编号");
m_pstrlistFields_Names[0].AddTail("yp_name"); m_pstrlistFields_Names[1].AddTail("药品名称");
m_pstrlistFields_Names[0].AddTail("yp_jc"); m_pstrlistFields_Names[1].AddTail("药品简称");
m_pstrlistFields_Names[0].AddTail("jixing"); m_pstrlistFields_Names[1].AddTail("剂型");
m_pstrlistFields_Names[0].AddTail("huowei"); m_pstrlistFields_Names[1].AddTail("货位");
m_pstrlistFields_Names[0].AddTail("chandi"); m_pstrlistFields_Names[1].AddTail("产地");
m_pstrlistFields_Names[0].AddTail("guige"); m_pstrlistFields_Names[1].AddTail("规格");
m_pstrlistFields_Names[0].AddTail("danwei"); m_pstrlistFields_Names[1].AddTail("单位");
m_pstrlistFields_Names[0].AddTail("shangbiao"); m_pstrlistFields_Names[1].AddTail("商标");
m_pstrlistFields_Names[0].AddTail("pizhunwenhao"); m_pstrlistFields_Names[1].A

ddTail("批准文号");
m_pstrlistFields_Names[0].AddTail("jinjia"); m_pstrlistFields_Names[1].AddTail("进价");
m_pstrlistFields_Names[0].AddTail("pifajia"); m_pstrlistFields_Names[1].AddTail("批发价");
m_pstrlistFields_Names[0].AddTail("lingshoujia"); m_pstrlistFields_Names[1].AddTail("零售价");
m_pstrlistFields_Names[0].AddTail("pihao"); m_pstrlistFields_Names[1].AddTail("批号");
m_pstrlistFields_Names[0].AddTail("baozhiqi"); m_pstrlistFields_Names[1].AddTail("保质期");
m_pstrlistFields_Names[0].AddTail("huoyuan"); m_pstrlistFields_Names[1].AddTail("货源");
m_pstrlistFields_Names[0].AddTail("beizhu"); m_pstrlistFields_Names[1].AddTail("备注");
this->data.yp_id="";
this->data.yp_name="";
this->data.yp_jc="";
this->data.jixing="";
this->data.huowei="";
this->data.chandi="";
this->data.guige="";
this->data.danwei="";
this->data.shangbiao="";
this->data.pizhunwenhao="";
this->data.jinjia=0.0;
this->data.pifajia=0.0;
this->data.lingshoujia=0.0;
this->data.pihao="";
this->data.baozhiqi="";
this->data.huoyuan="";
this->data.beizhu="";
}
CDataYP::~CDataYP()
{
delete [] m_pstrlistFields_Names;
}
bool CDataYP::IsCurValueIn()
{
CString sql;
sql.Format("select from %s where %s = '%s'",this->m_sTableName,this->m_sKeyField,this->data.yp_id);
return this->m_runsql.CheckSQLResult(sql);
}
bool CDataYP::InsertCurValue()
{
if(this->IsCurValueIn())
{
AfxMessageBox("无法插入,有此字段");
return false;
}
CString sql;data.yp_id.MakeUpper();
m_runsql.m_recordset->Close();
if(!LRunSql::BeginTrans())return false;
sql.Format("insert into %s(yp_id,yp_name,yp_jc,jixing,huowei,chandi,guige,danwei,\
shangbiao,pizhunwenhao,jinjia,pifajia,lingshoujia,pihao,baozhiqi,huoyuan,beizhu) \
values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',%f,%f,%f,'%s','%s','%s','%s')",
this->m_sTableName,
this->data.yp_id,this->data.yp_name,this->data.yp_jc,this->data.jixing,this->data.huowei,
this->data.chandi,this->data.guige,this->data.danwei,this->data.shangbiao,this->data.pizhunwenhao,
this->data.jinjia,this->data.pifajia,this->data.lingshoujia,this->data.pihao,this->data.baozhiqi,
this->data.huoyuan,this->data.beizhu);
if(!m_runsql.RunSQL(sql))
{
LRunSql::RollbackTrans();
return false;
}
_variant_t value;CStringList slist;
slist.RemoveAll();
sql.Format("select from tabck");
m_runsql.CheckSQLResult(sql);
while(!m_runsql.m_recordset->adoEOF)
{
value=m_runsql.m_recordset->GetCollect("ck_name");
slist.AddTail((char)(_bstr_t)value);
m_runsql.m_recordset->MoveNext();
}
POSITION pos=NULL;
for(pos=slist.GetHeadPosition();pos!=NULL;)
{
sql.Format("insert into tabkc(yp_id,ck_name,kc_number,alert_leverup,alert_leverdown) \
values('%s','%s',0,100000,10)",data.yp_id,slist.GetNext(pos));
m_runsql.RunSQL(sql);
}
if(!LRunSql::CommitTrans())return false;
return true;
}
bool CDataYP::DeleteCurValue()
{
if(!IsCurValueIn())
{
AfxMe

ssageBox("无法删除,没有此字段");
return false;
}
CString sql;
m_runsql.m_recordset->Close();
if(!LRunSql::BeginTrans())return false;
sql.Format("delete from %s where %s = '%s'",
this->m_sTableName,
this->m_sKeyField,
this->data.yp_id);
this->m_runsql.RunSQL(sql);
sql.Format("delete from tabkc where yp_id = '%s'",data.yp_id);
this->m_runsql.RunSQL(sql);
if(!LRunSql::CommitTrans())return false;
return true;
}
bool CDataYP::UpdateCurValue()
{
if(!this->IsCurValueIn())
{
AfxMessageBox("无法更新,没有此字段");
return false;
}
CString sql;
sql.Format("update %s set yp_name='%s',yp_jc='%s',jixing='%s',huowei='%s',chandi='%s',guige='%s',danwei='%s',shangbiao='%s',pizhunwenhao='%s',jinjia=%f,pifajia=%f,lingshoujia=%f,pihao='%s',baozhiqi='%s',huoyuan='%s',beizhu='%s' where %s ='%s'",
m_sTableName,
this->data.yp_name,
this->data.yp_jc,
this->data.jixing,
this->data.huowei,
this->data.chandi,
this->data.guige,
this->data.danwei,
this->data.shangbiao,
this->data.pizhunwenhao,
this->data.jinjia,
this->data.pifajia,
this->data.lingshoujia,
this->data.pihao,
this->data.baozhiqi,
this->data.huoyuan,
this->data.beizhu,

this->m_sKeyField,
this->data.yp_id);
return m_runsql.RunSQL(sql);
}

DOutPutTotalReport.h: interface for the CDOutPutTotalReport class.
#if !defined(AFX_DOUTPUTTOTALREPORT_H__4F88C3B8_3571_49B0_9FA5_4757D3950386__INCLUDED_)
#define AFX_DOUTPUTTOTALREPORT_H__4F88C3B8_3571_49B0_9FA5_4757D3950386__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
#include "DReport.h"
class CDOutPutTotalReport : public CDReport
{
public:
void OnButquery();
void Init();
CDOutPutTotalReport();
virtual ~CDOutPutTotalReport();
};
#endif !defined(AFX_DOUTPUTTOTALREPORT_H__4F88C3B8_3571_49B0_9FA5_4757D3950386__INCLUDED_)

C++ Source Part Two
#if !defined(AFX_LISTCTRLPOP_H__8A5B0B9F_FF30_44B5_BB1C_7861176893D2__INCLUDED_)
#define AFX_LISTCTRLPOP_H__8A5B0B9F_FF30_44B5_BB1C_7861176893D2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
ListCtrlPop.h : header file
CListCtrlPop dialog
#define IDD_DIALOG_LISTCTRL_POP 155
class CListCtrlPop : public CDialog
{
Construction
public:
virtual ~CListCtrlPop();
bool ShowAllStringList();
bool RefreshListCtrlView(int conditionsubitem, CString scondition,int inothis,CString snothis,int subitem, CString edited);
bool RefreshListCtrlView(int conditionsubitem ,CString scondition,int subitem, CString edited);
bool RefreshListCtrlView(int subitem,CString edited,CString sCankao,int cankao_subitem);
bool RefreshListCtrlView(int subitem,CString edited);
int GetSelectedMark();
CWnd GetCurEditWnd();
void SendTheUDNPMessage(UINT KEY);
void ShowListPop();
void SetStrWindowText();
void ClearListAllColumn();
CListCtrlPop(CWnd pParent = NULL); standard constructor
virtual bool Create(CWnd parent);
CStringList SelectStringLi

st(int number,CStringList newstringlist);
bool InitListCtrl();
void ClearListCtrlItems();
CString GetListCtrlSel(int subitem);
void SetShowPosition(const CRect& rect,CWnd wndedited);
enum{ID_POP_LISTCTRL=301};
Dialog Data
{{AFX_DATA(CListCtrlPop)
enum { IDD = IDD_DIALOG_LISTCTRL_POP };
NOTE: the ClassWizard will add data members here
}}AFX_DATA
Overrides
ClassWizard generated virtual function overrides
{{AFX_VIRTUAL(CListCtrlPop)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange pDX); DDXDDV support
}}AFX_VIRTUAL
Implementation
protected:
用来记录数据
CStringList m_strlist;
int m_iColumns;
CListCtrl m_listctrl;
int m_iCurSel;
the wnd who is edited;
CWnd m_wndStrEdited;
int m_iSubItem;
show position
CRect m_rectShow;
CPoint m_ptPosition;
protected:
Generated message map functions
{{AFX_MSG(CListCtrlPop)
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnDblclkList1(NMHDR pNMHDR, LRESULT pResult);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
afx_msg void OnSetfocusList1(NMHDR pNMHDR, LRESULT pResult);
}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
afx_msg void OnMyItemchangedList();
afx_msg void OnItemDBlclkList();
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_LISTCTRLPOP_H__8A5B0B9F_FF30_44B5_BB1C_7861176893D2__INCLUDED_)

C++ Source Part Three
#if !defined(AFX_VCLABELS_H__BC287B91_5455_419E_A016_2D120540CB9D__INCLUDED_)
#define AFX_VCLABELS_H__BC287B91_5455_419E_A016_2D120540CB9D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
NOTE: Do not modify the contents of this file. If this class is regenerated by
Microsoft Visual C++, your modifications will be overwritten.
Dispatch interfaces referenced by this interface
class CVcLabel;
CVcLabels wrapper class
class CVcLabels : public COleDispatchDriver
{
public:
CVcLabels() {} Calls COleDispatchDriver default constructor
CVcLabels(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CVcLabels(const CVcLabels& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
Attributes
public:
Operations
public:
long GetCount();
CVcLabel GetItem(short LabelIndex);
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_VCLABELS_H__BC287B91_5455_419E_A016_2D120540CB9D__INCLUDED_)

C++ Source Part Four
DCheck.h: interface for the CDCheck class.
#if !defined(AFX_DCHECK_H__4D237061_2F6B_4826_A67B_81DAA5B16EFC__INCLUDED_)
#define AFX_DCHECK_H__4D237061_2F6B_4826_A67B_81DAA5B16EFC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
#include "DOperation.h"
class CDCheck : public CDOperation
{
public:

void OnRclickGrid(NMHDR pNMHDR, LRESULT pResult);
void OnButSave();
void OnSetfocusEdtman();
void OnButEnrol();
void Init();
CDCheck();
virtual ~CDCheck();
};
#endif !defined(AFX_DCHECK_H__4D237061_2F6B_4826_A67B_81DAA5B16EFC__INCLUDED_)

C++ Source Part Five
#if !defined(AFX_WHITERECT_H__5E85971F_2FE9_4B0F_9E41_2D6D6E4E8077__INCLUDED_)
#define AFX_WHITERECT_H__5E85971F_2FE9_4B0F_9E41_2D6D6E4E8077__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
WhiteRect.h : header file
CWhiteRect window
class CWhiteRect : public CStatic
{
Construction
public:
CWhiteRect();
Attributes
public:
Operations
public:
Overrides
ClassWizard generated virtual function overrides
{{AFX_VIRTUAL(CWhiteRect)
}}AFX_VIRTUAL
Implementation
public:
virtual ~CWhiteRect();
Generated message map functions
protected:
{{AFX_MSG(CWhiteRect)
afx_msg void OnPaint();
}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_WHITERECT_H__5E85971F_2FE9_4B0F_9E41_2D6D6E4E8077__INCLUDED_)


相关主题
相关文档
最新文档