12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- //---------------------------------------------------------------------------
- #pragma hdrstop
- #include "CDSFontColrF.h"
- #include "AppGlobalF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- //---------------------------------------------------------------------------
- TVmsFontColr::TVmsFontColr(int ACOLR_CD, String ACOLR_NM, String ACOLR_DESC, int ACOLR_VAL, int ACOLR_R, int ACOLR_G, int ACOLR_B)
- {
- COLR_CD = ACOLR_CD;
- COLR_NM = ACOLR_NM;
- COLR_DESC = ACOLR_DESC;
- COLR_VAL = ACOLR_VAL;
- COLR_R = ACOLR_R;
- COLR_G = ACOLR_G;
- COLR_B = ACOLR_B;
- USE_YN = "Y";
- }
- //---------------------------------------------------------------------------
- TFontColrManager *FontColrManager = NULL;
- //---------------------------------------------------------------------------
- TFontColrManager::TFontColrManager()
- {
- }
- //---------------------------------------------------------------------------
- TFontColrManager::~TFontColrManager()
- {
- FLists.RemoveAll();
- }
- //---------------------------------------------------------------------------
- int TFontColrManager::Load()
- {
- FLists.RemoveAll();
- String apiUri = g_AppCfg.sRestApiUri + "/api/vms/common/vms-form-font-colr";
- TMcJsonItem *ObjList = NULL;
- try {
- ObjList = TRestObjectManager::RequestGet(apiUri);
- if (ObjList == NULL) {
- return 0;
- }
- for (int ii = 0; ii < ObjList->Count; ii++) {
- String sUseYn = TRestObjectManager::GetValue(ObjList->Items[ii], "use_yn");
- if (sUseYn != "Y") {
- continue;
- }
- String sCD = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_font_colr_cd");
- String sNM = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_font_colr_nm");
- String sDESC = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_font_colr_desc");
- String sVal = TRestObjectManager::GetValue(ObjList->Items[ii], "vms_font_colr_val");
- String sR = TRestObjectManager::GetValue(ObjList->Items[ii], "color_r");
- String sG = TRestObjectManager::GetValue(ObjList->Items[ii], "color_g");
- String sB = TRestObjectManager::GetValue(ObjList->Items[ii], "color_b");
- TVmsFontColr *pObj = new TVmsFontColr(sCD.ToIntDef(0), sNM, sDESC, sVal.ToIntDef(0), sR.ToIntDef(0), sG.ToIntDef(0), sB.ToIntDef(0));
- FLists.Push(pObj->COLR_CD, pObj);
- }
- } __finally {
- if (ObjList) delete ObjList;
- }
- return 0;
- }
- //---------------------------------------------------------------------------
- TVmsFontColr* TFontColrManager::Find(int ATypeCd)
- {
- return FLists.Find(ATypeCd);
- }
- //---------------------------------------------------------------------------
- int TFontColrManager::GetColorCode(int AColor)
- {
- FOR_STL(TVmsFontColr*, pObj, FLists)
- {
- if (AColor == pObj->COLR_VAL) return pObj->COLR_CD;
- }
- return 0;
- }
- //---------------------------------------------------------------------------
- int TFontColrManager::GetColorCodeIndex(int ACode)
- {
- int nIdx = 0;
- FOR_STL(TVmsFontColr*, pObj, FLists)
- {
- if (ACode == pObj->COLR_CD) return nIdx;
- nIdx++;
- }
- return 0;
- }
- //---------------------------------------------------------------------------
|