private async void submit(object sender, RoutedEventArgs e) { if (fName.Text.Length > 0 && fProduct.Text.Length > 0 && fQName.Text.Length > 0 && fEQuantity.Text.Length > 0 && fProduct.Text.Length > 0 && faccepted.Text.Length > 0 && fScrap.Text.Length > 0 && fRework.Text.Length > 0 && fDate.Text.Length > 0 && fTime.Text.Length > 0) { try { dispatchQC qc = new dispatchQC(); qc.workordernumber = fName.Text; qc.productname = fProduct.Text; qc.qcname = fQName.Text; qc.equantity = Int32.Parse(fEQuantity.Text); qc.pquantity = Int32.Parse(fProduced.Text); qc.accepted = Int32.Parse(faccepted.Text); qc.rejected = Int32.Parse(fScrap.Text); qc.rework = Int32.Parse(fRework.Text); qc.date = fDate.Text; qc.time = fTime.Text; FirebaseResponse response2 = await client.GetAsync("Manufacturing/RouteCard/" + qc.workordernumber + "/salesid/"); qc.salesordernumber = response2.ResultAs <string>(); FirebaseResponse response = await client.SetAsync("DispatchQC/" + qc.workordernumber + "/", qc); } catch (Exception) { MessageDialog error = new MessageDialog("Failed to connect to database!"); this.Frame.Navigate(typeof(BlankPage6)); } } else { MessageDialog md = new MessageDialog("Check the inputs!"); await md.ShowAsync(); } }
private async void Page_Loader(object sender, RoutedEventArgs e) { try { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.GetAsync("DispatchQC/Spinner/Verified/count/"); int c; try { c = response.ResultAs <int>(); } catch (Exception) { c = 0; } for (int i = 1; i <= c; i++) { FinishedGoods finished = new FinishedGoods(); FirebaseResponse response1 = await client.GetAsync("DispatchQC/Spinner/Verified/" + i + "/"); string ab = response1.ResultAs <string>(); FirebaseResponse response2 = await client.GetAsync("DispatchQC/" + ab + "/"); dispatchQC a = new dispatchQC(); a = response2.ResultAs <dispatchQC>(); finished.sno = MyList.Items.Count + 1; finished.workid = a.workordernumber; finished.salesid = a.salesordernumber; finished.productname = a.productname; finished.eoutput = a.equantity; finished.produced = a.pquantity; finished.date = a.date; finished.time = a.time; MyList.Items.Add(finished); } if (MyList.Items.Count > 0) { progress1.Visibility = Visibility.Collapsed; fg.Visibility = Visibility.Visible; } } catch (Exception) { MessageDialog error = new MessageDialog("Failed to connect to database!"); this.Frame.Navigate(typeof(BlankPage6)); } }
private async void updateDetails(string cName) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response5 = await client.GetAsync("Sales/SalesOrder/" + fSales.Text + "/Layout/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("Sales/SalesOrder/" + fSales.Text + "/Layout/" + i); Product list1 = new Product(); list1 = response1.ResultAs <Product>(); string nameNw = list1.pName; if (nameNw == cName) { fEQuantity.Text = list1.pQuantity.ToString(); } } FirebaseResponse response = await client.GetAsync("DispatchQC/Spinner/Verified/count/"); int n; try { n = response.ResultAs <int>(); } catch (Exception) { n = 0; } int finished = 0; for (int i = 1; i <= n; i++) { FirebaseResponse response1 = await client.GetAsync("DispatchQC/Spinner/Verified/" + i + "/"); string a = response1.ResultAs <string>(); FirebaseResponse response2 = await client.GetAsync("DispatchQC/" + a + "/"); dispatchQC dispatch = new dispatchQC(); dispatch = response2.ResultAs <dispatchQC>(); string ab = fSales.Text; if (dispatch.salesordernumber == ab && dispatch.productname == cName) { finished = finished + dispatch.pquantity; } } fPQuantity.Text = finished.ToString(); if (fPQuantity.Text == fEQuantity.Text) { fStatus.Text = "Fully Completed"; } else if (finished < Int32.Parse(fEQuantity.Text)) { fStatus.Text = "Partially Completed"; } }