123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469 |
- #include "stdafx.h"
- #include "GridDataClr.h"
- #include <COTSUtilityDllFunExport.h>
- namespace OTSCLRINTERFACE {
- // constructor
- CGridRowClr::CGridRowClr() // constructor
- {
- m_LpGridRow = new CGridRowPtr(new CGridRow());
- }
- // constructor
- CGridRowClr::CGridRowClr(CGridRowPtr a_pGridRow)
- {
- ASSERT(a_pGridRow);
- if (!a_pGridRow)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CGridRowClr: Invalid CGridRow pointer."));
- return;
- }
-
- m_LpGridRow = new CGridRowPtr(a_pGridRow);
-
- }
- CGridRowClr::~CGridRowClr()
- {
- if (m_LpGridRow != nullptr)
- {
- delete m_LpGridRow;
- m_LpGridRow = nullptr;
- }
- }
- CGridRowClr::!CGridRowClr()
- {
- if (m_LpGridRow != nullptr)
- {
- delete m_LpGridRow;
- m_LpGridRow = nullptr;
- }
- }
- CGridRowPtr CGridRowClr::GetGridRowPtr()
- {
- return *m_LpGridRow;
- }
- int CGridRowClr::GetDataType()
- {
- int nDataType = -1;
- if (m_LpGridRow != nullptr)
- {
- nDataType = (int)m_LpGridRow->get()->GetDataType();
- }
- return nDataType;
- }
- void CGridRowClr::SetDataType(int a_nDataType)
- {
- if (m_LpGridRow != nullptr)
- {
- m_LpGridRow->get()->SetDataType(( OTSDATA::REPORT_GRID_DATA_TYPE)a_nDataType);
- }
- }
- // get string value
- String^ CGridRowClr::GetStringValue()
- {
- String^ strGridRowClr;
- if (m_LpGridRow != nullptr)
- {
- CString strGridRow = m_LpGridRow->get()->GetStringValue();
- strGridRowClr = gcnew String(strGridRow);
- }
- return strGridRowClr;
- }
-
- void CGridRowClr::SetStringValue(String^ a_strValue)
- {
- ASSERT(a_strValue);
- if (!a_strValue)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetStringValue: invalid string pointer."));
- return;
- }
- if (m_LpGridRow != nullptr)
- {
- m_LpGridRow->get()->SetStringValue(a_strValue);
- }
- }
- COTSParticleClr^ CGridRowClr::GetParticle()
- {
- COTSParticleClr^ OTSParticleClr;
- if (m_LpGridRow != nullptr)
- {
- COTSParticlePtr pOTSParticle = m_LpGridRow->get()->GetParticle();
- OTSParticleClr = gcnew COTSParticleClr(pOTSParticle);
- }
- return OTSParticleClr;
- }
- bool CGridRowClr::SetParticle(COTSParticleClr^ a_oParticle)
- {
- ASSERT(a_oParticle);
- if (!a_oParticle)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetParticle: invalid particle pointer."));
- return false;
- }
- bool bResult = false;
- if (m_LpGridRow != nullptr)
- {
- COTSParticlePtr pOTSParticle = a_oParticle->GetOTSParticlePtr();
- bResult = m_LpGridRow->get()->SetParticle(pOTSParticle);
- }
- return bResult;
- }
- int CGridRowClr::GetIntValue()
- {
- int nIntValue = -1;
- if (m_LpGridRow != nullptr)
- {
- nIntValue = m_LpGridRow->get()->GetIntValue();
- }
- return nIntValue;
- }
- void CGridRowClr::SetIntValue(int a_nIntValue)
- {
- if (m_LpGridRow != nullptr)
- {
- m_LpGridRow->get()->SetIntValue(a_nIntValue);
- }
- }
- double CGridRowClr::GetDoubleValue()
- {
- double bDoubleValue = -1;
- if (m_LpGridRow != nullptr)
- {
- bDoubleValue = m_LpGridRow->get()->GetDoubleValue();
- }
- return bDoubleValue;
- }
- void CGridRowClr::SetDoubleValue(double a_dFloatValue)
- {
- if (m_LpGridRow != nullptr)
- {
- m_LpGridRow->get()->SetDoubleValue(a_dFloatValue);
- }
- }
- // constructor
- CGridColumnClr::CGridColumnClr() // constructor
- {
- m_LpGridColumn = new CGridColumnPtr(new CGridColumn());
- }
- CGridColumnClr::CGridColumnClr(CGridColumnPtr a_pGridColumn)
- {
- ASSERT(a_pGridColumn);
- if (!a_pGridColumn)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CGridColumnClr: Invalid CGridColumn pointer."));
- return;
- }
- m_LpGridColumn = new CGridColumnPtr(new CGridColumn(a_pGridColumn.get()));
- }
- CGridColumnClr::CGridColumnClr(CGridColumn* a_pGridColumn) // copy constructor
- {
- ASSERT(a_pGridColumn);
- if (!a_pGridColumn)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CGridColumnClr: Invalid CGridColumn pointer."));
- return;
- }
- m_LpGridColumn = new CGridColumnPtr(new CGridColumn(a_pGridColumn));
- }
- CGridColumnClr::~CGridColumnClr()
- {
- if (m_LpGridColumn != nullptr)
- {
- delete m_LpGridColumn;
- }
- }
- CGridColumnClr::!CGridColumnClr()
- {
- if (m_LpGridColumn != nullptr)
- {
- delete m_LpGridColumn;
- }
- }
- CGridColumnPtr CGridColumnClr::GetGridColumnPtr()
- {
- return *m_LpGridColumn;
- }
- String^ CGridColumnClr::GetName()
- {
- String^ strNameClr;
- if (m_LpGridColumn != nullptr)
- {
- CString strName = m_LpGridColumn->get()->GetName();
- strNameClr = gcnew String(strName);
- }
- return strNameClr;
- }
- void CGridColumnClr::SetName(String^ a_strName)
- {
- ASSERT(a_strName);
- if (!a_strName)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetName: invalid name pointer."));
- return;
- }
- if (m_LpGridColumn != nullptr)
- {
- m_LpGridColumn->get()->SetName(a_strName);
- }
- }
- CGridRowListClr^ CGridColumnClr::GetRowList()
- {
- CGridRowListClr^ listGridRowClr = gcnew CGridRowListClr();
- if (m_LpGridColumn != nullptr)
- {
- CGridRowsList listGridRow = m_LpGridColumn->get()->GetRowList();
- for (auto pGridRow : listGridRow)
- {
- CGridRowClr^ GridRowClr = gcnew CGridRowClr(pGridRow);
- listGridRowClr->Add(GridRowClr);
- }
- }
- return listGridRowClr;
- }
- bool CGridColumnClr::SetGridRowsList(CGridRowListClr^ a_listGridRows, bool a_bClear)
- {
- ASSERT(a_listGridRows);
- if (!a_listGridRows)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetGridRowsList: invalid GridRow list pointer."));
- return false;
- }
- bool bResult = false;
- if (m_LpGridColumn != nullptr)
- {
- CGridRowsList listGridRows;
- int nSize = a_listGridRows->Count;
- for (int i = 0; i < nSize; i++)
- {
- CGridRowPtr pGridRow = CGridRowPtr(new CGridRow(a_listGridRows[i]->GetGridRowPtr().get()));
- ASSERT(pGridRow);
- if (!pGridRow)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetGridRowsList: Can't generate grid row pointer."));
- return false;
- }
- listGridRows.push_back(pGridRow);
- }
- bResult = m_LpGridColumn->get()->SetGridRowsList(listGridRows, a_bClear);
- }
- return bResult;
- }
- // constructor
- CGridDataClr::CGridDataClr() // constructor
- {
- m_LpGridData = new CGridDataPtr(new CGridData());
- }
- CGridDataClr::CGridDataClr(CGridDataPtr a_pGridData)// constructor
- {
- ASSERT(a_pGridData);
- if (!a_pGridData)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CGridDataClr: Invalid CGridData pointer."));
- return;
- }
- m_LpGridData = new CGridDataPtr(new CGridData(a_pGridData.get()));
- }
- CGridDataClr::CGridDataClr(CGridData* a_pGridData)
- {
- ASSERT(a_pGridData);
- if (!a_pGridData)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CGridDataClr: Invalid CGridData pointer."));
- return;
- }
- m_LpGridData = new CGridDataPtr(new CGridData(a_pGridData));
- }
- CGridDataClr::~CGridDataClr() // copy constructor
- {
- if (m_LpGridData != nullptr)
- {
- delete m_LpGridData;
- }
- }
- CGridDataClr::!CGridDataClr() // copy constructor
- {
- if (m_LpGridData != nullptr)
- {
- delete m_LpGridData;
- }
- }
- CGridDataPtr CGridDataClr::GetGridDataPtr()
- {
- return *m_LpGridData;
- }
-
- CGridColumnListClr^ CGridDataClr::GetGridColumnList()
- {
- CGridColumnListClr^ GridColumnListClr = gcnew CGridColumnListClr();
- if (m_LpGridData != nullptr)
- {
- CGridColumnsList listGridColumn = m_LpGridData->get()->GetGridColumnList();
- for (auto pGridColumn : listGridColumn)
- {
- CGridColumnClr^ GridColumnClr = gcnew CGridColumnClr(pGridColumn);
- GridColumnListClr->Add(GridColumnClr);
- }
- }
- return GridColumnListClr;
- }
- bool CGridDataClr::SetGridColumnList(CGridColumnListClr^ a_listGridColumn, bool a_bClear)
- {
- ASSERT(a_listGridColumn);
- if (!a_listGridColumn)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetGridColumnList: invalid GridColumn list pointer."));
- return false;
- }
- bool bResult = false;
- if (m_LpGridData != nullptr)
- {
- CGridColumnsList listGridColumns;
- int nSize = a_listGridColumn->Count;
- for (int i = 0; i < nSize; i++)
- {
- CGridColumnPtr pGridColumn = CGridColumnPtr(new CGridColumn(a_listGridColumn[i]->GetGridColumnPtr().get()));
- ASSERT(pGridColumn);
- if (!pGridColumn)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetGridColumnList: Can't generate grid column pointer."));
- return false;
- }
- listGridColumns.push_back(pGridColumn);
- }
- bResult = m_LpGridData->get()->SetGridColumnList(listGridColumns, a_bClear);
- }
- return bResult;
- }
- System::Collections::Generic::List<String^>^ CGridDataClr::GetDataSourceList()
- {
- System::Collections::Generic::List<String^>^ listDataSourceClr = gcnew System::Collections::Generic::List<String^>();
- if (m_LpGridData != nullptr)
- {
- std::vector<CString> listDataSource = m_LpGridData->get()->GetDataSourceList();
- for (auto DataSource : listDataSource)
- {
- String^ DataSourceClr = gcnew String(DataSource);
- listDataSourceClr->Add(DataSourceClr);
- }
- }
- return listDataSourceClr;
- }
- // data source id
- bool CGridDataClr::SetDataSourceList(System::Collections::Generic::List<String^>^ a_listDataSource)
- {
- bool bResult = false;
- ASSERT(a_listDataSource);
- if (!a_listDataSource)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetDataSourceList:invalid data source list."));
- return false;
- }
- if (m_LpGridData != nullptr)
- {
- int nSize = a_listDataSource->Count;
- for (int i = 0; i < nSize; i++)
- {
- std::vector<CString> listDataSource;
- listDataSource.push_back(a_listDataSource[i]);
- bResult = m_LpGridData->get()->SetDataSourceList(listDataSource);
- }
- }
- return bResult;
- }
- int CGridDataClr::GetDataSourceId()
- {
- int nDataSourceId = -1;
- if (m_LpGridData != nullptr)
- {
- nDataSourceId = m_LpGridData->get()->GetDataSourceId();
- }
- return nDataSourceId;
- }
- void CGridDataClr::SetDataSourceId(int a_nDataSourceId)
- {
- if (m_LpGridData != nullptr)
- {
- m_LpGridData->get()->SetDataSourceId(a_nDataSourceId);
- }
- }
- }
|