regionmodel->setData (regionmodel->index (row, 33), new_region_seq_no);
regionmodel->setData (regionmodel->index (row, 34), riser_id);
regionmodel->setData (regionmodel->index (row, 35), user);
regionmodel->setData (regionmodel->index (row, 36),
regionmapper->setCurrentIndex (row);
new_region_index = regionmapper->currentIndex ();
flowline_filter
= QString("flowline_riser_id = %1").
arg (riser_id
);
flowline_filter.append (" and ");
flowline_filter.
append (QString("flowline_region_seq_no = %2").
arg (new_region_seq_no));
flowlinemodel->setFilter (flowline_filter);
flowlinemapper->toFirst ();
//***************************************************************
//* Now copy the flowline data associated with this region... *
//* We have to make sure we reset the flowline data to the *
//* first record associated with this region and loop thru *
//* all those records, copying them to the new set of data... *
//***************************************************************
flowlinemapper->toFirst ();
for (int i = 0; i < old_flowline_rowcount; i++)
{
regionmapper->setCurrentIndex (old_region_index);
flowline_filter
= QString("flowline_riser_id = %1").
arg (riser_id
);
flowline_filter.append (" and ");
flowline_filter.
append (QString("flowline_region_seq_no = %2").
arg (old_region_seq_no));
flowlinemodel->setFilter (flowline_filter);
old_flowline_record = flowlinemodel->record (i);
regionmapper->setCurrentIndex (new_region_index);
flowline_filter
= QString("flowline_riser_id = %1").
arg (riser_id
);
flowline_filter.append (" and ");
flowline_filter.
append (QString("flowline_region_seq_no = %2").
arg (new_region_seq_no));
flowlinemodel->setFilter (flowline_filter);
if (!flowlinemodel->insertRow (i))
qDebug() << "error" << i;
{
flowlinemapper->setCurrentIndex (i);
flowlinemodel->setData (flowlinemodel->index(i, 0),
old_flowline_record.value ("flowline_od").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 1),
old_flowline_record.value ("flowline_id").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 2),
old_flowline_record.value ("flowline_yield").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 3),
old_flowline_record.value ("flowline_emod").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 4),
old_flowline_record.value ("flowline_val_gap").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 5),
old_flowline_record.value ("flowline_val_offset").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 6),
old_flowline_record.value ("flowline_string").toString ());
flowlinemodel->setData (flowlinemodel->index (i, 7),
sqldb.generate_seq_noDB ("FLOWLINE"));
flowlinemodel->setData (flowlinemodel->index (i, 8), new_region_seq_no);
flowlinemodel->setData (flowlinemodel->index (i, 9), riser_id);
flowlinemodel->setData (flowlinemodel->index (i, 10), user);
flowlinemodel->setData (flowlinemodel->index (i, 11),
}
}
flowlinemapper->toFirst ();
regionmodel->setData (regionmodel->index (row, 33), new_region_seq_no);
regionmodel->setData (regionmodel->index (row, 34), riser_id);
regionmodel->setData (regionmodel->index (row, 35), user);
regionmodel->setData (regionmodel->index (row, 36),
QDateTime::currentDateTime ());
regionmapper->setCurrentIndex (row);
new_region_index = regionmapper->currentIndex ();
flowline_filter = QString("flowline_riser_id = %1").arg (riser_id);
flowline_filter.append (" and ");
flowline_filter.append (QString("flowline_region_seq_no = %2").
arg (new_region_seq_no));
flowlinemodel->setFilter (flowline_filter);
flowlinemapper->toFirst ();
//***************************************************************
//* Now copy the flowline data associated with this region... *
//* We have to make sure we reset the flowline data to the *
//* first record associated with this region and loop thru *
//* all those records, copying them to the new set of data... *
//***************************************************************
flowlinemapper->toFirst ();
for (int i = 0; i < old_flowline_rowcount; i++)
{
regionmapper->setCurrentIndex (old_region_index);
flowline_filter = QString("flowline_riser_id = %1").arg (riser_id);
flowline_filter.append (" and ");
flowline_filter.append (QString("flowline_region_seq_no = %2").
arg (old_region_seq_no));
flowlinemodel->setFilter (flowline_filter);
old_flowline_record = flowlinemodel->record (i);
regionmapper->setCurrentIndex (new_region_index);
flowline_filter = QString("flowline_riser_id = %1").arg (riser_id);
flowline_filter.append (" and ");
flowline_filter.append (QString("flowline_region_seq_no = %2").
arg (new_region_seq_no));
flowlinemodel->setFilter (flowline_filter);
if (!flowlinemodel->insertRow (i))
qDebug() << "error" << i;
{
flowlinemapper->setCurrentIndex (i);
flowlinemodel->setData (flowlinemodel->index(i, 0),
old_flowline_record.value ("flowline_od").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 1),
old_flowline_record.value ("flowline_id").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 2),
old_flowline_record.value ("flowline_yield").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 3),
old_flowline_record.value ("flowline_emod").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 4),
old_flowline_record.value ("flowline_val_gap").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 5),
old_flowline_record.value ("flowline_val_offset").toString ());
flowlinemodel->setData (flowlinemodel->index(i, 6),
old_flowline_record.value ("flowline_string").toString ());
flowlinemodel->setData (flowlinemodel->index (i, 7),
sqldb.generate_seq_noDB ("FLOWLINE"));
flowlinemodel->setData (flowlinemodel->index (i, 8), new_region_seq_no);
flowlinemodel->setData (flowlinemodel->index (i, 9), riser_id);
flowlinemodel->setData (flowlinemodel->index (i, 10), user);
flowlinemodel->setData (flowlinemodel->index (i, 11),
QDateTime::currentDateTime ());
}
}
flowlinemapper->toFirst ();
To copy to clipboard, switch view to plain text mode
Bookmarks