123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "AppGlobalF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "PRK0014MF.h"
- #include "ITS_OPLibF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxGroupBox"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinMcSkin"
- #pragma link "dxSkinsCore"
- #pragma link "cxLabel"
- #pragma link "cxMaskEdit"
- #pragma link "cxSpinEdit"
- #pragma link "cxTextEdit"
- #pragma link "cxClasses"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxFilter"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxStyles"
- #pragma link "dxSkinscxPCPainter"
- #pragma resource "*.dfm"
- TPRK0014M *PRK0014M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TPRK0014M::TPRK0014M(TComponent* Owner, TPrkPlce *AObj)
- : TForm(Owner)
- {
- ITSSkin_Load(this);
- CMM_LoadForm(g_sFormsDir, this);
- Position = poOwnerFormCenter;
- FObj = AObj;
- //FFlrs = AFlrs;
- FSelected = false;
- //UpdateList();
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::UpdateList()
- {
- CMM_ClearGridTableView(TvFlrNo);
- int nRow = 0;
- try
- {
- TcxDataController *pGDC = TvFlrNo->DataController;
- TvFlrNo->BeginUpdate();
- FOR_STL(TPrkPlceFlr*, pObj, FFlrs)
- {
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][Col02->Index] = pObj->FLR_NO;
- pGDC->Values[nRow][Col03->Index] = pObj->FLR_PRK_CMPRT_CO;
- }
- }
- __finally
- {
- TvFlrNo->EndUpdate();
- TvFlrNo->DataController->GotoFirst();
- TvFlrNo->DataController->FocusedRecordIndex = 0;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::BtnSelectClick(TObject *Sender)
- {
- bool dataOK = true;
- try {
- TvFlrNo->BeginUpdate();
- for (int ii = 0; ii < TvFlrNo->DataController->RecordCount; ii++)
- {
- String sCount = VarToStr(TvFlrNo->DataController->Values[ii][Col03->Index]);
- if (sCount == "" || sCount == "0") {
- dataOK = false;
- break;
- }
- }
- }
- __finally
- {
- TvFlrNo->EndUpdate();
- }
- if (!dataOK)
- {
- Application->MessageBox(L"층의 주차구획수가 잘 못 입력 되었습니다..",
- Caption.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- FSelected = true;
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::BtnCancelClick(TObject *Sender)
- {
- FSelected = false;
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- //CMM_SaveForm(g_sFormsDir, this);
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::TvFlrNoCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- if (!ACellViewInfo) return;
- int nRow = TvFlrNo->DataController->FocusedRecordIndex;
- if( nRow <= -1 )
- return;
- String SEL_FLR_NO = TvFlrNo->DataController->Values[nRow][Col02->Index];
- String SEL_FLR_PRK_CMPRT_CO = TvFlrNo->DataController->Values[nRow][Col03->Index];
- FLR_NO->Text = SEL_FLR_NO;
- FLR_PRK_CMPRT_CO->Value = SEL_FLR_PRK_CMPRT_CO.ToIntDef(0);
- }
- //---------------------------------------------------------------------------
- bool __fastcall TPRK0014M::FindParkingFloor(String ANmbr)
- {
- try {
- TvFlrNo->BeginUpdate();
- for (int ii = 0; ii < TvFlrNo->DataController->RecordCount; ii++)
- {
- String sNmbr = VarToStr(TvFlrNo->DataController->Values[ii][Col02->Index]);
- if (sNmbr == "") continue;
- if (sNmbr == ANmbr) return true;
- }
- }
- __finally
- {
- TvFlrNo->EndUpdate();
- }
- return false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::BtnListAddClick(TObject *Sender)
- {
- String sId = InputBox("층번호", "신규 주차장 층번호를 입력하세요(최대 10Byte).", "층번호" );
- sId = sId.Trim();
- if (sId == "층번호" || sId == "")
- {
- return;
- }
- if (AnsiString(sId).Length() > 10)
- {
- Application->MessageBox(L"주차장 층번호는 10Byte를 초과할 수 없습니다.", Caption.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- if (FindParkingFloor(sId))
- {
- Application->MessageBox(L"이미 등록되어 있는 층번호 입니다.", Caption.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- int nRow = TvFlrNo->DataController->AppendRecord();
- TvFlrNo->DataController->Values[nRow][Col02->Index] = sId;
- TvFlrNo->DataController->Values[nRow][Col03->Index] = 0;
- }
- //---------------------------------------------------------------------------
- void __fastcall TPRK0014M::BtnListDeleteClick(TObject *Sender)
- {
- int nSelRows = TvFlrNo->Controller->SelectedRowCount;
- if (nSelRows <= 0)
- {
- Application->MessageBox(L"삭제를 원하는 주차장 층을 목록에서 선택하세요.",
- Caption.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- TvFlrNo->Controller->DeleteSelection();
- }
- //---------------------------------------------------------------------------
|