www.gusucode.com > VC++建筑横梁数据管理系统源代码源码程序 > VC++建筑横梁数据管理系统源代码源码程序/code/DataExchangeFunDefine.cpp
#include "stdafx.h" #include "BeamDataManager.h" #include "DataExchangeFunDefine.h" #include "changeDlg.h" // Download by http://www.NewXing.com void DataExchangeFunction::_IntDataExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { ChangeDlg dlg; //转递数据到修改对话框中 POSITION pos = listcontrol.GetFirstSelectedItemPosition(); int nItem = listcontrol.GetNextSelectedItem(pos); dlg.m_data = listcontrol.GetItemText(nItem,2); dlg.m_title=listcontrol.GetItemText(nItem,1); dlg.SetIDTemplate(m_DlgIDTemplate); bool ok=false; while(!ok){ int ret=dlg.DoModal(); if(ret==IDCANCEL) ok=true; if(ret==IDOK){ ok=true; if(dlg.m_data=="\0"){ AfxMessageBox("数据不能为空",MB_OK); ok=false; } else{ int value=atoi(dlg.m_data.GetBuffer(dlg.m_data.GetLength())); dlg.m_data.Format("%d",value); listcontrol.SetItemText(nItem,2,dlg.m_data); pRecordset->PutCollect("参 数",(_variant_t)dlg.m_data); (LPCTSTR)(_bstr_t)pRecordset->GetCollect("ChildTableName"); pRecordset->Update(); } } } } void DataExchangeFunction::_DoubleDataExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { ChangeDlg dlg; //转递数据到修改对话框中 POSITION pos = listcontrol.GetFirstSelectedItemPosition(); int nItem = listcontrol.GetNextSelectedItem(pos); dlg.m_data = listcontrol.GetItemText(nItem,2); dlg.m_title=listcontrol.GetItemText(nItem,1); dlg.SetIDTemplate(m_DlgIDTemplate); if(dlg.DoModal()==IDOK){ double value=atof(dlg.m_data.GetBuffer(dlg.m_data.GetLength())); dlg.m_data.Format("%.2f",value); listcontrol.SetItemText(nItem,2,dlg.m_data); pRecordset->PutCollect("参 数",(_variant_t)dlg.m_data); pRecordset->Update(); } } void DataExchangeFunction::_StringDataExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { ChangeDlg dlg; POSITION pos = listcontrol.GetFirstSelectedItemPosition(); int nItem = listcontrol.GetNextSelectedItem(pos); dlg.m_data = listcontrol.GetItemText(nItem,2); dlg.m_title=listcontrol.GetItemText(nItem,1); dlg.SetIDTemplate(m_DlgIDTemplate); bool ok=false; while(!ok){ int ret=dlg.DoModal(); if(ret==IDCANCEL) ok=true; if(ret==IDOK){ ok=true; if(dlg.m_data=="\0"){ AfxMessageBox("数据不能为空",MB_OK); ok=false; } else{ listcontrol.SetItemText(nItem,2,dlg.m_data); pRecordset->PutCollect("参 数",(_variant_t)dlg.m_data); pRecordset->Update(); } } } } void DataExchangeFunction::IntDataExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_CHANGEDLG_INT; _IntDataExchange(pRecordset,listcontrol); } void DataExchangeFunction::DoubleDataExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_CHANGEDLG_DOUBLE; _DoubleDataExchange(pRecordset,listcontrol); } void DataExchangeFunction::ConcreteGradeExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_CONCRETEGRADE; _IntDataExchange(pRecordset,listcontrol); } void DataExchangeFunction::SteelGradeExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_STEELGRADE; _StringDataExchange(pRecordset,listcontrol); } void DataExchangeFunction::SteelDiameterExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_STEELDIAMETER; _StringDataExchange(pRecordset,listcontrol); } void DataExchangeFunction::SteelLayerExchange(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_STEELLAYER; _StringDataExchange(pRecordset,listcontrol); } void DataExchangeFunction::SteelFrameStyle(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_STEELFRAMESTYLE; ChangeDlg dlg; POSITION pos = listcontrol.GetFirstSelectedItemPosition(); int nItem = listcontrol.GetNextSelectedItem(pos); dlg.m_title="钢筋骨架分类"; dlg.SetIDTemplate(m_DlgIDTemplate); bool ok=false; while(!ok){ int ret=dlg.DoModal(); if(ret==IDCANCEL) ok=true; if(ret==IDOK){ ok=true; if(dlg.m_data=="\0"||dlg.m_data2=="\0"){ AfxMessageBox("数据不能为空",MB_OK); ok=false; } else{ listcontrol.SetItemText(nItem,1,dlg.m_data); listcontrol.SetItemText(nItem,2,dlg.m_data2); pRecordset->PutCollect("钢筋骨架类型",(_variant_t)dlg.m_data); pRecordset->PutCollect("骨架片数",(_variant_t)dlg.m_data2); pRecordset->Update(); } } } } void DataExchangeFunction::SteelNumbers(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_STEELNUMBERS; ChangeDlg dlg; POSITION pos = listcontrol.GetFirstSelectedItemPosition(); int nItem = listcontrol.GetNextSelectedItem(pos); dlg.m_title=listcontrol.GetItemText(nItem,0);; dlg.SetIDTemplate(m_DlgIDTemplate); bool ok=false; while(!ok){ int ret=dlg.DoModal(); if(ret==IDCANCEL) ok=true; if(ret==IDOK){ ok=true; if(dlg.m_data=="\0"){ AfxMessageBox("数据不能为空",MB_OK); ok=false; } else{ listcontrol.SetItemText(nItem,1,dlg.m_data); pRecordset->PutCollect("钢筋根数或种类",(_variant_t)dlg.m_data); pRecordset->Update(); } } } } void DataExchangeFunction::bendsteel_wholelength(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { m_DlgIDTemplate=IDD_BENDSTL_WHOLELEN; ChangeDlg dlg; POSITION pos = listcontrol.GetFirstSelectedItemPosition(); int nItem = listcontrol.GetNextSelectedItem(pos); dlg.m_data = listcontrol.GetItemText(nItem,1); dlg.m_data2 = listcontrol.GetItemText(nItem,2); dlg.m_data3 = listcontrol.GetItemText(nItem,3); dlg.m_data4 = listcontrol.GetItemText(nItem,4); dlg.m_title="通过跨中弯起钢筋"; dlg.SetIDTemplate(m_DlgIDTemplate); bool ok=false; while(!ok){ int ret=dlg.DoModal(); if(ret==IDCANCEL) ok=true; if(ret==IDOK){ ok=true; if(dlg.m_data=="\0"||dlg.m_data2=="\0"||dlg.m_data3=="\0"||dlg.m_data4=="\0"){ AfxMessageBox("数据不能为空",MB_OK); ok=false; } else{ double value=atof(dlg.m_data.GetBuffer(dlg.m_data.GetLength())); dlg.m_data.Format("%.2f",value); listcontrol.SetItemText(nItem,1,dlg.m_data); value=atof(dlg.m_data2.GetBuffer(dlg.m_data2.GetLength())); dlg.m_data2.Format("%.2f",value); listcontrol.SetItemText(nItem,2,dlg.m_data2); value=atof(dlg.m_data3.GetBuffer(dlg.m_data3.GetLength())); dlg.m_data3.Format("%.2f",value); listcontrol.SetItemText(nItem,3,dlg.m_data3); value=atof(dlg.m_data4.GetBuffer(dlg.m_data4.GetLength())); dlg.m_data4.Format("%.2f",value); listcontrol.SetItemText(nItem,4,dlg.m_data4); pRecordset->PutCollect("边支点左距",(_variant_t)dlg.m_data); pRecordset->PutCollect("边支点右距",(_variant_t)dlg.m_data2); pRecordset->PutCollect("中支点左距",(_variant_t)dlg.m_data3); pRecordset->PutCollect("中支点右距",(_variant_t)dlg.m_data4); pRecordset->Update(); } } } } void DataExchangeFunction::bendsteel_truncation(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::sidefulcrum_leftsteel_tilte(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::sidefulcrum_rightsteel_tilte(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::middlefulcrum_leftsteel_tilte(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::middlefulcrum_rightsteel_tilte(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::steelsectionlocation(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::basestructdata(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::steelframedefine(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { } void DataExchangeFunction::wholesteellever(_RecordsetPtr &pRecordset,CListCtrl &listcontrol) { AfxMessageBox("ok",MB_OK); }