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

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

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

public:

    String RSE_SECT_ID; //	N	VARCHAR2(3)	N			RSE 구간 아이디
    String LINK_ID;     //	N	NUMBER(10)	N			링크ID
    String LINK_ORD;    //	N	NUMBER(2)	Y			링크 순서
    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 };
};
//---------------------------------------------------------------------------

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

public:

    String RSE_SECT_ID;     //VARCHAR2(8)	N			RSE 구간 아이디
    String DSTC;            //NUMBER(5)	Y			거리
    String RSE_SECT_NM;     //VARCHAR2(30)	Y			RSE 구간 명
    String STRT_SPOT_NM;    //VARCHAR2(30)	Y			시작 지점 명
    String END_SPOT_NM;     //VARCHAR2(30)	Y			종료 지점 명
    String DEL_YN;          //CHAR(1)	Y	'N'		삭제 여부
    String STRT_ID;         //VARCHAR2(3); N		시작 아이디
    String END_ID;          //VARCHAR2(3)	N			종료 아이디

    String MEM_DEL;

    TItsMap<String, TItsDsrcSectLink*>   FLinkLists;

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

/*
* DsrcSect Manager
*/
class TItsDsrcSectManager
{
public:
    TItsDsrcSectManager();
    virtual ~TItsDsrcSectManager();

public:
    TItsMap<String, TItsDsrcSect*>   FLists;

public:
    bool LoadFromDb(TADOConnection *ADbConn=NULL);
    bool LoadSectMstr(TADOConnection *ADbConn=NULL);
    bool LoadSectLink(TADOConnection *ADbConn=NULL);

    bool GetNextSectId(String &ANewId, TADOConnection *ADbConn=NULL);
    bool DeleteSect(String ASectId, TADOConnection *ADbConn=NULL);
    bool SaveSect(TItsDsrcSect *AObj, TADOConnection *ADbConn=NULL);
};
//---------------------------------------------------------------------------
extern TItsDsrcSectManager *ItsDsrcSectManager;
//---------------------------------------------------------------------------

#endif

