#pragma once

#include <string>
#include <vector>

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

#include "DllDefines.h"

// MaintenanceInputRS.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CMaintenanceInputRS recordset

class MCCTRDLLCLASS CMaintenanceInputRS
{
public:
    CMaintenanceInputRS();
    virtual ~CMaintenanceInputRS();

    // Field/Param Data
    long m_ID;
    std::string m_Module_Name;
    std::string m_Input;
    long m_Board_Type;
    long m_Logic;
    long m_Point_No;
    long m_Slave_ID;
    long m_Ptr_No;
    long m_CardNo;


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 InitInputModule(std::vector<stModule>& modules); // Function to init input module to maintenance page

private:
    CADODatabase m_db;
    CADORecordset m_rs;

    bool Open(std::string sql);
    void GetAllFieldsValue();

    int GetModuleIndex(std::vector<stModule>& modules); // return the module index
    void initNoOfInput(std::vector<stModule>& modules); // initialised all module no of input to 0
};
