Ejemplo n.º 1
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            // Declaring Firebase
            try
            {
                IFirebaseConfig config = new FirebaseConfig
                {
                    AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                    BasePath   = "https://weldonetechnocrats.firebaseio.com/"
                };
                IFirebaseClient  client = new FireSharp.FirebaseClient(config);
                int              i      = 1;
                FirebaseResponse response;
                while (true)
                {
                    response = await client.GetAsync("Sales/SalesOrder/Spinner/Pending/" + i + "/");

                    string str = response.ResultAs <string>();
                    if (str != null)
                    {
                        pSOrder.Add(str);
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                rSOrderT.ItemsSource = pSOrder;
                // AutoSuggestion for Popup Name
                response = await client.GetAsync("Spinner/Product/count");

                int count1;
                try
                {
                    count1 = response.ResultAs <int>();
                }
                catch (Exception)
                {
                    count1 = 0;
                }
                SalesOrderID  n      = new SalesOrderID();
                List <String> nameLt = new List <String>();
                for (i = 1; i <= count1; i++)
                {
                    response = await client.GetAsync("Spinner/Product/" + i + "/");

                    string nameNw = response.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems = new string[cnt];
                Autoitems = nameLt.ToArray();
                if (nameLt.Count == count1)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    sr.Visibility        = Visibility.Visible;
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Ejemplo n.º 2
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                SalesOrderID n = new SalesOrderID();
                client = new FireSharp.FirebaseClient(config);
                DateTime sysdt;
                sysdt = DateTime.Now;
                string Date = sysdt.ToString("dd/MM/yyyy");
                DateT.Text = Date;
                string Time1 = sysdt.ToString("hh:mm tt");
                TimeT.Text = Time1;
                // AutoSuggestion for Popup Name
                FirebaseResponse response = await client.GetAsync("Spinner/Product/count");

                int count;
                try
                {
                    count = response.ResultAs <int>();
                }
                catch (Exception)
                {
                    count = 0;
                }
                List <String> nameLt = new List <String>();
                for (int i = 1; i <= count; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/Product/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems   = new string[cnt];
                Autoitems   = nameLt.ToArray();
                orderT.Text = n.saleID;
                // AutoSuggestion for Client Name
                response = await client.GetAsync("Master/Spinner/Client/count");

                count = response.ResultAs <int>();
                List <String> cnameLt = new List <String>();
                for (int i = 1; i <= count; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Master/Spinner/Client/" + i);

                    string nameNw = response1.ResultAs <string>();
                    cnameLt.Add(nameNw);
                }
                cnt       = cnameLt.Count;
                cNameitem = new string[cnt];
                cNameitem = cnameLt.ToArray();
                cNameT.IsHitTestVisible = true;
                if (cnameLt.Count == count)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    so.Visibility        = Visibility.Visible;
                }
            }

            catch (FireSharp.Exceptions.FirebaseException)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }