#pragma once

#include <string>
#include <vector>

#include "Structure.h"
#include "ado2.h"

#include "DllDefines.h"


// MaintenanceOutputRS.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CMaintenanceOutputRS recordset

class MCCTRDLLCLASS CMaintenanceOutputRS
{
public:
    CMaintenanceOutputRS();
    virtual ~CMaintenanceOutputRS();
    // Field/Param Data
    long m_ID;
    std::string m_Module_Name;
    std::string m_Output;
    long m_Board_Type;
    long m_Logic;
    long m_Point_No;
    long m_Slave_ID;
    long m_Ptr_No;
    BOOL m_Enable_Check;
    long m_CardNo;

    // Overrides
public:
    virtual std::string GetDefaultDBName(); // Default database name
    virtual std::string GetDefaultSQL();    // Default SQL for Recordset

    //  Close Recordset and close database
    virtual void Close();

// Implementation
#ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
#endif

    void InitOutputModule(std::vector<stModule>& modules); // Function to init output module to maintenance page

private:
    CADODatabase m_db;
    CADORecordset m_rs;

    void GetAllFieldsValue();
    bool Open(std::string sqlQuery);
    int GetModuleIndex(std::vector<stModule>& modules);  // return the module index
    void initNoOfOutput(std::vector<stModule>& modules); // initialised all module no of output to 0
};
