public void Load(int idorder)
{
db.command.CommandText = @"select mp.idmodel,
idmodelpic,
mp.comment,
mp.typ,
mp.deleted,
mp.picture,
mp.marking,
mp.markingshpross,
oi.idorderitem,
oi.numpos orderitem_numpos,
oi.constrnum orderitem_constrnum,
mp.modelpart
from view_modelpic mp, model m, orderitem oi
where mp.idmodel = m.idmodel and
mp.deleted is null and oi.idmodel=m.idmodel and m.idorder = " + idorder + @"
union all
select null idmodel,
-row_number() over (order by idorderitem) idmodelpic,
null comment,
1 typ,
oi.deleted,
dbo.ZipUnPack(pt.picture) picture,
null marking,
null markingshpross,
idorderitem,
numpos orderitem_numpos,
constrnum orderitem_constrnum,
null modelpart
from orderitem oi inner join
productiontype pt on oi.idproductiontype = pt.idproductiontype
where oi.typ = 3
and oi.deleted is null
and pt.picture is not null
and oi.idorder = " + idorder;
db.adapter.Fill(this);
}