예제 #1
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                WorkOrderNo n = new WorkOrderNo();
                DateTime    sysdt;
                sysdt = DateTime.Now;
                string Date = sysdt.ToString("dd/MM/yyyy");
                fDate.Text = Date;
                string Time1 = sysdt.ToString("hh:mm tt");
                fTime.Text = Time1;
                // AutoSuggestion for Popup Name
                FirebaseResponse response = await client.GetAsync("Manufacturing/Spinner/pending/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("Manufacturing/Spinner/pending/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems = new string[cnt];
                Autoitems = nameLt.ToArray();

                if (nameLt.Count == count)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    wo.Visibility        = Visibility.Visible;
                }
            }
            catch
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
예제 #2
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                WorkOrderNo n = new WorkOrderNo();
                DateTime    sysdt;
                sysdt = DateTime.Now;
                string Date = sysdt.ToString("dd/MM/yyyy");
                fDate.Text = Date;
                string Time1 = sysdt.ToString("hh:mm tt");
                fTime.Text = Time1;
                // AutoSuggestion for Popup Name
                FirebaseResponse response = await client.GetAsync("Master/Spinner/CoilNo/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("Master/Spinner/CoilNo/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems = new string[cnt];
                Autoitems = nameLt.ToArray();
                FirebaseResponse response2 = await client.GetAsync("Spinner/StripSize/count/");

                int count2;
                try
                {
                    count2 = response2.ResultAs <int>();
                }
                catch (Exception)
                {
                    count2 = 0;
                }
                List <String> nameLt2 = new List <String>();
                for (int i = 1; i <= count2; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/StripSize/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt2.Add(nameNw);
                }
                int cnt2 = nameLt2.Count;
                productList1 = new string[cnt2];
                productList1 = nameLt2.ToArray();

                FirebaseResponse response3 = await client.GetAsync("Sales/SalesOrder/Spinner/Verified/count/");

                int count3;
                try
                {
                    count3 = response3.ResultAs <int>();
                }
                catch (Exception)
                {
                    count3 = 0;
                }
                List <String> nameLt3 = new List <String>();
                for (int i = 1; i <= count3; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Sales/SalesOrder/Spinner/Verified/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt3.Add(nameNw);
                }
                int cnt3 = nameLt.Count;
                sID = new string[cnt3];
                sID = nameLt3.ToArray();

                FirebaseResponse response4 = await client.GetAsync("Spinner/Product/count/");

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

                    string nameNw = response1.ResultAs <string>();
                    nameLt4.Add(nameNw);
                }
                int cnt4 = nameLt4.Count;
                prodName = new string[cnt4];
                prodName = nameLt4.ToArray();

                FirebaseResponse response5 = await client.GetAsync("Spinner/Employee/count/");

                int count5;
                try
                {
                    count5 = response5.ResultAs <int>();
                }
                catch (Exception)
                {
                    count5 = 0;
                }
                List <String> nameLt5 = new List <String>();
                for (int i = 1; i <= count5; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/Employee/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt5.Add(nameNw);
                }
                int cnt5 = nameLt5.Count;
                empList = new string[cnt5];
                empList = nameLt5.ToArray();



                FirebaseResponse response6 = await client.GetAsync("Spinner/MachineId/count/");

                int count6;
                try
                {
                    count6 = response6.ResultAs <int>();
                }
                catch (Exception)
                {
                    count6 = 0;
                }
                List <String> nameLt6 = new List <String>();
                for (int i = 1; i <= count6; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/MachineId/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt6.Add(nameNw);
                }
                int cnt6 = nameLt6.Count;
                machineList = new string[cnt6];
                machineList = nameLt6.ToArray();

                FirebaseResponse response7 = await client.GetAsync("Spinner/Tools/count/");

                int count7;
                try
                {
                    count7 = response7.ResultAs <int>();
                }
                catch (Exception)
                {
                    count7 = 0;
                }
                List <String> nameLt7 = new List <String>();
                for (int i = 1; i <= count7; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/Tools/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt7.Add(nameNw);
                }
                int cnt7 = nameLt7.Count;
                toolList = new string[cnt7];
                toolList = nameLt7.ToArray();
                if (nameLt7.Count == count7)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    rc.Visibility        = Visibility.Visible;
                }

                string           av      = n.PurchaseID;
                int              inc     = 0;
                FirebaseResponse respons = await client.GetAsync("Manufacturing/RouteCard/count/");

                try
                {
                    inc = respons.ResultAs <int>();
                }
                catch (Exception)
                {
                    inc = 0;
                }
                inc++;
                av            = av + inc.ToString("00");
                fOrderNo.Text = av;
            }
            catch
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }