⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basicinfodlg.cpp

📁 VC++和ACCESS使用ADO连接
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		else
		{
			CString strYear = strIDCard.Mid(6, 4);		// 身份证号中的年份
			int nYear = atoi(strYear);
			CString strMonth = strIDCard.Mid(10, 2);	// 月份
			int nMonth = atoi(strMonth);
			CString strDay = strIDCard.Mid(12, 2);		// 日期
			int nDay = atoi(strDay);
			
			BOOL bleap;
			if (nMonth < 1 || nMonth > 12)
			{
				MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
				return FALSE;
			}
			switch (nMonth)
			{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:	// 大月
				{
					if (nDay < 0 || nDay > 31)
					{
						MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
						return FALSE;
					}
				}
				break;
			case 4:
			case 6:
			case 9:
			case 11:	// 小月
				{
					if (nDay < 0 || nDay > 30)
					{
						MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
						return FALSE;
					}
				}
				break;
			case 2:		// 判断闰月
				{
					if (nYear % 4 == 0)
					{
						if (nYear % 100 != 0)
						{
							bleap = TRUE;
						}
						else if (nYear % 400 == 0)
						{
							bleap = TRUE;
						}
						else
						{
							bleap = FALSE;
						}
					}
					else
					{
						bleap = FALSE;
					}
					
					if (bleap)
					{
						if (nDay < 0 || nDay > 29)
						{
							MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
							return FALSE;
						}
					}
					else
					{
						if (nDay < 0 || nDay > 28)
						{
							MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
							return FALSE;
						}
					}
				}
				break;
			}
			
			SYSTEMTIME STime = {0};
			STime.wYear = nYear;
			STime.wMonth = nMonth;
			STime.wDay = nDay;
			m_B_strBirthday.Format("%d-%d-%d", nYear, nMonth, nDay);
			((CDateTimeCtrl*)GetDlgItem(IDC_DTP_EMPLOYEE_BIRTHDAY))->SetTime(&STime);

			m_B_strAge.Format("%d", (nST_Year - nYear));
			SetDlgItemText(IDC_EDIT_EMPLOYEE_AGE, m_B_strAge);
			return TRUE;
		}
	}
	else if (strIDCard.GetLength() == 15)		// 15位老身份证
	{
		int num = 0;
		char ch;
		for (int i = 0; i < 14; i++)
		{
			ch = strIDCard.GetAt(i);	// 获取输入的第一位数
			if (ch > 47 && ch < 58)		// 如果是数字
			{
				num++;
			}
		}
		if (i == 14)
		{
			ch = strIDCard.GetAt(i);	// 获取第 15 位
			if ((ch > 47 && ch < 58) || (ch == 88 || ch == 120))	// 如果是数字或者是X
			{
				num++;
			}
		}
		
		if (num != 15)
		{
			MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
			return FALSE;
		}
		else
		{
			CString strYear = strIDCard.Mid(6, 2);		// 老身份证号中的年份
			int nYear = atoi(strYear) + 1900;
			CString strMonth = strIDCard.Mid(8, 2);	// 月份
			int nMonth = atoi(strMonth);
			CString strDay = strIDCard.Mid(10, 2);		// 日期
			int nDay = atoi(strDay);
			
			BOOL bleap;
			if (nMonth < 1 || nMonth > 12)
			{
				MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
				return FALSE;
			}
			switch (nMonth)
			{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:	// 大月
				{
					if (nDay < 0 || nDay > 31)
					{
						MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
						return FALSE;
					}
				}
				break;
			case 4:
			case 6:
			case 9:
			case 11:	// 小月
				{
					if (nDay < 0 || nDay > 30)
					{
						MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
						return FALSE;
					}
				}
				break;
			case 2:		// 判断闰月
				{
					if (nYear % 4 == 0)
					{
						if (nYear % 100 != 0)
						{
							bleap = TRUE;
						}
						else if (nYear % 400 == 0)
						{
							bleap = TRUE;
						}
						else
						{
							bleap = FALSE;
						}
					}
					else
					{
						bleap = FALSE;
					}
					
					if (bleap)
					{
						if (nDay < 0 || nDay > 29)
						{
							MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
							return FALSE;
						}
					}
					else
					{
						if (nDay < 0 || nDay > 28)
						{
							MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
							return FALSE;
						}
					}
				}
				break;
			}
			
			SYSTEMTIME STime = {0};
			STime.wYear = nYear;
			STime.wMonth = nMonth;
			STime.wDay = nDay;
			m_B_strBirthday.Format("%d-%d-%d", nYear, nMonth, nDay);
			((CDateTimeCtrl*)GetDlgItem(IDC_DTP_EMPLOYEE_BIRTHDAY))->SetTime(&STime);

			m_B_strAge.Format("%d", (nST_Year - nYear));
			SetDlgItemText(IDC_EDIT_EMPLOYEE_AGE, m_B_strAge);
			return TRUE;
		}
	}
	else
	{
		MessageBox("输入的【身份证号码】无效", "无效", MB_OK | MB_ICONERROR);
		return FALSE;
	}
}

/*********************************************************************
函数说明:	   所有填写内容的 合法性 检查
函数参数:	   
*********************************************************************/
BOOL BasicInfoDlg::CheckAllInfo_Basic()
{
	CFuncOper     FunOper;

	//==================================  基本信息  ==================================
	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_NAME, "【姓名】", m_B_strName, FALSE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_IDCARD, "【身份证】", m_B_strIDCard, FALSE))
	{
		return FALSE;
	}
	
	if (!FunOper.CheckType_CComBox(this, IDC_COMBO_EMPLOYEE_SEX, "【性别】", m_B_strSex))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_AGE, "【年龄】", m_B_strAge, FALSE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CTimePicker(this, IDC_DTP_EMPLOYEE_BIRTHDAY, m_B_strBirthday))
	{
		return FALSE;
	}
	
	if (!FunOper.CheckType_CComBox(this, IDC_COMBO_EMPLOYEE_POLITYVISAGE, "【政治面貌】", m_B_strPolity))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_RACE, "【民族】", m_B_strRace, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CComBox(this, IDC_COMBO_EMPLOYEE_MARRIAGE, "【婚姻】", m_B_strMarriage))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_NATIVEPLACE, "【籍贯】", m_B_strNative, TRUE))
	{
		return FALSE;
	}

	// 参加工作时间
	if (!FunOper.CheckType_CTimePicker(this, IDC_DTP_EMPLOYEE_FIRSTJOBTIME, m_B_strFirstJT))
	{
		return FALSE;
	}

	// 入职时间
	if (!FunOper.CheckType_CTimePicker(this, IDC_DTP_EMPLOYEE_JOINTIME, m_B_strJT))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_JOBPOSITION, "【现任职位类别】", m_B_strJobPos, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CComBox(this, IDC_COMBO_EMPLOYEE_TECHPOST, "【职称等级】", m_B_strTechPost))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_TECHSPECIAL, "【技术专长】", m_B_strTechSpe, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_TELEPHONE, "【电话】", m_B_strTel, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_MOBILEPHONE, "【手机】", m_B_strMobile, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_EMAIL,  "【E-Mail", m_B_stremail, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_POSTALCODE, "【邮政编码】", m_B_strPostalcode, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_ADDRESS, "【现家庭住址】", m_B_strAdd, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_URGENCYLINKMAN, "【紧急联系人】", m_B_strUrgLM, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_URGENCYMANTEL, "【紧急联系人电话】", m_B_strUrgLMTel, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CComBox(this, IDC_COMBO_EMPLOYEE_HUKOUPROPERTY, "【户口属性】", m_B_strHUKOUPro))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_DOCUMENTPLACE, "【档案所在地】", m_B_strDocPlace, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_HUKOUPLACE, "【户口所在地】", m_B_strHUKOUPlace, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_GRADUATESCHOOL, "【毕业学校】", m_B_strGraSchool, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_LANGUAGELEVEL, "【外语水平】", m_B_strLanLevel, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_COMPUTERLEVEL, "【计算机等级】", m_B_strComLevel, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CComBox(this, IDC_COMBO_EMPLOYEE_HIGHESTDIPLOMA, "【最高学历】", m_B_strHighestDip))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_TECHANG, "【特长】", m_B_strTECHANG, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_REMARK, "【备注】", m_B_strRemark, TRUE))
	{
		return FALSE;
	}

	if (!FunOper.CheckType_CEdit(this, IDC_EDIT_EMPLOYEE_ACCREDITATION, "【资格认证】", m_B_strAccreditation, TRUE))
	{
		return FALSE;
	}
	
	return TRUE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -