public static ObjectsCollection GetAll() { resourceSchema.Dal.Objects dbo = null; try { dbo = new resourceSchema.Dal.Objects(); System.Data.DataSet ds = dbo.Objects_Select_All(); ObjectsCollection collection = new ObjectsCollection(); if (GlobalTools.IsSafeDataSet(ds)) { for (int i = 0; (i < ds.Tables[0].Rows.Count); i = (i + 1)) { Objects obj = new Objects(); obj.Fill(ds.Tables[0].Rows[i]); if ((obj != null)) { collection.Add(obj); } } } return collection; } catch (System.Exception ) { throw; } finally { if ((dbo != null)) { dbo.Dispose(); } } }
public static Objects Load(System.Nullable<int> Id) { resourceSchema.Dal.Objects dbo = null; try { dbo = new resourceSchema.Dal.Objects(); System.Data.DataSet ds = dbo.Objects_Select_One(Id); Objects obj = null; if (GlobalTools.IsSafeDataSet(ds)) { if ((ds.Tables[0].Rows.Count > 0)) { obj = new Objects(); obj.Fill(ds.Tables[0].Rows[0]); } } return obj; } catch (System.Exception ) { throw; } finally { if ((dbo != null)) { dbo.Dispose(); } } }