Ejemplo n.º 1
0
 public static EmployeeObjectCollection DataTableToCollection(DataTable employees, string alias)
 {
     EmployeeObjectCollection objectsTotal;
     EmployeeObjectCollection objects = new EmployeeObjectCollection();
     try
     {
         IEnumerator enumerator = null;
         try
         {
             enumerator = employees.Rows.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 DataRow current = (DataRow)enumerator.Current;
                 objects.Add(EmployeeRowToObject(current, alias));
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         objectsTotal = objects;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return objectsTotal;
 }
Ejemplo n.º 2
0
        public static EmployeeObjectCollection DataTableToCollection(DataTable employees, string alias)
        {
            EmployeeObjectCollection objectsTotal;
            EmployeeObjectCollection objects = new EmployeeObjectCollection();

            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = employees.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow current = (DataRow)enumerator.Current;
                        objects.Add(EmployeeRowToObject(current, alias));
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                objectsTotal = objects;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(objectsTotal);
        }
Ejemplo n.º 3
0
 public EmployeeObjectCollection GetAll()
 {
     EmployeeObjectCollection employees = new EmployeeObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false,0));
         builder.AppendWhereBoolean(EmployeeObject.ARCHIVE, false, QueryBuilder.ParameterLocation.FIRST_LAST);
         builder.AppendOrderBy(EmployeeObject.NAME, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
         employees = EmployeeConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0], "");
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return employees;
 }