示例#1
0
bool CSubFormCollection::ShowSubForm(int ix)
{
    ASSERT(ix <= m_Forms.GetUpperBound());
    if (ix > m_Forms.GetUpperBound()) return(false); // does not exist

    CDialog* pDlg;
    if (ix != -1) {
        if (m_nActiveForm != -1) {
            pDlg = m_Forms.GetAt(m_nActiveForm);
            ASSERT(pDlg != NULL);
            ASSERT(pDlg->m_hWnd != NULL);
            if ((pDlg == NULL) 
            ||  (pDlg->m_hWnd == NULL)) return(false);
            pDlg->ShowWindow(SW_HIDE);
        }
        m_nActiveForm = ix; // this is the active one now;
    }
    else {
        if (m_nActiveForm == -1) {
            m_nActiveForm = 0;
        }
    }
    pDlg = m_Forms.GetAt(m_nActiveForm);
    ASSERT(pDlg != NULL);
    ASSERT(pDlg->m_hWnd != NULL);
    if ((pDlg == NULL) 
    ||  (pDlg->m_hWnd == NULL)) return(false);
    pDlg->ShowWindow(SW_SHOW);
    pDlg->Invalidate();
    pDlg->RedrawWindow();
    return(true);
}
// 初始化所有工作流
void CKSConfig::InitWorkflows(void)
{
	m_workflows.Clear();
	CKsnlApp * app = (CKsnlApp*)AfxGetApp();
	CDialog * dlg = (CDialog *)AfxGetMainWnd();
	string fileName = string(app->m_appPath) + CKSConfig::ms_configFile;
	CCIniFile inifile(fileName);
	//dlg->ShowTipMessage("dd");
	srand((unsigned int)time(NULL));
	dlg->Invalidate(FALSE);
	//////////////////////////////////////////////////////////////////////////
	// 用func名字来判断读取的工作流是否应该添加进去
	vector<string> sections;
	inifile.ReadSections(sections);
	vector<string>::iterator iter;
	//////////////////////////////////////////////////////////////////////////
	for (iter = sections.begin(); iter != sections.end(); ++iter)
	{
		string sect = *iter;
		if (sect.substr(0, 4) == "FUNC")
		{
			string 	v = inifile.ReadString(sect.c_str(),"func","");
			if (!v.empty())
			{
				if (app->m_param.number == 1)
				{
					if (v == "subsidy")
					{
//						m_workflows.AddWorkflow(new CKSSubsidyWorkFlow(dlg));	               // 补助领取  
					}
					else if (v == "qrysubsidy") 
					{
//						m_workflows.AddWorkflow(new CKSQuerySubsidyWorkflow(dlg));			   // 查询补贴
					}
					else if (v == "qrywatervol")
					{
						m_workflows.AddWorkflow(new CKSQueryWaterVolumnWorkFlow(dlg));	
					}
					else if (v == "waterpacketrf")
					{
						m_workflows.AddWorkflow(new CKSWaterPacketTransferWorkFlow(dlg));
					}
					else if (v == "ModifyCardInfo")
					{
	//					m_workflows.AddWorkflow(new CKModifyCardInfoWorkflow(dlg));			   // 更新卡信息
					}
					else if (v == "QueryMendCard")											   
					{
	//					m_workflows.AddWorkflow(new CKQueryMendCardWorkflow(dlg));			   // 查询补写卡信息
					}
					else if (v == "MendCard")
					{
	//					m_workflows.AddWorkflow(new CKMendCardWorkflow(dlg));				   // 补写卡信息
					}
					else if (v == "MobileTransfer")
					{
						m_workflows.AddWorkflow(new CKSMobileTransWorkFlow(dlg));	
					}
					else 
					{
						//
					}
				}
				else if (app->m_param.number == 2)
				{
					if (v == "QueryNetCharge")
					{
	//					m_workflows.AddWorkflow(new CKQueryNetChargeWorkFlow(dlg));	
					}
					else if (v == "NetCharge")
					{
	//					m_workflows.AddWorkflow(new CKNetChargeTransferWorkFlow(dlg));
					}
					else
					{
						//
					}
					/*
					else if (v == "qryTrfAct")
					{
//						m_workflows.AddWorkflow(new CKSQueryTransferAccoutsWorkFlow(dlg));	   // 查询转帐明细	
					}
					else if (v == "waterpacketrf")
					{
//						m_workflows.AddWorkflow(new CKSWaterPacketTransferWorkFlow(dlg));	   // 水控钱包转帐
					}
					else if (v == "InitCard")
					{
//						m_workflows.AddWorkflow(new CKSInitCardWorkFlow(dlg));				   // 做定点卡
					}
					else if (v == "cancel")
					{
//						m_workflows.AddWorkflow(new CKSCancelTermCardWorkFlow(dlg));		   // 取消定点卡	
					}
					else 
					{
						//
					}
					*/
				}
				else if (app->m_param.number == 3)
				{
					if (v == "ElePackTrf")
					{
//						m_workflows.AddWorkflow(new CKSElePacketTransferWorkFLow(dlg));		   // 电控转帐		
					}
					else if (v == "ElePackAccTrf") 
					{
//						m_workflows.AddWorkflow(new CKSQueryEleTransferAccoutsWorkFlow(dlg));  // 查询电控转帐				
					}
					else
					{
						//
					}
				}
				else if (app->m_param.number == 4)
				{
					if (v == "NetCharge")
					{
//						m_workflows.AddWorkflow(new CKNetChargeTransferWorkFlow(dlg));		   // 网络收费	
					}
					else
					{
						//
					}
				}
				else
				{
					//
				}
			}
		}
	}
	m_workflows.AddWorkflow(new CKSExitWorkFlow(dlg));						   // 退出
}