public async Task GetdataAsync() { try { /* * * List<UserReg> items = await DataTable * .Where(ur => ur.FirstName != null) * .ToListAsync(); * * * //IEnumerable itemsControl = items; * EmployeeView.ItemsSource = items; * */ IMobileServiceTableQuery <string> query = DataTable .Where(ur => ur.ServiceProvideId != tempdata.Loginas) .Select(ur => ur.InvoiceSubject); List <string> items2 = await query.ToListAsync(); EmployeeView.ItemsSource = items2; // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
public async Task <Users> GetUserInfo(string pass) { await Initialize(); try { await userTable.PullAsync("allUsers", userTable.CreateQuery()); IMobileServiceTableQuery <Users> query = userTable.Where(e => e.Password == pass); var result = await query.ToListAsync(); var userDetails = result.FirstOrDefault(); return(userDetails); } catch (NullReferenceException nre) { Debug.WriteLine("Error: " + nre.Message); return(null); } catch (ArgumentNullException nre) { Debug.WriteLine("Error: " + nre.Message); return(null); } }
public async Task GetdataAsync() { try { IMobileServiceTableQuery <CallerTaskRecord> query = DataTable .Where(ur => ur.pholdername == tempdata.selected_InvoiceSubject); // .Select(todoItem => todoItem.InvoiceSubject); List <CallerTaskRecord> items = await query.ToListAsync(); // EmployeeView.ItemsSource = items2; // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); lb1.Text = string.Format("{0} :- {1}", "Holder Name", items[0].pholdername); lb2.Text = string.Format("{0} :- {1}", "Address", items[0].Address); lb3.Text = string.Format("{0} :- {1}", "Description", items[0].Description); lb4.Text = string.Format("{0} :- {1}", "ServiceType", items[0].ServiceType); lb5.Text = string.Format("{0} :- {1}", "Budget", items[0].Budget); lb6.Text = string.Format("{0} :- {1}", "Due date", items[0].Duedate); // lb7.Text = string.Format("{0} :- {1}", "Assign Status", items[0].AssignStatus); tempdata.duedatevr = items[0].Duedate; tempdata.WorkPlace = items[0].Address; tempdata.servicetype = items[0].ServiceType; tempdata.estimatedfee = items[0].Budget; } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
/// <summary> /// Get News with a LINQ expression. /// </summary> /// <param name="action"></param> /// <returns></returns> public async Task <IQueryResultEnumerable <News> > GetNewsAsync(System.Linq.Expressions.Expression <System.Func <BKNews.News, bool> > action, int skip, int take) { try { #if OFFLINE_SYNC_ENABLED if (syncItems) { await this.SyncAsync(); } #endif IMobileServiceTableQuery <News> query = NewsTable.Where(action).OrderByDescending(news => news.NewsDate).Skip(skip).Take(take); query = query.IncludeTotalCount(); IQueryResultEnumerable <News> items = (IQueryResultEnumerable <News>) await query.ToListAsync(); return(items); } catch (MobileServiceInvalidOperationException msioe) { Debug.WriteLine(@"Invalid sync operation: {0}", msioe.Message); } catch (Exception e) { Debug.WriteLine(@"Sync error: {0}", e.Message); } return(null); }
public async Task <ODataResult <T> > ExecuteQuery(IMobileServiceTableQuery <T> paramQuery) { var url = $"{_webApiUrl}/{GetControllerNameFromType(typeof(T).Name)}/{paramQuery.Query}"; var oDataResult = await GetWebDataAsync(url); return(oDataResult); }
public async Task GetdataAsync() { try { IMobileServiceTableQuery <string> query = DataTable .Where(ur => ur.ServiceProviderId == tempdata.Loginas) .Select(ur => ur.QuotationSubject); List <string> items = await query.ToListAsync(); SQuotationView.ItemsSource = items; //finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); //---------------------------------------------------------------- IMobileServiceTableQuery <string> query2 = DataTable .Where(ur => ur.ServiceProviderId == tempdata.received_quotationID) .Select(ur => ur.QuotationSubject); List <string> items2 = await query2.ToListAsync(); RQuotationView.ItemsSource = items2; } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
public BaseStoreFixture() { _storageService = Substitute.For <IStoreService>(); _syncTable = Substitute.For <IMobileServiceSyncTable <T> >(); _serviceTable = Substitute.For <IMobileServiceTable <T> >(); _mobileServiceTableQuery = Substitute.For <IMobileServiceTableQuery <T> >(); }
public async Task GetdataAsync() { try { IMobileServiceTableQuery <Quotation> query = DataTable .Where(ur => ur.ServiceProviderId == tempdata.received_quotationID && ur.QuotationSubject == tempdata.selected_QuotationSubject); // .Select(todoItem => todoItem.InvoiceSubject); List <Quotation> items = await query.ToListAsync(); // EmployeeView.ItemsSource = items2; // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); lb1.Text = string.Format("{0} :- {1}", "Subject", items[0].QuotationSubject); lb2.Text = string.Format("{0} :- {1}", "Refference Id", items[0].RefferenceId); lb6.Text = string.Format("{0} :- {1}", "WorkPlace", items[0].WorkPlace); lb3.Text = string.Format("{0} :- {1}", "Job Description", items[0].JobDescription); lb4.Text = string.Format("{0} :- {1}", "Estimated Service Fee", items[0].EstimatedServiceFee); lb5.Text = string.Format("{0} :- {1}", "Estimated Other Fee", items[0].EstimatedOtherFee); lb7.Text = string.Format("{0} :- {1}", "EstimatedTotal", items[0].EstimatedTotal); lb8.Text = string.Format("{0} :- {1}", "Quotation Status", items[0].QuotationStatus); tempdata.QuotationSubject = items[0].QuotationSubject; tempdata.RefferenceId = items[0].RefferenceId; tempdata.WorkPlace = items[0].WorkPlace; } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
public InviteUserViewModel(MainViewModel mainViewModelParent, IMobileServiceTable <Profile> mobileServiceProfileTable) { profileTable = mobileServiceProfileTable; parent = mainViewModelParent; SearchCommand = new DelegateCommand(() => { currentPage = 0; if (String.IsNullOrWhiteSpace(SearchText)) { query = profileTable.Take(profileCountPerPage).IncludeTotalCount(); } else { query = profileTable.Take(profileCountPerPage).IncludeTotalCount().Where (p => p.Name.IndexOf(SearchText) >= 0); } RefreshQueryAsync(); }); NextCommand = new DelegateCommand(() => { currentPage++; RefreshQueryAsync(); }, false); PrevCommand = new DelegateCommand(() => { currentPage--; RefreshQueryAsync(); }, false); }
public async Task GetdataAsync() { try { IMobileServiceTableQuery <WorkOrder> query = DataTable .Where(ur => ur.ServiceProviderID == tempdata.Loginas && ur.WorkOrderSubject == tempdata.selected_WorkOrderSubject); // .Select(todoItem => todoItem.InvoiceSubject); List <WorkOrder> items = await query.ToListAsync(); // EmployeeView.ItemsSource = items2; // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); lb1.Text = string.Format("{0} :- {1}", "Subject", items[0].WorkOrderSubject); lb2.Text = string.Format("{0} :- {1}", "DueDate", items[0].DueDate); lb3.Text = string.Format("{0} :- {1}", "Workplace", items[0].Workplace); lb4.Text = string.Format("{0} :- {1}", "Description", items[0].Description); lb5.Text = string.Format("{0} :- {1}", "Current Status", items[0].Status); wos = items[0].Workplace; } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
public MobileServiceCollection(IMobileServiceTableQuery <TTable> query, Func <IEnumerable <TTable>, IEnumerable <TCollection> > selector, int pageSize = 0) { if (query == null) { throw new ArgumentNullException("query"); } if (selector == null) { throw new ArgumentNullException("selector"); } if (pageSize < 0) { throw new ArgumentOutOfRangeException("pageSize"); } this.query = query; MobileServiceTableQuery <TTable> tableQuery = query as MobileServiceTableQuery <TTable>; if (tableQuery != null) { tableQuery.QueryProvider.Features = MobileServiceFeatures.TableCollection; } this.selectorFunction = selector; this.pageSize = pageSize; this.HasMoreItems = true; }
public InviteUserViewModel(MainViewModel mainViewModelParent, IMobileServiceTable<Profile> mobileServiceProfileTable) { profileTable = mobileServiceProfileTable; parent = mainViewModelParent; SearchCommand = new DelegateCommand(() => { currentPage = 0; if (String.IsNullOrWhiteSpace(SearchText)) { query = profileTable.Take(profileCountPerPage).IncludeTotalCount(); } else { query = profileTable.Take(profileCountPerPage).IncludeTotalCount().Where (p => p.Name.IndexOf(SearchText) >= 0); } RefreshQueryAsync(); }); NextCommand = new DelegateCommand(() => { currentPage++; RefreshQueryAsync(); }, false); PrevCommand = new DelegateCommand(() => { currentPage--; RefreshQueryAsync(); }, false); }
public async Task GetdataAsync() { try { IMobileServiceTableQuery <BankAcount> query = DataTable .Where(ur => ur.ServiceProviderId == tempdata.Loginas && ur.AccountName == tempdata.selected_bankaccount); // .Select(todoItem => todoItem.InvoiceSubject); // EmployeeView.ItemsSource = items2; List <BankAcount> items = await query.ToListAsync(); // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); lb1.Text = string.Format("{0} :- {1}", "Account Name", items[0].AccountName); lb2.Text = string.Format("{0} :- {1}", "Bank", items[0].Bank); lb3.Text = string.Format("{0} :- {1}", "Branch", items[0].Branch); lb4.Text = string.Format("{0} :- {1}", "Account Number", items[0].AccountNumber); lb5.Text = string.Format("{0} :- {1}", "Other info", items[0].Info); tempdata.uId = items[0].Id; tempdata.uAccountName = items[0].AccountName; tempdata.uBank = items[0].Bank; tempdata.uBranch = items[0].Branch; tempdata.uAccountNumber = items[0].AccountNumber; tempdata.uInfo = items[0].Info; } catch (Exception e) { DisplayAlert("Erro", "connection lost", "Ok"); Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
/// <summary> /// Execute a query and return its results. /// </summary> /// <typeparam name="T"> /// The type of element returned by the query. /// </typeparam> /// <param name="query"> /// The query to evaluate and get the results for. /// </param> /// <returns> /// Results of the query. /// </returns> internal async Task <IEnumerable <T> > Execute <T>(IMobileServiceTableQuery <T> query) { // Compile the query from the underlying IQueryable's expression // tree MobileServiceTableQueryDescription compiledQuery = this.Compile(query); // Send the query string odata = compiledQuery.ToODataString(); QueryResult result = await this.Execute <T>(query, odata); return(new QueryResultEnumerable <T>( result.TotalCount, result.NextLink, query.Table.MobileServiceClient.Serializer.Deserialize(result.Values, compiledQuery.ProjectionArgumentType).Select( value => { // Apply the projection to the instance transforming it // as desired foreach (Delegate projection in compiledQuery.Projections) { value = projection.DynamicInvoke(value); } return (T)value; }))); }
public static async void logInKorisnik(string user, string pass) { Korisnik kor = null; IMobileServiceTable <TabelaKorisnik> tabela = App.MobileService.GetTable <TabelaKorisnik>(); IMobileServiceTableQuery <TabelaKorisnik> query = tabela.Where(k => (k.username == user && k.password == pass)).IncludeTotalCount(); IEnumerable <TabelaKorisnik> korisnik = await query.ToEnumerableAsync(); long c = ((ITotalCountProvider)korisnik).TotalCount; if (c != 0) { foreach (var k in korisnik) { if (k.tipKorisnika == 1) { kor = new RegistrovaniKorisnik(k.id, k.ime, k.prezime, k.username, k.password, k.email, k.tipKorisnika); } else { kor = new VlasnikObjekta(k.id, k.ime, k.prezime, k.username, k.password, k.email, k.tipKorisnika); } } } SarajevoTravel.ulogovaniKorisnik = kor; }
public static void Query( [MobileTable] IMobileServiceTableQuery <TodoItem> query, TraceWriter trace) { Assert.NotNull(query); trace.Warning("Query"); }
public async Task GetdataAsync() { try { IMobileServiceTableQuery <UserReg> query = DataTable .Where(ur => ur.Email == tempdata.Loginas); // .Select(todoItem => todoItem.InvoiceSubject); List <UserReg> items = await query.ToListAsync(); FirstName.Text = items[0].FirstName; LastName.Text = items[0].LastName; Email.Text = items[0].Email; Address.Text = items[0].Address; PhoneNumber.Text = items[0].PhoneNumber; ServiceType.SelectedItem = Convert.ToString(items[0].ServiceType); tempdata.uId2 = items[0].Id; tempdata.pass = items[0].Password; } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
/// <summary> /// pull the day logs belong to the user only. /// </summary> /// <returns></returns> public override async Task <bool> PullLatestAsync(IMobileServiceTableQuery <DayLog> query = null) { query = query ?? Table.CreateQuery() .Where(l => l.CreatedBy == _securityService.CurrentUserId); return(await base.PullLatestAsync(query)); }
private async void GetReports() { //add Reports //To Seed a report //Report ds = new Report { Report_Id = 1, User_Id = 1, Customer_Id = 2, Equipment = "Laptop", Brand = "Lenovo", Accessories = "None", Description = "Malwayre", Finished = true, CompletedDate = "25/04/2016", Conclusion = "Cleaned Up", Cost = 20, Paid = true }; //await reportTbl.InsertAsync(ds); IMobileServiceTableQuery <Report> query = reportTbl .Where(cid => cid.Customer_Id == custId); List <Report> reports = await query.ToListAsync(); foreach (var report in reports) { string rprt; string status = ""; if (report.Finished == true) { status = "Complete"; } else { status = "Un-Complete"; } rprt = report.Report_Id + ". | " + report.Equipment + " | " + report.Brand + " | " + status; lsbReports.Items.Add(rprt); } // lsbReports.ItemsSource = users; }
private static IMobileServiceTableQuery <Movie> ApplyOrdering(IMobileServiceTableQuery <Movie> query, OrderByClause[] orderBy) { if (orderBy.Length == 1) { if (orderBy[0].IsAscending && orderBy[0].FieldName == "Title") { return(query.OrderBy(m => m.Title)); } else if (!orderBy[0].IsAscending && orderBy[0].FieldName == "Year") { return(query.OrderByDescending(m => m.Year)); } } else if (orderBy.Length == 2) { if (orderBy[1].FieldName == "Title" && orderBy[1].IsAscending) { if (orderBy[0].FieldName == "Duration" && orderBy[0].IsAscending) { return(query.OrderBy(m => m.Duration).ThenBy(m => m.Title)); } else if (orderBy[0].FieldName == "ReleaseDate" && !orderBy[0].IsAscending) { return(query.OrderByDescending(m => m.ReleaseDate).ThenBy(m => m.Title)); } } } throw new NotImplementedException(string.Format("Ordering by [{0}] not implemented yet", string.Join(", ", orderBy.Select(c => string.Format("{0} {1}", c.FieldName, c.IsAscending ? "asc" : "desc"))))); }
public async Task PullAsync <U>(string queryId, IMobileServiceTableQuery <U> query, bool pushOtherTables, CancellationToken cancellationToken, PullOptions pullOptions) { await Task.CompletedTask; }
public Task PullAsync <U>(string queryId, IMobileServiceTableQuery <U> query, bool pushOtherTables, CancellationToken cancellationToken, PullOptions pullOptions) { Arguments.IsNotNull(query, nameof(query)); string queryString = this.queryProvider.ToODataString(query); return(this.PullAsync(queryId, queryString, query.Parameters, pushOtherTables, cancellationToken, pullOptions)); }
/// <summary> /// Initializes a new instance of the MobileServiceTableQueryTranslator /// class. /// </summary> /// <param name="query"> /// The <see cref="T:MobileServiceTableQuery`1{T}"/> which /// is being translated. /// </param> internal MobileServiceTableQueryTranslator(IMobileServiceTableQuery <T> query) { Debug.Assert(query != null); this.query = query; this.queryDescription = new MobileServiceTableQueryDescription(query.Table.TableName, query.RequestTotalCount); }
public async Task GetdataAsync() { try { /* * * List<UserReg> items = await DataTable * .Where(ur => ur.FirstName != null) * .ToListAsync(); * * * //IEnumerable itemsControl = items; * EmployeeView.ItemsSource = items; * */ IMobileServiceTableQuery <Invoice> query = DataTable .Where(ur => ur.ServiceProvideId == tempdata.Loginas && ur.InvoiceSubject == tempdata.selected_InvoiceSubject); // .Select(todoItem => todoItem.InvoiceSubject); List <Invoice> items = await query.ToListAsync(); // EmployeeView.ItemsSource = items2; // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName); lb1.Text = string.Format("{0} :- {1}", "Subject", items[0].InvoiceSubject); lb2.Text = string.Format("{0} :- {1}", "WorkPlace", items[0].WorkPlace); lb3.Text = string.Format("{0} :- {1}", "Description", items[0].Description); lb4.Text = string.Format("{0} :- {1}", "Service Fee", items[0].ServiceFee); lb5.Text = string.Format("{0} :- {1}", "Other Fee", items[0].OtherFee); lb6.Text = string.Format("{0} :- {1}", "Total", items[0].Total); string st; if (items[0].InvoiceStatus == 0) { st = "Pending"; } else if (items[0].InvoiceStatus == 1) { st = "Payment Accepted"; } else { st = "Payment Rejected"; } lb7.Text = string.Format("{0} :- {1}", "Payment Status", st); } catch (Exception e) { Debug.WriteLine("Sync error: {0}", new[] { e.Message }); } }
/// <summary> /// Compile the query into a MobileServiceTableQueryDescription. /// </summary> /// <returns> /// The compiled OData query. /// </returns> internal MobileServiceTableQueryDescription Compile <T>(IMobileServiceTableQuery <T> query) { // Compile the query from the underlying IQueryable's expression // tree MobileServiceTableQueryTranslator <T> translator = new MobileServiceTableQueryTranslator <T>(query); MobileServiceTableQueryDescription compiledQuery = translator.Translate(); return(compiledQuery); }
public async Task PurgeAsync <U>(IMobileServiceTableQuery <U> query, CancellationToken cancellationToken) { if (!await InitializeAsync()) { throw new MobileServiceInvalidOperationException("Unable to purge data. Initialization failed.", null, null); } await _syncTable.PurgeAsync(typeof(T).Name, query, cancellationToken); }
/// <summary> /// /// </summary> /// <param name="query"></param> /// <returns></returns> public async Task PurgeTable(IMobileServiceTableQuery <T> query = null) { if (query == null) { await Table.PurgeAsync(); } await Table.PurgeAsync(Table.CreateQuery()); }
public Task <IEnumerable <U> > ReadAsync <U>(IMobileServiceTableQuery <U> query) { if (query == null) { throw new ArgumentNullException("query"); } return(query.ToEnumerableAsync()); }
private async void GetDetails() { IMobileServiceTableQuery <User> q = userTbl .Where(c => c.Customer_id == custId); List <User> users = await q.ToListAsync(); EachDetail(users); }
public Task <IEnumerable <U> > ReadAsync <U>(IMobileServiceTableQuery <U> query) { if (query == null) { throw new ArgumentNullException("query"); } return(this.queryProvider.Execute(query)); }
public void CreateQueryGeneric() { IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret..."); IMobileServiceTable <StringType> table = service.GetTable <StringType>(); IMobileServiceTableQuery <StringType> query = table.CreateQuery(); Assert.IsNotNull(query); }