/// <summary> /// Retrieves all documents /// </summary> /// <returns></returns> public async Task <List <CustomerDocument> > AllModifiedSinceAsyncTask(DateTime date) { return (await VismaNetApiHelper.GetAllModifiedSince <CustomerDocument>(VismaNetControllers.CustomerDocument, date, _authorization).ConfigureAwait(false)); }
/// <summary> /// Retrieves all documents for a customer /// </summary> /// <param name="customerNumber"></param> /// <returns>List of CustomerDocument</returns> public async Task <List <CustomerDocument> > ForCustomer(string customerNumber) { if (string.IsNullOrEmpty(customerNumber)) { throw new ArgumentNullException(nameof(customerNumber)); } return(await VismaNetApiHelper.FetchCustomerDocumentsForCustomerCd(customerNumber, _authorization)); }
/// <summary> /// Retrieves all documents /// </summary> /// <returns></returns> public async Task <List <CustomerDocument> > AllModifiedSince(DateTime date) { var parameters = new NameValueCollection { { "LastModifiedDateTime", date.ToString(VismaNetApiHelper.VismaNetDateTimeFormat) }, { "LastModifiedDateTimeCondition", ">" } }; return(await VismaNetApiHelper.GetAllWithPagination <CustomerDocument>(VismaNetControllers.CustomerDocument, _authorization, parameters)); }
// Executes the expression tree that is passed to it. internal static object Execute(Expression expression, bool IsEnumerable, VismaNetAuthorization auth) { // The expression must represent a query over the data source. if (!IsQueryOverDataSource(expression)) { throw new InvalidProgramException("No query over the data source was specified."); } // Find the call to Where() and get the lambda expression predicate. InnermostWhereFinder whereFinder = new InnermostWhereFinder(); MethodCallExpression whereExpression = whereFinder.GetInnermostWhere(expression); var orderBy = GetOrderByExpression(expression); var numberToRead = GetTakeExpression(expression); LambdaExpression lambdaExpression; IEnumerable <Customer> customers; if (whereExpression != null && whereExpression.Arguments.Count > 1) { lambdaExpression = (LambdaExpression)((UnaryExpression)(whereExpression.Arguments[1])).Operand; // Send the lambda expression through the partial evaluator. lambdaExpression = (LambdaExpression)Evaluator.PartialEval(lambdaExpression); // Get the place name(s) to query the Web service with. var cf = new CustomerFinder(lambdaExpression.Body); if (whereExpression.Method.Name.StartsWith("First")) { numberToRead = 1; } // Call the Web service and get the results. customers = VismaNetApiHelper.FindCustomers(cf.UrlParams, auth, orderBy: orderBy, numberToRead: numberToRead); } else { customers = VismaNetApiHelper.FindCustomers(null, auth, orderBy: orderBy, numberToRead: numberToRead); // Return all customers } // Copy the IEnumerable places to an IQueryable. IQueryable <Customer> queryableCustomers = customers.AsQueryable <Customer>(); // Copy the expression tree that was passed in, changing only the first // argument of the innermost MethodCallExpression. var treeCopier = new ExpressionTreeModifier <Customer>(queryableCustomers); Expression newExpressionTree = treeCopier.Visit(expression); // // This step creates an IQueryable that executes by replacing Queryable methods with Enumerable methods. // if (IsEnumerable) return(queryableCustomers.Provider.CreateQuery(newExpressionTree)); // else // return queryableCustomers.Provider.Execute(newExpressionTree); }
public async Task <List <CustomerDocument> > Find(NameValueCollection parameters) { return(await VismaNetApiHelper.GetAllWithPagination <CustomerDocument>(VismaNetControllers.CustomerDocument, _authorization, parameters)); }
/// <summary> /// Retrieves all documents /// </summary> /// <returns></returns> public async Task <List <CustomerDocument> > All() { return(await VismaNetApiHelper.GetAllWithPagination <CustomerDocument>(VismaNetControllers.CustomerDocument, _authorization)); }
/// <summary> /// Retrieves all documents /// </summary> /// <returns></returns> public async Task <List <CustomerDocument> > AllAsyncTask() { return(await VismaNetApiHelper.GetAll <CustomerDocument>(VismaNetControllers.CustomerDocument, _authorization).ConfigureAwait(false)); }