//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "ITSDbF.h" #include "AppGlobalF.h" #include "CDSCodeF.h" #include "CDSNodeF.h" #include "CDSLinkF.h" #include "CDSIfscF.h" #include "CDSRoadF.h" #include "ITSLangTransF.h" #pragma hdrstop #include "ITS0040MF.h" #include "ITSSEL2MF.h" #include "ITSSELAMF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtonEdit" #pragma link "cxButtons" #pragma link "cxCalc" #pragma link "cxClasses" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxCustomData" #pragma link "cxData" #pragma link "cxDataStorage" #pragma link "cxDropDownEdit" #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 "cxGroupBox" #pragma link "cxLabel" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxMaskEdit" #pragma link "cxSpinEdit" #pragma link "cxSplitter" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma resource "*.dfm" TITS0040M *ITS0040M = NULL; //--------------------------------------------------------------------------- __fastcall TITS0040M::TITS0040M(TComponent* Owner) : TForm(Owner) { LangTrans->Translate(this, ITSDb_GetConnection()); ITSSkin_Load(this); CMM_LoadForm(g_sFormsDir, this); FTitle = Caption;//"¹Ýº¹Á¤Ã¼±¸°£ °ü¸®"; } //--------------------------------------------------------------------------- void __fastcall TITS0040M::CommClose() { try { CMM_SaveForm(g_sFormsDir, this); } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::FormInit() { //SendMessage(DateTimePicker1->Handle, DTM_SETFORMAT, 0, Longint("HH:mm:ss")); //DateTimePicker1->Time = FormatDateTime("HH:mm:ss", Time()); m_pGDC1 = TvList1->DataController; m_pGDC2 = TvList2->DataController; TvList1->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<¿¹»ó ¹Ýº¹Á¤Ã¼±¸°£ Á¤º¸°¡ ¾ø½À´Ï´Ù>"; TvList2->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<È®Á¤ ¹Ýº¹Á¤Ã¼±¸°£ Á¤º¸°¡ ¾ø½À´Ï´Ù>"; FCodeRCS = ItsCodeManager->FLists.Find("RCS"); //¹Ýº¹Á¤Ã¼±¸°£ Ãâó À¯Çü FCodeDTW = ItsCodeManager->FLists.Find("DTW"); //¿äÀÏÀ¯Çü FCodeLTC = ItsCodeManager->FLists.Find("LTC"); //¼ÒÅëµî±Þ FCodeIFD = ItsCodeManager->FLists.Find("IFD"); //Á¤º¸Á¦°ø±¸°£ ¹æÇâÄÚµå if (FCodeDTW) { CbDayType->Properties->Items->Clear(); FOR_STL(TItsSubCode *, pSubCode, FCodeDTW->FSubLists) { CbDayType->Properties->Items->Add("[" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM); } CbDayType->ItemIndex = 0; } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::FormShow(TObject *Sender) { Refresh(); FormInit(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TITS0040M::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; BtnSearchClick((TObject*)BtnSearch); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnSearchClick(TObject *Sender) { Application->ProcessMessages(); TSqlCursor sqlCrs((TControl*)BtnSearch); RefreshData(); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::RefreshData() { ItsRepeatCongestManager->LoadFromDb(); SelConfirmList(); SelUnConfirmList(); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::SelConfirmList() { TItsIfsc *pSvcLink; TItsSubCode *pSubCode; CMM_ClearGridTableView(TvList2); int nRow2 = 0; try { TvList2->BeginUpdate(); try { ItsRepeatCongestManager->FListsCnfm.Lock(); FOR_STL(TItsRepeatCongest*, pRpLink, ItsRepeatCongestManager->FListsCnfm) { //¸µÅ©±âº»Á¤º¸ pSvcLink = ItsIfscManager->FLists.Find(pRpLink->IFSC_ID); if (!pSvcLink) continue; //±âº»Á¤º¸°¡ ¾ø´Â °ÍÀº º¸¿©ÁÙ Çʿ䰡 ¾ø´Ù. String sStatTm = pRpLink->STAT_YM; if (sStatTm != "") sStatTm.Insert("-", 5); String sDTW = "[" + pRpLink->DAY_TYPE_CD + "] "; //¿äÀÏ À¯Çü ÄÚµå if (FCodeDTW) { pSubCode = FCodeDTW->FSubLists.Find(pRpLink->DAY_TYPE_CD); if (pSubCode) sDTW = sDTW + pSubCode->CMMN_CD_KOR_NM; } String sStTm = pRpLink->CNFS_STRT_HM; sStTm.Insert(":", 3); String sEdTm = pRpLink->CNFS_END_HM; sEdTm.Insert(":", 3); #if 0 String sCrtDt = pRpLink->CRTN_YMD; if (sCrtDt.Length() > 7) { sCrtDt.Insert("-", 7); } sCrtDt.Insert("-", 5); #endif String sRCS = "[" + pRpLink->REPT_CNGS_SECT_ORGN_CD + "] "; //¹Ýº¹ Á¤Ã¼ ±¸°£ ¿øº» ÄÚµå if (FCodeRCS) { pSubCode = FCodeRCS->FSubLists.Find(pRpLink->REPT_CNGS_SECT_ORGN_CD); if (pSubCode) sRCS = sRCS + pSubCode->CMMN_CD_KOR_NM; } if (pRpLink->REPT_CNGS_SECT_ORGN_CD == "") sRCS = ""; String sIFD = "[" + pSvcLink->DRCT_CD + "] "; if (FCodeIFD) { pSubCode = FCodeIFD->FSubLists.Find(pSvcLink->DRCT_CD); // ¹æÇâÄÚµå if (pSubCode) sIFD = sIFD + pSubCode->CMMN_CD_KOR_NM; } // if (pRpLink->DCSN_YN != "Y") nRow2 = m_pGDC2->AppendRecord(); m_pGDC2->Values[nRow2][BColumn01->Index] = pSvcLink->IFSC_ID; //ID m_pGDC2->Values[nRow2][BColumn02->Index] = ITSUtil_FormatStr(pRpLink->STAT_YM, STR_MM); //Åë°è³â¿ù m_pGDC2->Values[nRow2][BColumn03->Index] = sDTW; //¿äÀÏ m_pGDC2->Values[nRow2][BColumn04->Index] = sStTm; //È¥Àâ½ÃÀ۽úРm_pGDC2->Values[nRow2][BColumn05->Index] = sEdTm; //È¥ÀâÁ¾·á½ÃºÐ m_pGDC2->Values[nRow2][BColumn06->Index] = pRpLink->AVRG_SPED; //Æò±Õ¼Óµµ m_pGDC2->Values[nRow2][BColumn07->Index] = pRpLink->AVRG_TRVL_HH;//Æò±ÕÅëÇà½Ã°£ m_pGDC2->Values[nRow2][BColumn08->Index] = pRpLink->DCSN_YN; //È®Á¤¿©ºÎ //m_pGDC2->Values[nRow2][BColumn09->Index] = sCrtDt; //»ý¼ºÀÏÀÚ m_pGDC2->Values[nRow2][BColumn09->Index] = ITSUtil_FormatStr(pRpLink->CRTN_YMD, STR_DATE); //»ý¼ºÀÏÀÚ m_pGDC2->Values[nRow2][BColumn10->Index] = sRCS; //»ý¼ºÀÚ m_pGDC2->Values[nRow2][BColumn11->Index] = pSvcLink->IFSC_NM; //¸íĪ m_pGDC2->Values[nRow2][BColumn12->Index] = sIFD; //¹æÇâ m_pGDC2->Values[nRow2][BColumn13->Index] = pSvcLink->STRT_NM; //½ÃÁ¡¸í m_pGDC2->Values[nRow2][BColumn14->Index] = pSvcLink->END_NM; //Á¾Á¡¸í m_pGDC2->Values[nRow2][BColumn99->Index] = (int)pRpLink; } } __finally { ItsRepeatCongestManager->FListsCnfm.UnLock(); } } __finally { TvList2->EndUpdate(); TvList2->DataController->GotoFirst(); TvList2->DataController->FocusedRecordIndex = 0; } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::SelUnConfirmList() { TItsIfsc *pSvcLink; TItsSubCode *pSubCode; CMM_ClearGridTableView(TvList1); int nRow1 = 0; try { TvList1->BeginUpdate(); try { ItsRepeatCongestManager->FLists.Lock(); FOR_STL(TItsRepeatCongest*, pRpLink, ItsRepeatCongestManager->FLists) { //¸µÅ©±âº»Á¤º¸ pSvcLink = ItsIfscManager->FLists.Find(pRpLink->IFSC_ID); if (!pSvcLink) continue; //±âº»Á¤º¸°¡ ¾ø´Â °ÍÀº º¸¿©ÁÙ Çʿ䰡 ¾ø´Ù. String sStatTm = pRpLink->STAT_YM; if (sStatTm != "") sStatTm.Insert("-", 5); String sDTW = "[" + pRpLink->DAY_TYPE_CD + "] "; //¿äÀÏ À¯Çü ÄÚµå if (FCodeDTW) { pSubCode = FCodeDTW->FSubLists.Find(pRpLink->DAY_TYPE_CD); if (pSubCode) sDTW = sDTW + pSubCode->CMMN_CD_KOR_NM; } String sStTm = pRpLink->CNFS_STRT_HM; sStTm.Insert(":", 3); String sEdTm = pRpLink->CNFS_END_HM; sEdTm.Insert(":", 3); #if 0 String sCrtDt = pRpLink->CRTN_YMD; if (sCrtDt.Length() > 7) { sCrtDt.Insert("-", 7); } sCrtDt.Insert("-", 5); #endif String sRCS = "[" + pRpLink->REPT_CNGS_SECT_ORGN_CD + "] "; //¹Ýº¹ Á¤Ã¼ ±¸°£ ¿øº» ÄÚµå if (FCodeRCS) { pSubCode = FCodeRCS->FSubLists.Find(pRpLink->REPT_CNGS_SECT_ORGN_CD); if (pSubCode) sRCS = sRCS + pSubCode->CMMN_CD_KOR_NM; } if (pRpLink->REPT_CNGS_SECT_ORGN_CD == "") sRCS = ""; String sIFD = "[" + pSvcLink->DRCT_CD + "] "; if (FCodeIFD) { pSubCode = FCodeIFD->FSubLists.Find(pSvcLink->DRCT_CD); // ¹æÇâÄÚµå if (pSubCode) sIFD = sIFD + pSubCode->CMMN_CD_KOR_NM; } // if (pRpLink->DCSN_YN != "Y") nRow1 = m_pGDC1->AppendRecord(); m_pGDC1->Values[nRow1][AColumn01->Index] = pSvcLink->IFSC_ID; //ID m_pGDC1->Values[nRow1][AColumn02->Index] = ITSUtil_FormatStr(pRpLink->STAT_YM, STR_MM); //Åë°è³â¿ù m_pGDC1->Values[nRow1][AColumn03->Index] = sDTW; //¿äÀÏ m_pGDC1->Values[nRow1][AColumn04->Index] = sStTm; //È¥Àâ½ÃÀ۽úРm_pGDC1->Values[nRow1][AColumn05->Index] = sEdTm; //È¥ÀâÁ¾·á½ÃºÐ m_pGDC1->Values[nRow1][AColumn06->Index] = pRpLink->AVRG_SPED; //Æò±Õ¼Óµµ m_pGDC1->Values[nRow1][AColumn07->Index] = pRpLink->AVRG_TRVL_HH;//Æò±ÕÅëÇà½Ã°£ m_pGDC1->Values[nRow1][AColumn08->Index] = pRpLink->DCSN_YN; //È®Á¤¿©ºÎ //m_pGDC1->Values[nRow1][AColumn09->Index] = sCrtDt; //»ý¼ºÀÏÀÚ m_pGDC1->Values[nRow1][AColumn09->Index] = ITSUtil_FormatStr(pRpLink->CRTN_YMD, STR_DATE); //»ý¼ºÀÏÀÚ m_pGDC1->Values[nRow1][AColumn10->Index] = sRCS; //»ý¼ºÀÚ m_pGDC1->Values[nRow1][AColumn11->Index] = pSvcLink->IFSC_NM; //¸íĪ m_pGDC1->Values[nRow1][AColumn12->Index] = sIFD; //¹æÇâ m_pGDC1->Values[nRow1][AColumn13->Index] = pSvcLink->STRT_NM; //½ÃÁ¡¸í m_pGDC1->Values[nRow1][AColumn14->Index] = pSvcLink->END_NM; //Á¾Á¡¸í m_pGDC1->Values[nRow1][AColumn99->Index] = (int)pRpLink; } } __finally { ItsRepeatCongestManager->FLists.UnLock(); } } __finally { TvList1->EndUpdate(); TvList1->DataController->GotoFirst(); TvList1->DataController->FocusedRecordIndex = 0; } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); ITS0040M = NULL; Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnOperatorInputClick(TObject *Sender) { GrpOperatroInput->Visible = !GrpOperatroInput->Visible; } //--------------------------------------------------------------------------- void __fastcall TITS0040M::EdLinkIdPropertiesButtonClick(TObject *Sender, int AButtonIndex) { PopupAddLink->Popup(EdLinkId->ClientOrigin.x, EdLinkId->ClientOrigin.y + EdLinkId->Height); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::MnuListListClick(TObject *Sender) { try { TITSSEL2M *pSelForm = new TITSSEL2M(this); pSelForm->m_bSelected = false; pSelForm->ShowModal(); if (pSelForm->m_bSelected) { EdLinkId->Text = pSelForm->m_sSelLinkId; } delete pSelForm; } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::MnuGisAddClick(TObject *Sender) { try { TITSSELAM *pSelForm = new TITSSELAM(this); pSelForm->MultiSelect = false; pSelForm->LinkLevel = 2; pSelForm->ShowModal(); Application->ProcessMessages(); if (pSelForm->Selected) { if (pSelForm->TvList->DataController->RecordCount > 0) { String sLinkId = pSelForm->TvList->DataController->Values[0][pSelForm->Column01->Index]; TItsIfsc *pIfsc = ItsIfscManager->FLists.Find(sLinkId); if (!pIfsc) { Application->MessageBox(lblSelErr->Caption.c_str(),//L"Á¤º¸°¡ ¾ø´Â ±¸°£À» ¼±ÅÃÇÏ¿´½À´Ï´Ù. ´Ù¸¥ ±¸°£À» ¼±ÅÃÇϼ¼¿ä.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL); return; } EdLinkId->Text = sLinkId; } } delete pSelForm; } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnCnfmCancelClick(TObject *Sender) { UnconfirmData(true); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnAppCancelClick(TObject *Sender) { UnconfirmData(false); } //--------------------------------------------------------------------------- void __fastcall TITS0040M::UnconfirmData(bool AConfirm) { TcxGridTableView *TvList = TvList1; TcxDataController *pGDC = m_pGDC1; int nIdx = AColumn99->Index; String sTitle = lblGss1->Caption + " " + lblCancel->Caption;//"¿¹»ó ¹Ýº¹Á¤Ã¼±¸°£ Ãë¼Ò"; if (AConfirm) { TvList = TvList2; pGDC = m_pGDC2; nIdx = BColumn99->Index; sTitle = lblGss2->Caption + " " + lblCancel->Caption;//"È®Á¤ ¹Ýº¹Á¤Ã¼±¸°£ Ãë¼Ò"; } int nSelRows = TvList->Controller->SelectedRowCount; if (nSelRows <= 0) { Application->MessageBox(lblSelErr2->Caption.c_str(),//L"ÀÛ¾÷ ÇÒ Á¤Ã¼±¸°£À» ¼±ÅÃÇϼ¼¿ä.", sTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL); return; } if (Application->MessageBox(lblCancel2->Caption.c_str(),//L"¼±ÅÃÇÑ Á¤Ã¼±¸°£À» Ãë¼Ò ÇϽðڽÀ´Ï±î?", sTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return; TADOQuery *pADO = NULL; String sQry; try { TItsRepeatCongest *pRpLink; int nSelIdx, nMemPtr; TvList->BeginUpdate(); sQry = "DELETE TB_REPT_CNGS_SECT \r\n" " WHERE IFSC_ID = :p01 \r\n" " AND STAT_YM = :p02 \r\n" " AND DAY_TYPE_CD = :p03 \r\n" " AND CNFS_STRT_HM = :p04 \r\n"; try { pADO = new TADOQuery(NULL); pADO->Close(); pADO->Connection = ITSDb_GetConnection(); ITSDb_SQLText(pADO, sQry); ITSDb_GetConnection()->BeginTrans(); for (int ii = 0; ii < nSelRows; ii++) { nSelIdx = TvList->Controller->SelectedRows[ii]->RecordIndex; nMemPtr = pGDC->Values[nSelIdx][nIdx]; pRpLink = (TItsRepeatCongest *)nMemPtr; ITSDb_SQLBind(pADO, "p01", pRpLink->IFSC_ID); ITSDb_SQLBind(pADO, "p02", pRpLink->STAT_YM); ITSDb_SQLBind(pADO, "p03", pRpLink->DAY_TYPE_CD); ITSDb_SQLBind(pADO, "p04", pRpLink->CNFS_STRT_HM); ITSDb_SQLExec(pADO); } ITSDb_GetConnection()->CommitTrans(); Application->MessageBox(lblCancel3->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ Ãë¼Ò ÀÛ¾÷À» ¿Ï·áÇÏ¿´½À´Ï´Ù.", sTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } catch(EDatabaseError &E) { ITSDb_GetConnection()->RollbackTrans(); ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &e) { ITSDb_GetConnection()->RollbackTrans(); ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry); throw Exception(String(e.ClassName()) + e.Message); } } __finally { if (pADO) { pADO->Close(); delete pADO; } TvList->EndUpdate(); RefreshData(); } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnApplyClick(TObject *Sender) { int nSelRows = TvList1->Controller->SelectedRowCount; if (nSelRows <= 0) { Application->MessageBox(lblQry1->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£À¸·Î È®Á¤ÇÒ ±¸°£À» ¼±ÅÃÇϼ¼¿ä.", lblCnfm->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ È®Á¤", MB_OK|MB_ICONWARNING|MB_APPLMODAL); return; } if (Application->MessageBox(lblQry2->Caption.c_str(),//L"¼±ÅÃÇÑ ±¸°£À» ¹Ýº¹Á¤Ã¼±¸°£À¸·Î È®Á¤ ÇϽðڽÀ´Ï±î?", lblCnfm->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ È®Á¤", MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return; TADOQuery *pADO = NULL; String sQry; try { TItsRepeatCongest *pRpLink; int nSelIdx, nMemPtr; TvList1->BeginUpdate(); sQry = "UPDATE TB_REPT_CNGS_SECT \r\n" " SET DCSN_YN = 'Y' \r\n" " WHERE IFSC_ID = :p01 \r\n" " AND STAT_YM = :p02 \r\n" " AND DAY_TYPE_CD = :p03 \r\n" " AND CNFS_STRT_HM = :p04 \r\n"; try { pADO = new TADOQuery(NULL); pADO->Close(); pADO->Connection = ITSDb_GetConnection(); ITSDb_SQLText(pADO, sQry); ITSDb_GetConnection()->BeginTrans(); for (int ii = 0; ii < nSelRows; ii++) { nSelIdx = TvList1->Controller->SelectedRows[ii]->RecordIndex; nMemPtr = m_pGDC1->Values[nSelIdx][AColumn99->Index]; pRpLink = (TItsRepeatCongest *)nMemPtr; if (pRpLink) { ITSDb_SQLBind(pADO, "p01", pRpLink->IFSC_ID); ITSDb_SQLBind(pADO, "p02", pRpLink->STAT_YM); ITSDb_SQLBind(pADO, "p03", pRpLink->DAY_TYPE_CD); ITSDb_SQLBind(pADO, "p04", pRpLink->CNFS_STRT_HM); ITSDb_SQLExec(pADO); } } ITSDb_GetConnection()->CommitTrans(); Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"¿¹»ó ¹Ýº¹Á¤Ã¼±¸°£À» È®Á¤ ¹Ýº¹Á¤Ã¼±¸°£À¸·Î ÀúÀå ÇÏ¿´½À´Ï´Ù.", lblCnfm->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ È®Á¤", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } catch(EDatabaseError &E) { ITSDb_GetConnection()->RollbackTrans(); ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &e) { ITSDb_GetConnection()->RollbackTrans(); ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry); throw Exception(String(e.ClassName()) + e.Message); } } __finally { if (pADO) { pADO->Close(); delete pADO; } TvList1->EndUpdate(); RefreshData(); } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::BtnSaveClick(TObject *Sender) { String sSvcId = EdLinkId->Text.Trim(); TItsIfsc *pIfsc; pIfsc = ItsIfscManager->FLists.Find(sSvcId); if (!pIfsc) { Application->MessageBox(lblQry3->Caption.c_str(),//L"µî·ÏµÇ¾î ÀÖÁö ¾ÊÀº ¼­ºñ½º ±¸°£À̰ųª ¼­ºñ½º ±¸°£À» ¼±ÅÃÇÏÁö ¾ÊÀ¸¼Ì½À´Ï´Ù.\r\n¼­ºñ½º ±¸°£À» È®ÀÎ ÈÄ ÀÛ¾÷Çϼ¼¿ä.", lblOpr->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ ¿î¿µÀÚµî·Ï", MB_OK|MB_ICONWARNING|MB_APPLMODAL); ActiveControl = EdLinkId; return; } String sStTime = DtStTime->Time.FormatString("hhnn"); String sEdTime = DtEdTime->Time.FormatString("hhnn"); if (sStTime > sEdTime) { Application->MessageBox(lblQry4->Caption.c_str(),//L"È¥Àâ ½ÃÀ۽úР°ú È¥Àâ Á¾·á½ÃºÐÀÌ Á¤È®È÷ ÀԷµÇÁö ¾Ê¾Ò½À´Ï´Ù.\r\nÈ¥Àâ ½ÃÀÛ/Á¾·á ½Ã°¢À» È®ÀÎ ÈÄ ÀÛ¾÷Çϼ¼¿ä.", lblOpr->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ ¿î¿µÀÚµî·Ï", MB_OK|MB_ICONWARNING|MB_APPLMODAL); ActiveControl = DtStTime; return; } String sDayType = ITSUtil_GetCode(CbDayType->Text); TADOQuery *pADO = NULL; String sQry; try { TItsRepeatCongest *pRpLink; int nSelIdx; TvList1->BeginUpdate(); sQry = "INSERT INTO TB_REPT_CNGS_SECT ( \r\n" " IFSC_ID , \r\n" " STAT_YM , \r\n" " DAY_TYPE_CD , \r\n" " CNFS_STRT_HM , \r\n" " CNFS_END_HM , \r\n" " AVRG_SPED , \r\n" " AVRG_TRVL_HH , \r\n" " DCSN_YN , \r\n" " CRTN_YMD , \r\n" " REPT_CNGS_SECT_ORGN_CD ) \r\n" " VALUES ( \r\n" " :p01, \r\n" " TO_CHAR(SYSDATE, 'YYYYMM'), \r\n" " :p02, \r\n" " :p03, \r\n" " :p04, \r\n" " :p05, \r\n" " :p06, \r\n" " 'Y', \r\n" " TO_CHAR(SYSDATE, 'YYYYMMDD'), \r\n" " 'RCS2' ) \r\n"; try { pADO = new TADOQuery(NULL); pADO->Close(); pADO->Connection = ITSDb_GetConnection(); ITSDb_SQLText(pADO, sQry); ITSDb_GetConnection()->BeginTrans(); ITSDb_SQLBind(pADO, "p01", sSvcId); ITSDb_SQLBind(pADO, "p02", sDayType); ITSDb_SQLBind(pADO, "p03", sStTime); ITSDb_SQLBind(pADO, "p04", sEdTime); ITSDb_SQLBind(pADO, "p05", SpSpeed->Value); ITSDb_SQLBind(pADO, "p06", SpAvgTm->Value); ITSDb_SQLExec(pADO); ITSDb_GetConnection()->CommitTrans(); Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"¿î¿µÀÚ µî·Ï ¹Ýº¹Á¤Ã¼±¸°£ Á¤º¸¸¦ ÀúÀå ÇÏ¿´½À´Ï´Ù.", lblOpr->Caption.c_str(),//L"¹Ýº¹Á¤Ã¼±¸°£ ¿î¿µÀÚµî·Ï", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); EdLinkId->Text = ""; BtnOperatorInputClick(NULL); } catch(EDatabaseError &E) { ITSDb_GetConnection()->RollbackTrans(); ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &e) { ITSDb_GetConnection()->RollbackTrans(); ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry); throw Exception(String(e.ClassName()) + e.Message); } } __finally { if (pADO) { pADO->Close(); delete pADO; } TvList1->EndUpdate(); RefreshData(); } } //--------------------------------------------------------------------------- void __fastcall TITS0040M::TvList1DataControllerFilterChanged(TObject *Sender) { CMM_SetFilterLike(TvList1); } //---------------------------------------------------------------------------