123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "FrmResourceF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "FRAME_BlackBoxListF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxCalc"
- #pragma link "cxCheckBox"
- #pragma link "cxClasses"
- #pragma link "cxControls"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxEdit"
- #pragma link "cxFilter"
- #pragma link "cxGraphics"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxSpinEdit"
- #pragma link "cxStyles"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma resource "*.dfm"
- //TFRAMEBlackBoxList *FRAMEBlackBoxList;
- //---------------------------------------------------------------------------
- __fastcall TFRAMEBlackBoxList::TFRAMEBlackBoxList(TComponent* Owner)
- : TFrame(Owner)
- {
- ColumnSel->Options->Filtering = false;
- m_pGDC = TvList->DataController;
- TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<단말기 정보가 없습니다>";
- //FCodeOper = ItsCodeManager->FLists.Find("POT");
- //FCodeType = ItsCodeManager->FLists.Find("PFT");
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEBlackBoxList::UpdateList()
- {
- if (BlackBoxManager == NULL)
- {
- BlackBoxManager = new TBlackBoxManager();
- BlackBoxManager->LoadFromDb();
- }
- CMM_ClearGridTableView(TvList);
- int nRow = 0;
- try
- {
- TvList->BeginUpdate();
- try
- {
- BlackBoxManager->FLists.Lock();
- FOR_STL(TBlackBox*, pObj, BlackBoxManager->FLists)
- {
- if (pObj->MEM_DEL != "N") continue;
- nRow = m_pGDC->AppendRecord();
- m_pGDC->Values[nRow][ColumnSel->Index] = false; //선택
- m_pGDC->Values[nRow][Column00->Index] = "-"; //편집
- m_pGDC->Values[nRow][Column01->Index] = pObj->BDS_MNGM_NMBR;
- m_pGDC->Values[nRow][Column02->Index] = pObj->OPNC_NMBR;
- m_pGDC->Values[nRow][Column03->Index] = pObj->MDM_NMBR;
- m_pGDC->Values[nRow][Column04->Index] = pObj->USIM_NMBR;
- m_pGDC->Values[nRow][Column05->Index] = pObj->VHCL_NMBR;
- m_pGDC->Values[nRow][Column06->Index] = pObj->OWNR_NM;
- m_pGDC->Values[nRow][Column07->Index] = pObj->PRCT_NM;
- m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
- }
- }
- __finally
- {
- BlackBoxManager->FLists.UnLock();
- }
- }
- __finally
- {
- LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
- TvList->EndUpdate();
- TvList->DataController->GotoFirst();
- TvList->DataController->FocusedRecordIndex = 0;
- //CxList->SetFocus();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEBlackBoxList::BtnAllSelectClick(TObject *Sender)
- {
- TcxButton *pBtn = (TcxButton*)Sender;
- CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
- }
- //---------------------------------------------------------------------------
- int __fastcall TFRAMEBlackBoxList::GetSelIds(String &ALinkIds)
- {
- ALinkIds = "";
- if (TvList->ViewData->RecordCount <= 0) return 0;
- int nIndex = m_pGDC->FocusedRecordIndex;
- if( nIndex < 0 )
- return 0;
- String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
- ALinkIds = sLinkId;
- return 1;
- }
- //---------------------------------------------------------------------------
- int __fastcall TFRAMEBlackBoxList::GetSelIds(TStringList *AStringList)
- {
- int nSelCnt = 0;
- try
- {
- TvList->BeginUpdate();
- #if 0
- int nRowCnt = m_pGDC->RecordCount;
- for (int ii = 0; ii < nRowCnt; ii++)
- {
- if (((bool)m_pGDC->Values[ii][ColumnSel->Index]))
- {
- AStringList->Add(m_pGDC->Values[ii][Column00->Index]);
- nSelIdx++;
- }
- }
- #else
- int nRowCnt = TvList->ViewData->RecordCount;
- for (int ii = 0; ii < nRowCnt; ii++)
- {
- TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
- if (((bool)ARow->Values[ColumnSel->Index]))
- {
- AStringList->Add(ARow->Values[Column01->Index]);
- nSelCnt++;
- }
- }
- #endif
- }
- __finally
- {
- TvList->EndUpdate();
- }
- return nSelCnt;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEBlackBoxList::TvListDataControllerFilterChanged(TObject *Sender)
- {
- CMM_SetFilterLike(TvList);
- LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEBlackBoxList::BtnExlSaveClick(TObject *Sender)
- {
- TcxGrid *pGrid = CxList;
- TcxGridTableView *pView = TvList;
- String sTitle= "블랙박스 단말기정보";
- CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEBlackBoxList::OnCloseQuery(bool &CanClose)
- {
- #if 0
- try {
- if (MyItsParkingManager)
- {
- delete MyItsParkingManager;
- MyItsParkingManager = NULL;
- }
- } catch(...) {}
- #endif
- }
- //---------------------------------------------------------------------------
|