public static SPElemento EstraiElemento(int IdSPElemento, bool ElementoObbligatorioMaster) { SchedeProcessoDS ds = new SchedeProcessoDS(); using (SchedeProcessoBusiness bScheda = new SchedeProcessoBusiness()) { ds.SPELEMENTIOBBLIGATORI.Clear(); if (ElementoObbligatorioMaster) { bScheda.GetElementoObbligatorio(ds, IdSPElemento); SchedeProcessoDS.SPELEMENTIOBBLIGATORIRow riga = ds.SPELEMENTIOBBLIGATORI.Where(x => x.IDSPELEMENTOOBBLIGATORIO == IdSPElemento).FirstOrDefault(); if (riga != null) { return(CreaElementoObbligatorio(riga)); } } else { bScheda.GetElemento(ds, IdSPElemento); SchedeProcessoDS.SPELEMENTIRow riga = ds.SPELEMENTI.Where(x => x.IDSPELEMENTO == IdSPElemento).FirstOrDefault(); if (riga != null) { return(CreaElemento(riga)); } } return(null); } }