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


#pragma hdrstop

#include "VmsDataTypeF.h"
#include "AppGlobalF.h"
//---------------------------------------------------------------------------

#pragma package(smart_init)
//---------------------------------------------------------------------------


int GradeToColorCode(int AGrade)
{
	int nColor = color_green;
	switch(AGrade)
	{
	//case grade_none:       nColor = color_black; break;
	case grade_smoothness: nColor = color_green; break;
	case grade_delay:      nColor = color_amber; break;
	case grade_congestion: nColor = color_red;   break;
	}
	return nColor;
}
//---------------------------------------------------------------------------

TColor GradeToFillColor(int AGrade)
{
	TColor clColor;
#if 1
    clColor = (TColor)g_AppCfg.nDefaultFillColor;
#else
    clColor = clBlack;
#endif
	switch(AGrade)
	{
	case grade_smoothness: clColor = clLime;   break;
	case grade_delay:      clColor = clYellow; break;
	case grade_congestion: clColor = clRed;    break;
	}
	return clColor;
}
//---------------------------------------------------------------------------

AnsiString GradeToString(int AGrade, int AType)
{
	AnsiString sGrade = " ";
#ifdef LANG_ENG
    if (AType == enFormKindTrfImg)
    {
        switch(AGrade)
        {
        case grade_smoothness: sGrade = "LIGHT";    break;
        case grade_delay:      sGrade = "MODERATE"; break;
        case grade_congestion: sGrade = "HEAVy";    break;
        }
	}
    else
    {
        switch(AGrade)
        {
        //case grade_smoothness: sGrade = "소통원활"; break;
        case grade_smoothness: sGrade = "LIGHT";    break;
        case grade_delay:      sGrade = "MODERATE"; break;
        case grade_congestion: sGrade = "HEAVy";    break;
        }
    }
#else
    if (AType == enFormKindTrfImg)
    {
        switch(AGrade)
        {
        case grade_smoothness: sGrade = "원활"; break;
        case grade_delay:      sGrade = "지체"; break;
        case grade_congestion: sGrade = "정체"; break;
        }
	}
    else
    {
        switch(AGrade)
        {
        //case grade_smoothness: sGrade = "소통원활"; break;
        case grade_smoothness: sGrade = "소통원활"; break;
        case grade_delay:      sGrade = "지 체"; break;
        case grade_congestion: sGrade = "정 체"; break;
        }
    }
#endif
    return sGrade;
}
//---------------------------------------------------------------------------

TColor CodeToColor(int ACode)
{
	TColor clColor = clBlack;
	switch(ACode)
	{
	case color_black: clColor = clBlack;  break;
	case color_red:   clColor = clRed;    break;
	case color_green: clColor = clLime;   break;
	case color_amber: clColor = clYellow; break;
	}
	return clColor;
}
//---------------------------------------------------------------------------

AnsiString CodeToFont(int ACode)
{
#ifdef LANG_ENG
    AnsiString sFont = "Tahoma";
#else
    AnsiString sFont = "맑은 고딕";
#endif

#if 0
    #ifdef LANG_ENG
        switch(ACode)
        {
        case font_malgun:  sFont = "맑은 고딕"; break;
        case font_hygmj:   sFont = "HY견명조";  break;
        case font_gulim:   sFont = "굴림체";    break;
        case font_gungsuh: sFont = "궁서체";    break;
        case font_dotum:   sFont = "돋움체";    break;
        case font_batang:  sFont = "바탕체";    break;
        }
    #else
        AnsiString sFont = "맑은 고딕";
        switch(ACode)
        {
        case font_malgun:  sFont = "맑은 고딕"; break;
        case font_hygmj:   sFont = "HY견명조";  break;
        case font_gulim:   sFont = "굴림체";    break;
        case font_gungsuh: sFont = "궁서체";    break;
        case font_dotum:   sFont = "돋움체";    break;
        case font_batang:  sFont = "바탕체";    break;
        }
    #endif
#else
    TCDSFont *pObj = FontManager->FLists.Find(ACode);
    if (pObj)
        sFont = pObj->FontName;
#endif

	return sFont;
}
//---------------------------------------------------------------------------

AnsiString GetFtpImageId(AnsiString AImgNmbr)
{
    AnsiString sFtpImgId = AImgNmbr;

    //6NNN0
    //7NNN0
    //8NNN0,8NNN1,8NNN2,8NNN3
    try
    {
        //폼이미지와 중복되지 않도록 이미지아이디를 변경한다
        //FTP로 다운로드 해야 하기 때문에 4자리이어야 한다
        AnsiString sType;
        if (AImgNmbr.SubString(1,1) == "6") sType = "S";
        else
        if (AImgNmbr.SubString(1,1) == "7") sType = "B";
        else                                sType = "T";

        sFtpImgId = AImgNmbr.SubString(1,1) + AImgNmbr.SubString(3,3);
    }
    catch(Exception &e)
    {
    }

    return sFtpImgId;
}
//---------------------------------------------------------------------------



