Esempio n. 1
0
        public async Task TotalCountBasics()
        {
            // Insert a few records
            IMobileServiceTable <ToDo> table = GetClient().GetTable <ToDo>();
            ToDo first = new ToDo {
                Title = "ABC", Complete = false
            };
            await table.InsertAsync(first);

            await table.InsertAsync(new ToDo { Title = "DEF", Complete = true });

            await table.InsertAsync(new ToDo { Title = "GHI", Complete = false });

            ITotalCountProvider             countProvider = null;
            IMobileServiceTableQuery <ToDo> query         = table.Where(t => t.Id >= first.Id);

            // Run a simple query and verify we get all 3 items, but the
            // TotalCount is not provided.
            List <ToDo> items = await query.ToListAsync();

            countProvider = items as ITotalCountProvider;
            Assert.AreEqual(3, items.Count);
            Assert.IsNotNull(countProvider);
            Assert.AreEqual(-1L, countProvider.TotalCount);

            IEnumerable <ToDo> sequence = await query.ToEnumerableAsync();

            countProvider = sequence as ITotalCountProvider;
            Assert.IsNotNull(countProvider);
            Assert.AreEqual(-1L, countProvider.TotalCount);

            // Now use IncludeTotalCount and make sure we get the expected
            // number of results
            query = query.IncludeTotalCount();
            items = await query.ToListAsync();

            countProvider = items as ITotalCountProvider;
            Assert.AreEqual(3, items.Count);
            Assert.IsNotNull(countProvider);
            Assert.AreEqual(3L, countProvider.TotalCount);

            sequence = await query.ToEnumerableAsync();

            countProvider = sequence as ITotalCountProvider;
            Assert.IsNotNull(countProvider);
            Assert.AreEqual(3L, countProvider.TotalCount);

            // Verify that IncludeTotalCount is correctly propagated with
            // projections
            List <string> titles = await query.Select(t => t.Title).ToListAsync();

            countProvider = titles as ITotalCountProvider;
            Assert.AreEqual(3, titles.Count);
            Assert.IsNotNull(countProvider);
            Assert.AreEqual(3L, countProvider.TotalCount);
        }
        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 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 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);
            }
        }
        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;
        }
Esempio n. 6
0
        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 });
            }
        }
Esempio n. 7
0
        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 });
            }
        }
Esempio n. 8
0
        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 });
            }
        }
Esempio n. 9
0
        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 });
            }
        }
Esempio n. 10
0
        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 });
            }
        }
Esempio n. 11
0
        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 });
            }
        }
        private async void GetDetails()
        {
            IMobileServiceTableQuery <User> q = userTbl
                                                .Where(c => c.Customer_id == custId);

            List <User> users = await q.ToListAsync();

            EachDetail(users);
        }
Esempio n. 13
0
        private async void buttonEliminar_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxIdTecnicoEditar.SelectedItem != null)
            {
                string idTecnico;
                object selectedItem = comboBoxIdTecnicoEditar.SelectedValue.ToString();
                idTecnico = selectedItem.ToString();

                var dialog = new MessageDialog("¿Esta seguro de eliminar al usuario?");
                dialog.Title = "¿Esta seguro?";
                dialog.Commands.Add(new UICommand {
                    Label = "Si", Id = 0
                });
                dialog.Commands.Add(new UICommand {
                    Label = "No", Id = 1
                });
                var result = await dialog.ShowAsync();

                if ((int)result.Id == 0)
                {
                    try
                    {
                        IMobileServiceTableQuery <Usuario> query = UsuariosTable.Where(Tecnico => Tecnico.id == idTecnico);
                        var res = await query.ToListAsync();

                        var     item          = res.First();
                        string  idEliminar    = item.id;
                        JObject tecnicoDelete = new JObject();
                        tecnicoDelete.Add("id", idEliminar);
                        await UsuariosTable.DeleteAsync(tecnicoDelete);

                        radioButtonEliminar.IsChecked     = false;
                        buttonEliminar.Visibility         = Visibility.Collapsed;
                        comboBoxIdTecnicoEditar.IsEnabled = false;
                    }
                    catch (MobileServiceInvalidOperationException ex)
                    {
                        exception = ex;
                    }

                    if (exception != null)
                    {
                        await new MessageDialog(exception.Message, "Error!").ShowAsync();
                    }
                    else
                    {
                        MessageDialog mensaje = new MessageDialog("Se elimino correctamente.", "Eliminación correcta");
                        await mensaje.ShowAsync();

                        limpiarTexBoxRegistroEditar();
                        disableTexBox();
                        radioButtonEliminar.IsChecked = false;
                    }
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// generic method to get one row from table by ID
        /// </summary>
        /// <typeparam name="T">ID as string</typeparam>
        /// <param name="ID"></param>
        /// <returns>item of generic object</returns>
        public static async Task <T> SelectOneItem <T>(string ID) where T : BaseModel
        {
            IMobileServiceSyncTable <T> Table;

            Table = client.GetSyncTable <T>();
            IMobileServiceTableQuery <T> query = Table.Where(x => x.ID == ID);
            List <T> items = await query.ToListAsync();

            return(items.FirstOrDefault());
        }
Esempio n. 15
0
        public async Task GetdataAsync()
        {
            try
            {
                IMobileServiceTable <Invoice> dsin = client.GetTable <Invoice>();

                IMobileServiceTableQuery <string> query = dsin
                                                          .Where(ur => ur.ServiceProvideId != tempdata.Loginas)
                                                          .Select(ur => ur.InvoiceSubject);

                List <string> listin = await query.ToListAsync();


                //-- paind invoice--
                IMobileServiceTable <Invoice> dsinp = client.GetTable <Invoice>();

                IMobileServiceTableQuery <string> query4 = dsin
                                                           .Where(ur => ur.ServiceProvideId == tempdata.Loginas & ur.InvoiceStatus == 1)
                                                           .Select(ur => ur.InvoiceSubject);

                List <string> listinp = await query4.ToListAsync();

                //------------

                IMobileServiceTable <Quotation> dsqu = client.GetTable <Quotation>();

                IMobileServiceTableQuery <string> query2 = dsqu
                                                           .Where(ur => ur.ServiceProviderId == tempdata.received_quotationID)
                                                           .Select(ur => ur.QuotationSubject);

                List <string> ilistqu = await query2.ToListAsync();

                // --------------------

                IMobileServiceTable <WorkOrder> dswork = client.GetTable <WorkOrder>();

                IMobileServiceTableQuery <string> query3 = dswork
                                                           .Where(ur => ur.ServiceProviderID != tempdata.Loginas)
                                                           .Select(ur => ur.WorkOrderSubject);

                List <string> listwkd = await query3.ToListAsync();


                /*
                 * qno.Text = Convert.ToString(ilistqu.Count);
                 * inv.Text = Convert.ToString(listin.Count);
                 * wod.Text = Convert.ToString(listwkd.Count);
                 * pinv.Text = Convert.ToString(listinp.Count);
                 */
            }
            catch (Exception e)
            {
                Debug.WriteLine("Sync error: {0}", new[] { e.Message });
            }
        }
        public async Task <FeedBack> GetFeedback(string eventID)
        {
            await Initialize();

            IMobileServiceTableQuery <FeedBack> query = feedbackTable.Where(e => e.EventID == eventID);
            var result = await query.ToListAsync();

            var feedback = result.FirstOrDefault();

            return(feedback);
        }
Esempio n. 17
0
        //Public Methods
        public async Task <List <User> > GetUser(string userid)
        {
            if (string.IsNullOrEmpty(userid))
            {
                return(new List <User>());
            }

            await SyncAsync();

            IMobileServiceTableQuery <User> query = _usersTable.Where(u => u.UserID == userid);

            return(await query.ToListAsync());
        }
Esempio n. 18
0
        public async Task <List <Comment> > GetComments(string imageid)
        {
            if (string.IsNullOrEmpty(imageid))
            {
                return(new List <Comment>());
            }

            await SyncAsync();

            IMobileServiceTableQuery <Comment> query = _commsTable.Where(c => c.ImageID == imageid);

            return(await query.ToListAsync());
        }
Esempio n. 19
0
        public async Task <List <AlbumItem> > GetAllImages(string albumid, bool receipts)
        {
            if (string.IsNullOrEmpty(albumid))
            {
                return(new List <AlbumItem>());
            }

            await SyncAsync();

            IMobileServiceTableQuery <AlbumItem> query = _albumTable.Where(a => a.Album == albumid && a.IsReceipt == receipts);

            return(await query.ToListAsync());
        }
Esempio n. 20
0
        public async Task <List <Card> > GetAllCards(string userid, bool all = false)
        {
            if (string.IsNullOrEmpty(userid))
            {
                return(new List <Card>());
            }

            await SyncAsync();

            IMobileServiceTableQuery <Card> query = !all?_cardsTable.Where(c => c.UserID == userid && c.Active == true) : _cardsTable.Where(c => c.UserID == userid);

            return((await query.ToListAsync()).OrderBy(c => c.User).ToList());
        }
Esempio n. 21
0
        private async void LoginBtn_Clicked(object sender, EventArgs e)
        {
            //  await Navigation.PushAsync(new HomePage(), true);



            if (validate())
            {
                try
                {
                    this.IsBusy        = true;
                    LoginBtn.IsEnabled = false;


                    IMobileServiceTableQuery <string> query = DataTable
                                                              .Where(ur => ur.Email == usernameEntry.Text)
                                                              .Select(ur => ur.Password);

                    List <string> passlist = await query.ToListAsync();


                    string Encpass = passlist[0];
                    string Dcpass  = passwordDecrypt(Encpass, EncryptionKey);


                    if (Dcpass == passwordEntry.Text)  //validate()

                    {
                        // apiCall();

                        string nameis = string.Format("{0} {1}", "You are login as", usernameEntry.Text);

                        DisplayAlert("Login success!", nameis, "Ok");
                        tempdata.Loginas = usernameEntry.Text;

                        await Navigation.PushAsync(new HomePage(), true);
                    }
                    else
                    {
                        DisplayAlert("Login Fail!", "Please enter correct details ", "Ok");
                        this.IsBusy        = false;
                        LoginBtn.IsEnabled = true;
                    }
                }
                catch (Exception ee)
                {
                    Debug.WriteLine("" + ee);
                }
            }
        }
Esempio n. 22
0
        /// <summary>
        /// generic method to remove item form table by ID or by object
        /// </summary>
        /// <typeparam name="T">ID as string</typeparam>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static async Task RemoveASync <T>(string ID) where T : BaseModel
        {
            IMobileServiceSyncTable <T> Table;

            Table = client.GetSyncTable <T>();
            IMobileServiceTableQuery <T> query = Table.Where(x => x.ID == ID);
            List <T> items = await query.ToListAsync();

            var item = items.FirstOrDefault();

            if (item != null)
            {
                await Table.DeleteAsync(item);
            }
        }
Esempio n. 23
0
        private async void findContainerOfUser()
        {
            IMobileServiceTableQuery <Container> query = containerTable.Where(Container => Container.Proprio == IdUser);

            Containers.Clear();

            IEnumerable <Container> items = await query.ToListAsync();

            items = items.OrderBy(c => c.Name);

            foreach (var item in items)
            {
                Containers.Add(item);
            }
        }
        private async void GetDetails()
        {
            IMobileServiceTableQuery <User> q = userTbl
                                                .Where(c => c.Customer_id == custId);

            List <User> users = await q.ToListAsync();

            foreach (var user in users)
            {
                tbFirstName.Text  = user.FirstName;
                tbSecondName.Text = user.SecondName;
                tbAddress.Text   += user.Address;
                tbCounty.Text     = user.County;
                tbEmail.Text      = user.Email;
                tbMobile.Text     = user.Mobile;
            }
        }
Esempio n. 25
0
        private async void comboBoxIdTecnicoEditar_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Cargar detalles del tecnico
            if (comboBoxIdTecnicoEditar.SelectedItem != null)
            {
                string idTecnico;
                object selectedItem = comboBoxIdTecnicoEditar.SelectedValue.ToString();
                idTecnico = selectedItem.ToString();
                try
                {
                    ProgressBarBefore();
                    IMobileServiceTableQuery <Usuario> query = UsuariosTable.Where(Tecnico => Tecnico.id == idTecnico);
                    var res = await query.ToListAsync();

                    var    item            = res.First();
                    string id              = item.id;
                    string nombre          = item.Nombre;
                    string appaterno       = item.APaterno;
                    string apmaterno       = item.AMaterno;
                    string fechaNacimiento = item.fechaNacimiento;
                    string correo          = item.correo;
                    string telefono        = item.telefono;
                    string direccion       = item.direccion;
                    string contrasena      = item.contrasena;
                    textBoxNombreUsuario.Text = id;
                    textBoxNombre.Text        = nombre;
                    textBoxAPatrno.Text       = appaterno;
                    textBoxAMaterno.Text      = apmaterno;
                    dpFechaNac.Date           = DateTime.Parse(fechaNacimiento);
                    //textBox.Text = fechaNacimiento.ToString();
                    textBoxCorreo.Text    = correo;
                    textBoxTelefono.Text  = telefono;
                    textBoxDireccion.Text = direccion;
                    passwordBox.Password  = contrasena;
                    ProgressBarAfter();
                }
                catch (MobileServiceInvalidOperationException ex)
                {
                    exception = ex;
                }
                if (exception != null)
                {
                    await new MessageDialog(exception.Message, "Error!").ShowAsync();
                }
            }
        }
Esempio n. 26
0
        public async Task GetdataAsync()
        {
            try
            {
                IMobileServiceTableQuery <string> query = DataTable
                                                          .Where(ur => ur.callerID == tempdata.Loginas)
                                                          .Select(ur => ur.pholdername);

                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 });
            }
        }
Esempio n. 27
0
        public async Task GetdataAsync()
        {
            try
            {
                IMobileServiceTableQuery <string> query = DataTable
                                                          .Where(ur => ur.ServiceProviderID == tempdata.Loginas)
                                                          .Select(ur => ur.WorkOrderSubject);

                List <string> items = await query.ToListAsync();

                workorders.ItemsSource = items;

                // finalname.Text = string.Format("{0}-{1}", items2[0].FirstName, items2[0].LastName);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Sync error: {0}", new[] { e.Message });
            }
        }
Esempio n. 28
0
        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);
                //----------------------------------------------------------------

                //get catagory
                IMobileServiceTable <UserReg> dt = client.GetTable <UserReg>();

                IMobileServiceTableQuery <UserReg> query4 = dt
                                                            .Where(ur => ur.Email == tempdata.Loginas);
                // .Select(ur => ur.QuotationSubject);

                List <UserReg> items23 = await query4.ToListAsync();

                string servicetype = items23[0].ServiceType;



                //end get cat

                IMobileServiceTableQuery <string> query2 = DataTable
                                                           .Where(ur => ur.ServiceProviderId == tempdata.received_quotationID && ur.servicetype == servicetype)
                                                           .Select(ur => ur.QuotationSubject);

                List <string> items2 = await query2.ToListAsync();

                RQuotationView.ItemsSource = items2;
            }
            catch (Exception e)
            {
                Debug.WriteLine("Sync error: {0}", new[] { e.Message });
            }
        }
Esempio n. 29
0
        public async Task <List <Transaction> > GetAllTransactions(string cardid, bool all = false)
        {
            if (string.IsNullOrEmpty(cardid))
            {
                return(new List <Transaction>());
            }

            await SyncAsync();

            IMobileServiceTableQuery <Transaction> query = all
                                ? _transTable.OrderByDescending(t => t.TransDate)
                                                           .ThenByDescending(t => t.InternalDifference)
                                                           .Where(t => t.CardID == cardid)
                                : _transTable.OrderByDescending(t => t.TransDate)
                                                           .ThenByDescending(t => t.InternalDifference)
                                                           .Where(t => t.CardID == cardid && t.Description != "Card Load" && !t.Description.StartsWith("Card Transfer"));

            return(await query.ToListAsync());
        }
Esempio n. 30
0
        private async void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //LoadChartContents();
            MobileServiceInvalidOperationException exception = null;
            string idDeshidratadora;
            object selectedItem = comboBox.SelectedValue.ToString();

            idDeshidratadora = selectedItem.ToString();
            try
            {
                ProgressBarBefore();
                DateTime date = DatePickerToChart.Date.DateTime;
                LoadChartContents(date);
                IMobileServiceTableQuery <Deshidratadora> query = DeshTable.Where(Desh => Desh.idDeshidratadora == idDeshidratadora);
                var res = await query.ToListAsync();

                falladesh = await FallaTableDesh
                            .Select(Falla => Falla)
                            .Where(Falla => Falla.idDeshidratadora == idDeshidratadora /*&& Falla.Fecha == date.ToString("yyyy-MM-dd") /*&& Falla.Atendido == "0"*/)
                            .ToCollectionAsync();


                string cantFallas = falladesh.Count().ToString();

                var    item   = res.First();
                string marca  = item.Marca;
                string modelo = item.Modelo;
                string sn     = item.No_Serie;
                textBlockMarca.Text        = marca;
                textBlockModelo.Text       = modelo;
                textBlockNoSerie.Text      = sn;
                textBlockTotalAlertas.Text = cantFallas;
                ProgressBarAfter();
            }
            catch (MobileServiceInvalidOperationException ex)
            {
                exception = ex;
            }
            if (exception != null)
            {
                await new MessageDialog(exception.Message, "Error!").ShowAsync();
            }
        }