コード例 #1
0
void CMyDatabase::GetInsertGuid(_NetcashDevice &McrStation, CDatabase &m_Database,int dbms)
{
	
	CRecordset       m_RS( &m_Database );
	CString Data;

	try
	{

		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT NEWID()",CRecordset::executeDirect);
	
		if ( !m_RS.IsEOF() )
			  m_RS.GetFieldValue( short(0), Data); lstrcpyn(McrStation.InsertGUID,Data,51);
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();
	}
	catch( CDBException *e)
	{

		CString Message;
		Message.Format("CMyDatabase::GetAccount(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
	
}
コード例 #2
0
void CMyDatabase::GetDeviceID( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms)
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;



	try
	{
	
		m_Query.Format("SELECT DEVICEID,USECOLOR FROM SMARTPRINT_DEVICEMAP WHERE STATIONID = '%d'", McrStation.StationID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		
		if ( !m_RS.IsEOF() )
		{
				CString Data;
				m_RS.GetFieldValue( short(0), Data);	McrStation.DeviceID     = atol(Data);
				m_RS.GetFieldValue( short(1), Data);	McrStation.UseColor     = atoi(Data);
		}

		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::GetDeviceID(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

}
コード例 #3
0
int CMyDatabase::VerifyMatter( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms)
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;
	CString          m_Count("0");

	if ( strlen(McrStation.CopyMatter) == 0 )
         return 1;

	try
	{
	
	
		// table change to use the cc/cm view ver 6.6
     	m_Query.Format("SELECT COUNT(*) FROM DOCUGATE_CM_VIEW WHERE CC_CODE = '%s' AND CM_MATTER = '%s'", McrStation.CopyClient,McrStation.CopyMatter);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
	    m_RS.GetFieldValue( short(0),m_Count); 

		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::VerifyMatter(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

	return atoi(m_Count);

}
コード例 #4
0
int CMyDatabase::GetUnitOrCurrency( CDatabase &m_Database)
{



	try
	{

		CRecordset       m_RS( &m_Database );

		m_RS.Open( CRecordset::forwardOnly,_T( "SELECT GLOBALS_UNITVALUE,GLOBALS_UNITVALUE_ENABLED FROM DOCUGATE_GENERAL_GLOBAL" ) );
		if( !m_RS.IsEOF() )
		{
		  	m_RS.GetFieldValue    ( short(0), m_UnitValue); 
			m_RS.GetFieldValue    ( short(1), m_UnitValueEnabled); 
		}
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{

		CString Message;
		Message.Format("CMyDatabase::GetUnitOrCurrency(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

	return 0;
}
コード例 #5
0
int CMyDatabase::CheckHandle( CDatabase &m_Database, int dbms)
{

	int result = 1;
	CString          m_Query;

	try
	{
	
		CRecordset       m_RS( &m_Database );
		m_Query.Format("SELECT GETDATE();");
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		result = 0;
		char Message[255] = {0};
		sprintf(Message,"CMyDatabase::CheckHandle(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
	
	return result;

}
コード例 #6
0
void CMyDatabase::GetOfflineAccountID( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms)
{


	CRecordset       m_RS( &m_Database );
	CString          m_Query;



	try
	{

		m_Query.Format("SELECT ACCOUNTID FROM ACCOUNTS WHERE COPYID = '%s'", McrStation.CopyAccount);
			
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		
		if ( !m_RS.IsEOF() )
		{
				CString Data;
				m_RS.GetFieldValue( short(0), Data);	McrStation.AccountID = atol(Data);
		}

		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::GetOffLineAccountID(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

}
コード例 #7
0
int CMyDatabase::CtlUnitACL( _NetcashDevice &pBuf,CDatabase &m_Database)
{
    
	CRecordset       m_RS( &m_Database );
    CString          m_Query;
    CString          m_Data;
    int res          = 0;
	
	try
	{
		m_Query.Format("SELECT CTLUNIT_OU_GUID FROM DOCUGATE_GENERAL_CTLUNIT WHERE CTLUNIT_GUID = '%s'",pBuf.UnitGUID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
        m_RS.GetFieldValue( short(0),m_Data);
        
        if ( m_RS.IsOpen() )
            m_RS.Close();
        
        if ( strcmp( m_Data,"") == 0 )
            res = 0;
        else
            res = 1;
		
        
	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::CtlUnitACL(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
    
    return res;
    
}
コード例 #8
0
int CMyDatabase::CtlUnitACL( _NetcashDevice &pBuf,CDatabase &m_Database)
{
    
	CRecordset       m_RS( &m_Database );
    CString          m_Query;
    CString          m_Data;
    CString          n_Data;
    CString          o_Data;
    int res          = 0; //Initially defined as false
    
	
	try
	{
		m_Query.Format("SELECT CTLUNIT_OU_GUID FROM DOCUGATE_GENERAL_CTLUNIT WHERE CTLUNIT_GUID = '%s'",pBuf.UnitGUID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
        m_RS.GetFieldValue( short(0),m_Data);
        
        if ( m_RS.IsOpen() )
            m_RS.Close();
        
        if ( strcmp( m_Data,"" ) == 0 )
            res = 1;
        else
        {
            m_Query.Format("SELECT ACC_OU_GUID FROM DOCUGATE_GENERAL_ACC where ACC_ACC_GUID = '%s'",pBuf.AccountGUID);
            m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
            m_RS.GetFieldValue( short(0),n_Data);
            
            if ( m_RS.IsOpen() )
                m_RS.Close();
            
            m_Query.Format("SELECT OU_NAME FROM DOCUGATE_GENERAL_OU WHERE OU_GUID = '%s'",n_Data);
            m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
            m_RS.GetFieldValue( short(0),o_Data);
            
            if ( m_RS.IsOpen() )
                m_RS.Close();
            
            if ( strcmp(n_Data,m_Data) == 0 || strcmp(o_Data,"STAFF") == 0)
                res = 1;
            
        }
            
		
        
	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::CtlUnitACL(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
    
    return res;
    
}
コード例 #9
0
void CMyDatabase::Handle_PingedConnection( _NetcashDevice &pBuf,CDatabase &m_Database,int dbms)
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;
	CString          m_Data;

	try
	{

		m_Query.Format("SELECT count(*) as MyCOUNTER FROM SMARTPRINT_STATIONS where SC_DEVICEID = '%s'",pBuf.Location);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		m_RS.GetFieldValue( short(0),m_Data);

		if ( m_RS.IsOpen() )
			 m_RS.Close();

		if ( atoi(m_Data) == 0 ) // need to insert
		{
			m_Query.Format("INSERT INTO SMARTPRINT_STATIONS (SC_DEVICEID,SC_DEVICEIP,SC_DEVICEGW,SC_DEVICEMASK,SC_STATUS) VALUES ('%s','%s','%s','%s','Connection Alive')",pBuf.Location,pBuf.Address,pBuf.Gateway,pBuf.Mask);
			m_Database.ExecuteSQL (m_Query);

		}
		else				  // need to upddate	
		{
			m_Query.Format("UPDATE SMARTPRINT_STATIONS SET SC_DEVICEIP = '%s',SC_DEVICEGW= '%s',SC_DEVICEMASK= '%s',SC_STATUS = 'Connection Alive' WHERE SC_DEVICEID = '%s'",pBuf.Address,pBuf.Gateway,pBuf.Mask,pBuf.Location);
			m_Database.ExecuteSQL (m_Query);
		}

		m_Query.Format("UPDATE SMARTPRINT_STATIONS SET SC_LATEST = NOW() WHERE SC_DEVICEID = '%s'",pBuf.Location);
		m_Query.Replace("NOW()","GETDATE()");
 		m_Database.ExecuteSQL (m_Query);

	
	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::Handle_PingedConnection(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

}
コード例 #10
0
void CMyDatabase::GetAccountID( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms )
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;



	try
	{

		if ( McrStation.RequirePin)
		    m_Query.Format("SELECT ACC_ACC_GUID FROM DOCUGATE_GENERAL_ACC WHERE ACC_COPYID = '%s' AND ACC_COPYPIN = '%s'", McrStation.CopyAccount,McrStation.CopyPassword);
		else
			m_Query.Format("SELECT ACC_ACC_GUID FROM DOCUGATE_GENERAL_ACC WHERE ACC_COPYID = '%s'", McrStation.CopyAccount);

		m_Query.Format("SELECT ACC_OU_GUID FROM DOCUGATE_GENERAL_ACC WHERE ACC_ACC_GUID = '%s'", McrStation.AccountGUID); //Added by Mike 12/14/11
	
		
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		
		if ( !m_RS.IsEOF() )
		{
				CString Data;
				m_RS.GetFieldValue( short(0), Data);
				sprintf(McrStation.AccountGUID,"%s",Data);
		}

		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::GetAccountID(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}


}
コード例 #11
0
int CMyDatabase::AccountACL(LPSTR pstrAccountGUID,CDatabase &m_Database)
{
    
    
	CRecordset       m_RS( &m_Database );
	CString          m_Query;
	CString          m_Data;
    int res          = 0;
    
	try
	{
        
		m_Query.Format("SELECT ACC_OU_GUID FROM DOCUGATE_GENERAL_ACC where ACC_ACC_GUID = '%s'",pstrAccountGUID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		m_RS.GetFieldValue( short(0),m_Data);
        
		if ( m_RS.IsOpen() )
            m_RS.Close();
        
		if ( atoi(m_Data) == 0 ) // need to insert
            if ( strcmp( m_Data,"E240B567-957A-4550-AED2-F6779CF34C43") == 0 )
                res = 0;
            else
                res = 1;
		else				  // need to upddate	
			res = 1;
        
	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::AccountACL(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
	
	
	return res;
	
    
}
コード例 #12
0
void CMyDatabase::GetOUMaxSpend(_NetcashDevice &McrStation, CDatabase &m_Database,int dbms  )
{

	
	CRecordset       m_RS( &m_Database );
	CString          m_Query;

	try
	{

		m_Query.Format("SELECT ENABLED,AMOUNT FROM DOCUGATE_GENERAL_OU_MAXSPEND WHERE OU_GUID = '%s'", McrStation.Group);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);

		if ( !m_RS.IsEOF() )
		{
			CString Data;

	
			m_RS.GetFieldValue( short(0), Data);
			McrStation.OumaxspendEnabled =atoi(Data);
		
			m_RS.GetFieldValue( short(1), Data);
			float t =atof(Data);
			McrStation.Oumaxspend  = (ULONG)t * 100;
		}
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();
	
	}
	catch( CDBException *e)
	{

		CString Message;
		Message.Format("CMyDatabase::GetAccount(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
	
}
コード例 #13
0
void CMyDatabase::Handle_NewConnection( _NetcashDevice &pBuf,CDatabase &m_Database ,int dbms)
{
	
	CString          m_Query;
	CRecordset       m_RS( &m_Database );
	CString          m_Data;

	try
	{
		m_Query.Format("UPDATE DOCUGATE_GENERAL_CTLUNIT SET CTLUNIT_STATUS = 'CONNECTED' WHERE CTLUNIT_SERIAL_NO = '%s'",pBuf.Location);
		m_Database.ExecuteSQL (m_Query);

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::Handle_NewConnection(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

}
コード例 #14
0
int CMyDatabase::IsActiveSession(LPSTR pstrAccountGUID,CDatabase &m_Database)
{


	CRecordset       m_RS( &m_Database );
	CString          m_Query;
	CString          m_Data;
    int res          = 0;

	try
	{

		m_Query.Format("SELECT count(*) as SessionCount FROM DOCUGATE_GENERAL_ACTIVE_SESSION where ACC_GUID = '%s'",pstrAccountGUID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		m_RS.GetFieldValue( short(0),m_Data);

		if ( m_RS.IsOpen() )
			 m_RS.Close();

		if ( atoi(m_Data) == 0 ) // need to insert
			res = 0;
		else				  // need to upddate	
			res = 1;

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::IsActiveSession(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
	
	
	return res;
	

}
コード例 #15
0
int CMyDatabase::VerifyClient( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms)
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;
	CString          m_Count("0");

	if ( strlen(McrStation.CopyClient) == 0 )
         return 1;

	try
	{
	
		// table change to use the cc/cm view ver 6.6
		//	m_Query.Format("SELECT COUNT(*) FROM DOCUGATE_CM_VIEW WHERE CC_CODE = '%s'", McrStation.CopyClient);

		// ver 7.2 table change to use the docugate_general_cc table for client only validation
		// otherwise the cm view does not show clients with no matters
     	m_Query.Format("SELECT COUNT(*) FROM DOCUGATE_GENERAL_CC WHERE CC_CODE = '%s'", McrStation.CopyClient);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
	    m_RS.GetFieldValue( short(0),m_Count); 

		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::VerifyClient(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

	return atoi(m_Count);

}
コード例 #16
0
void CMyDatabase::GetGroup( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms )
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;

	try
	{
	
		m_Query.Format("SELECT OU_DEFAULT_CLIENT,OU_DEFAULT_MATTER,OU_LOCKED,OU_CHARGE,OU_ALLOWNEG,OU_NAME FROM DOCUGATE_GENERAL_OU WHERE OU_GUID = '%s'", McrStation.Group);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);

		if ( !m_RS.IsEOF() )
		{
				CString Data;
				m_RS.GetFieldValue( short(0), Data); lstrcpyn(McrStation.GroupClient,Data,50);
				m_RS.GetFieldValue( short(1), Data); lstrcpyn(McrStation.GroupMatter,Data,50);
				m_RS.GetFieldValue( short(2), Data); McrStation.GroupLocked = atoi(Data);     
				m_RS.GetFieldValue( short(3), Data); lstrcpyn(McrStation.GroupCharge,Data,50);
				m_RS.GetFieldValue( short(4), Data); McrStation.AllowNeg = atoi(Data);     
				m_RS.GetFieldValue( short(5), Data); lstrcpyn(McrStation.GroupName,Data,50);
		}
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();
	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::GetGroup(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

	
}
コード例 #17
0
void CMyDatabase::GetCopier( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms)
{

	CRecordset       m_RS( &m_Database );
	CString          m_Query;


	try
	{
	
		m_Query.Format("SELECT  DEVICENAME,LOCATION,LOCKED,CURRENTCOUNT FROM DEVICES WHERE DEVICEID = %d", McrStation.DeviceID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		
		if ( !m_RS.IsEOF() )
		{
				CString Data;
				m_RS.GetFieldValue( short(0),Data);    lstrcpyn(McrStation.DeviceName,  Data,50);
				m_RS.GetFieldValue( short(1),Data);    lstrcpyn(McrStation.DeviceLocation,Data,50);
				m_RS.GetFieldValue( short(2),Data);    McrStation.DeviceLocked = atoi(Data); 
				m_RS.GetFieldValue( short(3),Data);    McrStation.InitCount = atol(Data); 
		}

		if ( m_RS.IsOpen() )
			 m_RS.Close();

	}
	catch( CDBException *e)
	{
		CString Message;
		Message.Format("CMyDatabase::GetCopier(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}


}
コード例 #18
0
void CMyDatabase::GetAccount(_NetcashDevice &McrStation, CDatabase &m_Database,int dbms  )
{
	
	CRecordset       m_RS( &m_Database );
	CString          m_Query;

	try
	{

		m_Query.Format("SELECT ACC_DEFAULT_CLIENT,ACC_DEFAULT_MATTER,ACC_LOCKED,ACC_FUNDS,ACC_OU_GUID,ACC_CMETHOD FROM DOCUGATE_GENERAL_ACC WHERE ACC_ACC_GUID = '%s'", McrStation.AccountGUID);
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);

		if ( !m_RS.IsEOF() )
		{
			CString Data;
			m_RS.GetFieldValue( short(0), Data); lstrcpyn(McrStation.AccountClient,Data,50);
			m_RS.GetFieldValue( short(1), Data); lstrcpyn(McrStation.AccountMatter,Data,50);
			m_RS.GetFieldValue( short(2), Data); McrStation.AccountLocked  = atoi(Data);
			m_RS.GetFieldValue( short(3), Data); McrStation.InitBalance = (float)atof(Data);
			m_RS.GetFieldValue( short(4), Data); lstrcpyn(McrStation.Group,Data,50);
			m_RS.GetFieldValue( short(5), Data); lstrcpyn(McrStation.AccountCharge,Data,50);
		}
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();
	}
	catch( CDBException *e)
	{

		CString Message;
		Message.Format("CMyDatabase::GetAccount(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}
	
}
コード例 #19
0
int CMyDatabase::ReadStationsFromTable( CDatabase &m_Database)
{


	CRecordset       m_RS( &m_Database );
	short nFields     = 0;
	int StationCount  = 0;
	CString mSQL;

	
	try
	{

		if ( m_LocationFilter.IsEmpty() )
			mSQL.Format( "SELECT * FROM DOCUGATE_GENERAL_CTLUNIT" );
		else
			mSQL.Format( "SELECT * FROM DOCUGATE_GENERAL_CTLUNIT WHERE CTLUNIT_LOCATION = '%s'",m_LocationFilter );
	
		m_RS.Open( CRecordset::forwardOnly, mSQL); //_T( "SELECT * FROM DOCUGATE_GENERAL_CTLUNIT" ) );
		nFields = m_RS.GetODBCFieldCount( );

		while( !m_RS.IsEOF() )
		{

			   CString		  varData;
			   CODBCFieldInfo varInfo;

			   for( short index = 0; index < nFields; index++ )
			   {
						m_RS.GetFieldValue    ( short(index), varData );
						m_RS.GetODBCFieldInfo ( short(index), varInfo );

						if( varInfo.m_strName.CompareNoCase("CTLUNIT_GUID") == 0 )
					         strncpy(Stations[StationCount].UnitGUID,varData,51);
						
						// Added by Mike on 12/14/11
						if( varInfo.m_strName.CompareNoCase("CTLUNIT_OU_GUID") == 0 )
					         strncpy(Stations[StationCount].UnitOUGUID,varData,51);

						if( varInfo.m_strName.CompareNoCase("CTLUNIT_IP") == 0 )
					         strncpy(Stations[StationCount].UnitAddress,varData,50);
	
						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_PORT_NO") == 0 )
					         strncpy(Stations[StationCount].UnitPort,varData,10);
					
						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_REQ_CLIENT") == 0 )
					         strncpy(Stations[StationCount].ReqCopyClient,varData,5);
	
						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_REQ_MATTER") == 0 )
					         strncpy(Stations[StationCount].ReqCopyMatter,varData,5);
					
						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_CONN_RESET") == 0 )
					         strncpy(Stations[StationCount].IdleReset,varData,10);

						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_COPYPIN_ENABLED") == 0 )
					         strncpy(Stations[StationCount].ReqPin,varData,5);

						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_KEYBRD_MODE") == 0 )
					         strncpy(Stations[StationCount].Keyboard,varData,10);

						else if( varInfo.m_strName.CompareNoCase("CTLUNIT_PULSE_IDLE_MIN") == 0 )
					         strncpy(Stations[StationCount].PulseIdle,varData,10);
			   }

			Stations[StationCount].UnitActive = 1;
			Stations[StationCount].UnitConnected = 0;
	
			StationCount++;
		    m_RS.MoveNext( );
		}
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();
	}
	catch( CDBException *e)
	{

		CString Message;
		Message.Format("CMyDatabase::GetAccount(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

	return StationCount;
}
コード例 #20
0
void CMyDatabase::GetStationCustomPL(_TagStation &Station, CDatabase &m_Database, int dbms)
{

	CRecordset       m_RS( &m_Database );
	short nFields     = 0;
	CString mSQL;
	CString Message;

	try
	{

		mSQL.Format( "SELECT * FROM DOCUGATE_GENERAL_CTLUNIT_CUSTOM_PL WHERE CTLUNIT_GUID = '%s'",Station.UnitGUID );
		Message.Format("CMyDatabase::GetStationCustomPL(%s)",mSQL);
		WriteLog(Message,"");
	
		m_RS.Open( CRecordset::forwardOnly, mSQL);
		if( !m_RS.IsEOF() )
		{
	
			
			   CString		  varData;
			   CODBCFieldInfo varInfo;
			   nFields = m_RS.GetODBCFieldCount( );
			   for( short index = 0; index < nFields; index++ )
			   {
						m_RS.GetFieldValue    ( short(index), varData );
						m_RS.GetODBCFieldInfo ( short(index), varInfo );
					
						if( varInfo.m_strName.CompareNoCase("ENABLED") == 0 )
					         Station.plCustomCostEnabled = atoi(varData);
						else if( varInfo.m_strName.CompareNoCase("PL1") == 0 )
					         Station.pl1CustomCost=(float)atof(varData);
						else if( varInfo.m_strName.CompareNoCase("PL2") == 0 )
					         Station.pl2CustomCost=(float)atof(varData);
						else if( varInfo.m_strName.CompareNoCase("PL3") == 0 )
					         Station.pl3CustomCost=(float)atof(varData);
						else if( varInfo.m_strName.CompareNoCase("PL4") == 0 )
					         Station.pl4CustomCost=(float)atof(varData);
			   }

			  Message.Format("CMyDatabase::GetStationCustomPL(%s) was located ,Enabled = %d",Station.UnitGUID,Station.plCustomCostEnabled);
			  WriteLog(Message,"");


		} else {

				Message.Format("CMyDatabase::GetStationCustomPL(%s) not located",Station.UnitGUID);
				WriteLog(Message,"");

		}
 
	
		if ( m_RS.IsOpen() )
			 m_RS.Close();
	}
	catch( CDBException *e)
	{

		CString Message;
		Message.Format("CMyDatabase::GetStationCustomPL(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}

}
コード例 #21
0
int CMyDatabase::GetStation( _NetcashDevice &McrStation,CDatabase &m_Database,int dbms)
{
	
	CRecordset       m_RS( &m_Database );
	CString          m_Query;
    int Res = 0;


	try
	{

		m_Query.Format("SELECT GLOBALS_SFBW, GLOBALS_LFBW, GLOBALS_SFCOLOR, GLOBALS_LFCOLOR, GLOBALS_SITE_MULTIPLR FROM DOCUGATE_GENERAL_GLOBAL");
		m_RS.Open(AFX_DB_USE_DEFAULT_TYPE, m_Query,CRecordset::executeDirect);
		
		if ( !m_RS.IsEOF() )
		{
				CString Data;
				McrStation.HIGHEST_COST = 0.00;

				m_RS.GetFieldValue( (short)0, Data);
				McrStation.SFBW		  = (float)atof( Data );
				if (McrStation.SFBW > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.SFBW;
		
				m_RS.GetFieldValue( (short)1, Data);
				McrStation.LFBW		  = (float)atof( Data );
				if (McrStation.LFBW > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.LFBW;
		
				m_RS.GetFieldValue( (short)2, Data);
				McrStation.SFCOLOR		  = (float)atof( Data );
				if (McrStation.SFCOLOR > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.SFCOLOR;
		
				m_RS.GetFieldValue( (short)3, Data);
				McrStation.LFCOLOR		  = (float)atof( Data );
				if (McrStation.LFCOLOR > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.LFCOLOR;
		
				m_RS.GetFieldValue( (short)4, Data); McrStation.SITE_MULTIPLR = (float)atof( Data );
		}
		
 			

		if ( m_RS.IsOpen() )
			 m_RS.Close();


		if ( McrStation.SITE_MULTIPLR > 0.00)
		{
			McrStation.HIGHEST_COST = 0.00;

			McrStation.SFBW		  = McrStation.SFBW    * McrStation.SITE_MULTIPLR;
			if (McrStation.SFBW > McrStation.HIGHEST_COST)
				McrStation.HIGHEST_COST = McrStation.SFBW;
		
			McrStation.LFBW		  = McrStation.LFBW    * McrStation.SITE_MULTIPLR;
			if (McrStation.LFBW > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.LFBW;

			McrStation.SFCOLOR	  = McrStation.SFCOLOR * McrStation.SITE_MULTIPLR;
			if (McrStation.SFCOLOR > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.SFCOLOR;
		
			McrStation.LFCOLOR	  = McrStation.LFCOLOR * McrStation.SITE_MULTIPLR;
			if (McrStation.LFCOLOR > McrStation.HIGHEST_COST)
					McrStation.HIGHEST_COST = McrStation.LFCOLOR;
		
		}

	}
	catch( CDBException *e)
	{
	    Res = 1;
		CString Message;
		Message.Format("CMyDatabase::GetStation(%s)",e->m_strError);
		WriteLog(Message,"");
		e->Delete();
	}



	return Res;


}