public VirtualMachineMetaItem[] GetVirtualMachines(int packageId, string filterColumn, string filterValue,
     string sortColumn, int maximumRows, int startRowIndex)
 {
     vms = ES.Services.VPS.GetVirtualMachines(packageId, filterColumn, filterValue,
             sortColumn, startRowIndex, maximumRows, true);
     return vms.Items;
 }
        public static VirtualMachineMetaItemsPaged GetVirtualMachines(int packageId,
            string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool recursive)
        {
            VirtualMachineMetaItemsPaged result = new VirtualMachineMetaItemsPaged();

            // get reader
            IDataReader reader = DataProvider.GetVirtualMachinesPaged2012(
                    SecurityContext.User.UserId,
                    packageId, filterColumn, filterValue, sortColumn, startRow, maximumRows, recursive);

            // number of items = first data reader
            reader.Read();
            result.Count = (int)reader[0];

            // items = second data reader
            reader.NextResult();
            result.Items = ObjectUtils.CreateListFromDataReader<VirtualMachineMetaItem>(reader).ToArray();

            return result;
        }
        public int GetVirtualMachinesCount(int packageId, string filterColumn, string filterValue)
        {
            if (vms == null)
            {
                vms = ES.Services.VPSPC.GetVirtualMachines(packageId, filterColumn, filterValue,
                        String.Empty, 0, 10, true);
            }

            return vms.Count;
        }