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

📄 usermanger.cpp

📁 波峰焊后台控制软件-中文版
💻 CPP
📖 第 1 页 / 共 2 页
字号:
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if((m_UserListid>=0)&&(m_UserListid<OPERATORMAX)
		&&(theApp.m_UserPower.Operators[m_UserListid].OperatorName[0]!=0))
	{       

		m_on_enable       =theApp.m_UserPower.Operators[m_UserListid].on_enable;		//开机
		m_off_enable      =theApp.m_UserPower.Operators[m_UserListid].off_enable;		//关机
		m_rh1_on_enable   =theApp.m_UserPower.Operators[m_UserListid].rh1_on_enable;	//预热一开
		m_rh1_off_enable  =theApp.m_UserPower.Operators[m_UserListid].rh1_off_enable;	//预热一关
		m_rh2_on_enable   =theApp.m_UserPower.Operators[m_UserListid].rh2_on_enable;	//预热二开
		m_rh2_off_enable  =theApp.m_UserPower.Operators[m_UserListid].rh2_off_enable;	//预热二关
		m_rh3_on_enable   =theApp.m_UserPower.Operators[m_UserListid].rh3_on_enable;	//预热三开
		m_rh3_off_enable  =theApp.m_UserPower.Operators[m_UserListid].rh3_off_enable;	//预热三关
		m_sl_on_enable    =theApp.m_UserPower.Operators[m_UserListid].sl_on_enable;	    //锡炉开
		m_sl_off_enable   =theApp.m_UserPower.Operators[m_UserListid].sl_off_enable;	//锡炉关
		m_trans_on_enable =theApp.m_UserPower.Operators[m_UserListid].trans_on_enable;	//传输开
		m_trans_off_enable=theApp.m_UserPower.Operators[m_UserListid].trans_off_enable;	//传输关
		m_pw_on_enable    =theApp.m_UserPower.Operators[m_UserListid].pw_on_enable;		//喷雾开
		m_pw_off_enable   =theApp.m_UserPower.Operators[m_UserListid].pw_off_enable;	//喷雾关
		m_lpw_on_enable   =theApp.m_UserPower.Operators[m_UserListid].lpw_on_enable;	//连喷开
		m_lpw_off_enable  =theApp.m_UserPower.Operators[m_UserListid].lpw_off_enable;	//连喷关
		m_para_enable     =theApp.m_UserPower.Operators[m_UserListid].para_enable;		//修改参数窗
		m_set_enable      =theApp.m_UserPower.Operators[m_UserListid].set_enable;		//修改设置窗
		m_info_enable     =theApp.m_UserPower.Operators[m_UserListid].info_enable;	    //修改信息窗
		m_warn_enable     =theApp.m_UserPower.Operators[m_UserListid].warn_enable;	    //修改报警窗
		m_oven_enable     =theApp.m_UserPower.Operators[m_UserListid].oven_enable;	    //修改熔锡温度
		m_plc_enable      =theApp.m_UserPower.Operators[m_UserListid].plc_enable;	    //PLC设置
		m_exit_enable      =theApp.m_UserPower.Operators[m_UserListid].exit_enable;	    //

		m_ws1_on_enable  =theApp.m_UserPower.Operators[m_UserListid].ws1_on_enable;
		m_ws1_off_enable =theApp.m_UserPower.Operators[m_UserListid].ws1_off_enable;
		m_ws2_on_enable  =theApp.m_UserPower.Operators[m_UserListid].ws2_on_enable;
		m_ws2_off_enable =theApp.m_UserPower.Operators[m_UserListid].ws2_off_enable;



		m_SelectUserName     = (CString)theApp.m_UserPower.Operators[m_UserListid].OperatorName;
		m_SelectUserPassword = (CString)theApp.m_UserPower.Operators[m_UserListid].Password;
		m_NewPassword        = m_SelectUserPassword;
		m_AgainPassword      = m_SelectUserPassword;
		m_CurOperatorName    = (CString)theApp.m_UserPower.CurOperatorName;
	
	}else if ((m_UserListid>=0)&&(m_UserListid<OPERATORMAX)
				&&(theApp.m_UserPower.Operators[m_UserListid].OperatorName[0]==0))
	{//新增用户
		m_on_enable       =FALSE;	//开机
		m_off_enable      =FALSE;	//关机
		m_rh1_on_enable   =FALSE;   //预热一开
		m_rh1_off_enable  =FALSE;   //预热一关
		m_rh2_on_enable   =FALSE;   //预热二开
		m_rh2_off_enable  =FALSE;   //预热二关
		m_rh3_on_enable   =FALSE;   //预热三开
		m_rh3_off_enable  =FALSE;   //预热三关
		m_sl_on_enable    =FALSE;	//锡炉开
		m_sl_off_enable   =FALSE;   //锡炉关
		m_trans_on_enable =FALSE;   //传输开
		m_trans_off_enable=FALSE;	//传输关
		m_pw_on_enable    =FALSE;	//喷雾开
		m_pw_off_enable   =FALSE;	//喷雾关
		m_lpw_on_enable   =FALSE;	//连喷开
		m_lpw_off_enable  =FALSE;	//连喷关
		m_para_enable     =FALSE;	//修改参数窗
		m_set_enable      =FALSE;   //修改设置窗
		m_info_enable     =FALSE;	//修改信息窗
		m_warn_enable     =FALSE;	//修改报警窗
		m_oven_enable     =FALSE;	//修改熔锡温度
		m_plc_enable      =FALSE;   //PLC设置
		m_exit_enable     =FALSE;   //

		m_ws1_on_enable  =FALSE;   //
		m_ws1_off_enable =FALSE;   //
		m_ws2_on_enable  =FALSE;   //
		m_ws2_off_enable =FALSE;   //

		m_SelectUserName = _T("");
		m_SelectUserPassword = _T("");
		m_NewPassword = _T("");
		m_AgainPassword = _T("");
	}

	if (theApp.m_UserPower.CurOperatorid!=0)
	{
		if((theApp.m_UserPower.CurOperatorid==m_UserListid)
			&&(theApp.m_UserPower.KeepTime>0))
		{
/*			(CWnd* )GetDlgItem(IDOK)->EnableWindow(TRUE);
			(CWnd* )GetDlgItem(IDC_EDIT1)->EnableWindow(TRUE);
			(CWnd* )GetDlgItem(IDC_EDIT2)->EnableWindow(TRUE);
			(CWnd* )GetDlgItem(IDC_EDIT3)->EnableWindow(TRUE);
			(CWnd* )GetDlgItem(IDC_EDIT4)->EnableWindow(TRUE);
*/
			(CWnd* )GetDlgItem(IDOK)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT3)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT4)->EnableWindow(FALSE);
		}else 
		{
			(CWnd* )GetDlgItem(IDOK)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT3)->EnableWindow(FALSE);
			(CWnd* )GetDlgItem(IDC_EDIT4)->EnableWindow(FALSE);
		}

	}
	UpdateData(FALSE);	
}

void CUserManger::OnOK() 
{// 保存
	// TODO: Add extra validation here	
	int i,j;

	UpdateData(TRUE);
	CString ptemp;
	ptemp=theApp.m_UserPower.Operators[m_UserListid].Password;

	if(((theApp.m_UserPower.CurOperatorid==0)
			&&(theApp.m_UserPower.KeepTime>0)
			&&(m_UserListid>=0)&&(m_UserListid<OPERATORMAX))
			||((theApp.m_UserPower.CurOperatorid>0)
			&&(theApp.m_UserPower.KeepTime>0)
			&&(m_UserListid=theApp.m_UserPower.CurOperatorid)
			&&(ptemp==m_SelectUserPassword)&&(m_NewPassword==m_AgainPassword)))
		{
			UpdateData(TRUE);

			theApp.m_UserPower.Operators[m_UserListid].on_enable		=m_on_enable;        //开机
			theApp.m_UserPower.Operators[m_UserListid].off_enable		=m_off_enable;       //关机
			theApp.m_UserPower.Operators[m_UserListid].rh1_on_enable	=m_rh1_on_enable;    //预热一开
			theApp.m_UserPower.Operators[m_UserListid].rh1_off_enable	=m_rh1_off_enable;   //预热一关
			theApp.m_UserPower.Operators[m_UserListid].rh2_on_enable	=m_rh2_on_enable;    //预热二开
			theApp.m_UserPower.Operators[m_UserListid].rh2_off_enable	=m_rh2_off_enable;   //预热二关
			theApp.m_UserPower.Operators[m_UserListid].rh3_on_enable	=m_rh3_on_enable;    //预热三开
			theApp.m_UserPower.Operators[m_UserListid].rh3_off_enable	=m_rh3_off_enable;   //预热三关
			theApp.m_UserPower.Operators[m_UserListid].sl_on_enable  	=m_sl_on_enable;     //锡炉开
			theApp.m_UserPower.Operators[m_UserListid].sl_off_enable	=m_sl_off_enable;    //锡炉关
			theApp.m_UserPower.Operators[m_UserListid].trans_on_enable	=m_trans_on_enable;  //传输开
			theApp.m_UserPower.Operators[m_UserListid].trans_off_enable =m_trans_off_enable; //传输关
			theApp.m_UserPower.Operators[m_UserListid].pw_on_enable 	=m_pw_on_enable;     //喷雾开
			theApp.m_UserPower.Operators[m_UserListid].pw_off_enable	=m_pw_off_enable;    //喷雾关
			theApp.m_UserPower.Operators[m_UserListid].lpw_on_enable	=m_lpw_on_enable;    //连喷开
			theApp.m_UserPower.Operators[m_UserListid].lpw_off_enable	=m_lpw_off_enable;   //连喷关
			theApp.m_UserPower.Operators[m_UserListid].para_enable		=m_para_enable;      //修改参数窗
			theApp.m_UserPower.Operators[m_UserListid].set_enable		=m_set_enable;       //修改设置窗
			theApp.m_UserPower.Operators[m_UserListid].info_enable	    =m_info_enable;      //修改信息窗
			theApp.m_UserPower.Operators[m_UserListid].warn_enable	    =m_warn_enable;      //修改报警窗
			theApp.m_UserPower.Operators[m_UserListid].oven_enable	    =m_oven_enable;      //修改熔锡温度
			theApp.m_UserPower.Operators[m_UserListid].plc_enable	    =m_plc_enable;       //PLC设置
			theApp.m_UserPower.Operators[m_UserListid].exit_enable	    =m_exit_enable;      //

			theApp.m_UserPower.Operators[m_UserListid].ws1_on_enable	= m_ws1_on_enable;
			theApp.m_UserPower.Operators[m_UserListid].ws1_off_enable	= m_ws1_off_enable;
			theApp.m_UserPower.Operators[m_UserListid].ws2_on_enable	= m_ws2_on_enable;
			theApp.m_UserPower.Operators[m_UserListid].ws2_off_enable	= m_ws2_off_enable;


			if(m_UserListid!=0)
			{
				j=m_SelectUserName.GetLength();
				if(j>20) j=20;
				for(i=0;i<j;i++)
				{
					theApp.m_UserPower.Operators[m_UserListid].OperatorName[i]=m_SelectUserName[i];
				}
				theApp.m_UserPower.Operators[m_UserListid].OperatorName[i]=0;
			}
			j=m_NewPassword.GetLength();
			if(j>20) j=20;
			for(i=0;i<j;i++)
			{
				theApp.m_UserPower.Operators[m_UserListid].Password[i]=m_NewPassword[i];
			}
			theApp.m_UserPower.Operators[m_UserListid].Password[i]=0;
			m_SelectUserPassword = m_NewPassword;

	        theApp.SaveUserPower();
		}

		m_KeepTime = (int)theApp.m_UserPower.KeepTime;
		UpdateData(FALSE);

		CDialog::OnOK();
}

⌨️ 快捷键说明

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