FRAME_WebUserListF.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "FrmResourceF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "FRAME_WebUserListF.h"
  9. //---------------------------------------------------------------------------
  10. #pragma package(smart_init)
  11. #pragma link "cxButtons"
  12. #pragma link "cxCalc"
  13. #pragma link "cxCheckBox"
  14. #pragma link "cxClasses"
  15. #pragma link "cxControls"
  16. #pragma link "cxCustomData"
  17. #pragma link "cxData"
  18. #pragma link "cxDataStorage"
  19. #pragma link "cxEdit"
  20. #pragma link "cxFilter"
  21. #pragma link "cxGraphics"
  22. #pragma link "cxGrid"
  23. #pragma link "cxGridCustomTableView"
  24. #pragma link "cxGridCustomView"
  25. #pragma link "cxGridLevel"
  26. #pragma link "cxGridTableView"
  27. #pragma link "cxLookAndFeelPainters"
  28. #pragma link "cxLookAndFeels"
  29. #pragma link "cxStyles"
  30. #pragma link "cxTextEdit"
  31. #pragma link "dxSkinBlack"
  32. #pragma link "dxSkinBlue"
  33. #pragma link "dxSkinsCore"
  34. #pragma link "dxSkinscxPCPainter"
  35. #pragma resource "*.dfm"
  36. //TFRAMEWebUserList *FRAMEWebUserList;
  37. //---------------------------------------------------------------------------
  38. __fastcall TFRAMEWebUserList::TFRAMEWebUserList(TComponent* Owner)
  39. : TFrame(Owner)
  40. {
  41. ColumnSel->Options->Filtering = false;
  42. m_pGDC = TvList->DataController;
  43. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<홈페이지 관리자 정보가 없습니다>";
  44. MyWebUserManager = new TWebUserManager();
  45. MyWebUserManager->LoadFromDb();
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TFRAMEWebUserList::UpdateList(bool ASelect/*=false*/)
  49. {
  50. CMM_ClearGridTableView(TvList);
  51. int nRow = 0;
  52. try
  53. {
  54. TvList->BeginUpdate();
  55. try
  56. {
  57. MyWebUserManager->FLists.Lock();
  58. FOR_STL(TWebUser*, pObj, MyWebUserManager->FLists)
  59. {
  60. if (1)
  61. {
  62. nRow = m_pGDC->AppendRecord();
  63. m_pGDC->Values[nRow][ColumnSel->Index] = ASelect; //선택
  64. m_pGDC->Values[nRow][Column00->Index] = pObj->EMAIL;
  65. m_pGDC->Values[nRow][Column01->Index] = pObj->USER_ID;
  66. m_pGDC->Values[nRow][Column02->Index] = pObj->NAME;
  67. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  68. }
  69. }
  70. }
  71. __finally
  72. {
  73. MyWebUserManager->FLists.UnLock();
  74. }
  75. }
  76. __finally
  77. {
  78. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  79. TvList->EndUpdate();
  80. TvList->DataController->GotoFirst();
  81. TvList->DataController->FocusedRecordIndex = 0;
  82. //CxList->SetFocus();
  83. }
  84. }
  85. //---------------------------------------------------------------------------
  86. void __fastcall TFRAMEWebUserList::BtnAllSelectClick(TObject *Sender)
  87. {
  88. TcxButton *pBtn = (TcxButton*)Sender;
  89. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  90. }
  91. //---------------------------------------------------------------------------
  92. int __fastcall TFRAMEWebUserList::GetSelLinkIds(String &ALinkIds)
  93. {
  94. ALinkIds = "";
  95. if (TvList->ViewData->RecordCount <= 0) return 0;
  96. int nIndex = m_pGDC->FocusedRecordIndex;
  97. if( nIndex < 0 )
  98. return 0;
  99. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  100. ALinkIds = sLinkId;
  101. return 1;
  102. }
  103. //---------------------------------------------------------------------------
  104. int __fastcall TFRAMEWebUserList::GetSelLinkIds(TStringList *AStringList)
  105. {
  106. int nSelCnt = 0;
  107. try
  108. {
  109. TvList->BeginUpdate();
  110. #if 0
  111. int nRowCnt = m_pGDC->RecordCount;
  112. for (int ii = 0; ii < nRowCnt; ii++)
  113. {
  114. if (((bool)m_pGDC->Values[ii][ColumnSel->Index]))
  115. {
  116. AStringList->Add(m_pGDC->Values[ii][Column00->Index]);
  117. nSelIdx++;
  118. }
  119. }
  120. #else
  121. int nRowCnt = TvList->ViewData->RecordCount;
  122. for (int ii = 0; ii < nRowCnt; ii++)
  123. {
  124. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  125. if (((bool)ARow->Values[ColumnSel->Index]))
  126. {
  127. AStringList->Add(ARow->Values[Column01->Index]);
  128. nSelCnt++;
  129. }
  130. }
  131. #endif
  132. }
  133. __finally
  134. {
  135. TvList->EndUpdate();
  136. }
  137. return nSelCnt;
  138. }
  139. //---------------------------------------------------------------------------
  140. void __fastcall TFRAMEWebUserList::TvListDataControllerFilterChanged(TObject *Sender)
  141. {
  142. CMM_SetFilterLike(TvList);
  143. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  144. }
  145. //---------------------------------------------------------------------------
  146. void __fastcall TFRAMEWebUserList::BtnExlSaveClick(TObject *Sender)
  147. {
  148. TcxGrid *pGrid = CxList;
  149. TcxGridTableView *pView = TvList;
  150. String sTitle= "링크정보";
  151. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TFRAMEWebUserList::OnCloseQuery(bool &CanClose)
  155. {
  156. try {
  157. if (MyWebUserManager)
  158. {
  159. delete MyWebUserManager;
  160. MyWebUserManager = NULL;
  161. }
  162. } catch(...) {}
  163. }
  164. //---------------------------------------------------------------------------