YGJCTJDLG.CPP
资源名称:gongzi.rar [点击查看]
上传用户:ghostdhl
上传日期:2018-06-14
资源大小:9728k
文件大小:3k
源码类别:
数据库编程
开发平台:
Visual C++
- // Ygjctjdlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "GZGLXT.h"
- #include "Ygjctjdlg.h"
- #include "Ygjcxxb.h"
- #include "Ygfdgzxmb.h"
- #include "Ygjbgzb.h"
- #include "Gzffmxb.h"
- #include "Ygjbsjb.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CYgjctjdlg dialog
- CYgjctjdlg::CYgjctjdlg(CWnd* pParent /*=NULL*/)
- : CDialog(CYgjctjdlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CYgjctjdlg)
- m_id = _T("");
- m_name = _T("");
- //}}AFX_DATA_INIT
- m_hIcon = AfxGetApp()->LoadIcon(IDI_YGTJICON);
- }
- void CYgjctjdlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CYgjctjdlg)
- DDX_Control(pDX, IDC_COMBO2, m_whcd);
- DDX_Control(pDX, IDC_COMBO1, m_sex);
- DDX_Text(pDX, IDC_EDIT1, m_id);
- DDX_Text(pDX, IDC_EDIT2, m_name);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CYgjctjdlg, CDialog)
- //{{AFX_MSG_MAP(CYgjctjdlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CYgjctjdlg message handlers
- BOOL CYgjctjdlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- SetIcon(m_hIcon, TRUE);
- m_sex.AddString("男");
- m_sex.AddString("女");
- m_whcd.InsertString(0,"专科");
- m_whcd.InsertString(1,"本科");
- m_whcd.InsertString(2,"研究生");
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CYgjctjdlg::OnOK()
- {
- // TODO: Add extra validation here
- CYgjcxxb xxb;
- UpdateData(true);
- if(m_id=="")
- {
- MessageBox("编号不能为空","工资管理系统");
- return;
- }
- if(m_name=="")
- {
- MessageBox("姓名不能为空","工资管理系统");
- return;
- }
- if(xxb.HaveId(m_id)==1)
- {
- MessageBox("员工编号已存在","工资管理系统");
- return;
- }
- xxb.SetYGid(m_id);
- xxb.SetYGxm(m_name);
- CString sex,whcd;
- m_sex.GetWindowText(sex);
- if(sex=="")
- {
- MessageBox("性别不能为空","工资管理系统");
- return;
- }
- //从组合框中读取文本
- m_sex.GetLBText(m_sex.GetCurSel(),strsex);
- xxb.SetSex(strsex);
- m_whcd.GetWindowText(whcd);
- if(whcd=="")
- {
- MessageBox("文化程度不能为空","工资管理系统");
- return;
- }
- m_whcd.GetLBText(m_whcd.GetCurSel(),strwhcd);
- xxb.SetWHcd(strwhcd);
- xxb.sql_insert();
- //向浮动工资表添加编号、姓名
- CYgfdgzxmb xmb;
- xmb.SetYGid(m_id);
- xmb.SetYGxm(m_name);
- xmb.sql_insert();
- //向基本工资表添加编号、姓名
- CYgjbgzb gzb;
- gzb.SetYGid(m_id);
- gzb.SetYGxm(m_name);
- gzb.sql_insert();
- //向加班休假表添加编号、姓名
- CYgjbsjb sjb;
- sjb.SetYGid(m_id);
- sjb.SetYGxm(m_name);
- sjb.sql_insert();
- CDialog::OnOK();
- }
- BOOL CYgjctjdlg::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
- pMsg->wParam=9;
- return CDialog::PreTranslateMessage(pMsg);
- }