//---------------------------------------------------------------------------

#ifndef CDSDsrcOfferSectFH
#define CDSDsrcOfferSectFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <ADODB.hpp>
#include <DB.hpp>
#include "cxCustomData.hpp"
#include "ITSLibF.h"
//---------------------------------------------------------------------------


/*
*  DsrcOfferSectInfr class
*/
class TItsDsrcOfferSectInfr
{
public:
    TItsDsrcOfferSectInfr();
    virtual ~TItsDsrcOfferSectInfr();
    void Clear();
private:
    bool    FCompleted;
    int     FEditMode;
	int     FGridIndex;

public:

    String OFFR_SECT_ID;    //VARCHAR2(8)	N			제공 구간 아이디
    String IFSC_ID;         //NUMBER(10)	N			정보제공구간 ID
    int    ORD;             //NUMBER(2)	N			순서
    String DEL_YN;
    String MEM_DEL;
    
public:
    __property bool   Completed = {read = FCompleted, write = FCompleted};
	__property int    EditMode  = {read = FEditMode,  write = FEditMode };
	__property int    GridIndex = {read = FGridIndex, write = FGridIndex };
};
//---------------------------------------------------------------------------

/*
*  DsrcOfferSect class
*/
class TItsDsrcOfferSect
{
public:
    TItsDsrcOfferSect();
    virtual ~TItsDsrcOfferSect();
    void Clear();
private:
    bool    FCompleted;
    int     FEditMode;
	int     FGridIndex;

public:

    String OFFR_SECT_ID;        //VARCHAR2(8)	N			제공 구간 아이디
    String OFFR_DRCT_NM;        //VARCHAR2(30)	Y			제공 방향 명
    String CNGS_BASI_SPED;      //NUMBER(2)	Y			정체 기준 속도
    String DELY_BASI_SPED;      //NUMBER(2)	Y			지체 기준 속도
    String ID;                  //VARCHAR2(8)	N			아이디
    String OBU_ENTR_DRCT_NMBR;  //CHAR(1)	N			OBU 진입 방향 번호
    String PRE_ID;
    String IXR_DRCT_NUM;
    String TARGETNM;
    String PRENM;
    
    String DEL_YN;
    String MEM_DEL;

    TItsMap<int, TItsDsrcOfferSectInfr*> FSectLists;

public:
    __property bool   Completed = {read = FCompleted, write = FCompleted};
	__property int    EditMode  = {read = FEditMode,  write = FEditMode };
	__property int    GridIndex = {read = FGridIndex, write = FGridIndex };
};
//---------------------------------------------------------------------------

/*
* DsrcOfferSect Manager
*/
class TItsDsrcOfferSectManager
{
public:
    TItsDsrcOfferSectManager();
    virtual ~TItsDsrcOfferSectManager();

public:
    TItsMap<String, TItsDsrcOfferSect*>  FLists;

public:
    bool LoadFromDb(TADOConnection *ADbConn=NULL);
    bool LoadSectMngr(TADOConnection *ADbConn=NULL);
    bool LoadSectInfr(TADOConnection *ADbConn=NULL);
    //bool LoadDrctInfr(TADOConnection *ADbConn=NULL);
    
    bool GetNextOffrSectId(String &ANewId, TADOConnection *ADbConn=NULL);
    bool GetAutoRseDrctNum(String ARseId, int &AAutoNum, TADOConnection *ADbConn=NULL);
    bool DeleteOfferSect(String AOfferSectId, TADOConnection *ADbConn=NULL);
    bool SaveOfferSect(TItsDsrcOfferSect *AObj, TADOConnection *ADbConn=NULL);
};
//---------------------------------------------------------------------------
extern TItsDsrcOfferSectManager *ItsDsrcOfferSectManager;
//---------------------------------------------------------------------------

#endif

