private async void Button_Click_2(object sender, RoutedEventArgs e) { if (pOrderID.Text.Length > 0 && pSupplier.Text.Length > 0 && DateT.Text.Length > 0 && TimeT.Text.Length > 0 && endList.Items.Count > 0) { try { client = new FireSharp.FirebaseClient(config); pOrderFinal a = new pOrderFinal(); a.purchaseNumber = pOrderID.Text; a.supplierName = pSupplier.Text; a.date = DateT.Text; a.time = TimeT.Text; FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseReturn/Spinner/pending/count/"); int cnt; try { cnt = response2.ResultAs <int>(); } catch (Exception) { cnt = 0; } cnt++; FirebaseResponse firebaseResponse3 = await client.SetAsync("Purchase/PurchaseReturn/Spinner/pending/count/", cnt); FirebaseResponse firebaseResponse = await client.SetAsync("Purchase/PurchaseReturn/Spinner/pending/" + cnt, a.purchaseNumber); FirebaseResponse ab = await client.SetAsync("Purchase/PurchaseReturn/" + a.purchaseNumber + "/", a); foreach (Product1 temp in endList.Items) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.SetAsync("Purchase/PurchaseReturn/" + a.purchaseNumber + "/itemLayout/" + temp.SNo + "/", temp); FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseReturn/" + a.purchaseNumber + "/itemLayout/" + temp.SNo + "/count/", temp.SNo); } MessageDialog md = new MessageDialog("Purchase Return Successfully Added!"); await md.ShowAsync(); } 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("Purchase/PurchaseRegister/Spinner/finished/count"); int c; try { c = response.ResultAs <int>(); } catch { c = 0; } productIn result = new productIn(); List <string> numberList = new List <string>(); for (int i = 1; i <= c; i++) { FirebaseResponse response1 = await client.GetAsync("Purchase/PurchaseRegister/Spinner/finished/" + i + "/"); string ab = response1.ResultAs <string>(); pOrderFinal abc = new pOrderFinal(); FirebaseResponse response15 = await client.GetAsync("Purchase/PurchaseRegister/" + ab + "/"); abc = response15.ResultAs <pOrderFinal>(); result.sno = MyList.Items.Count + 1; result.purchaseid = ab; result.supplier = abc.supplierName; result.date = abc.date; result.time = abc.time; result.coilno = abc.coilNo; FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseRegister/" + ab + "/itemLayout/count/"); int count; try { count = response2.ResultAs <int>(); } catch { count = 0; } for (int i1 = 1; i1 <= count; i1++) { FirebaseResponse response3 = await client.GetAsync("Purchase/PurchaseRegister/" + ab + "/itemLayout/" + i1 + "/"); Product1 product1 = new Product1(); product1 = response3.ResultAs <Product1>(); productIn productIn = new productIn(); productIn.sno = result.sno; productIn.purchaseid = result.purchaseid; productIn.supplier = result.supplier; productIn.date = result.date; productIn.time = result.time; productIn.coilno = result.coilno; productIn.stripsize = product1.pName; productIn.quantity = product1.pQuantity; MyList.Items.Add(productIn); } if (MyList.Items.Count > 0) { progress1.Visibility = Visibility.Collapsed; pin.Visibility = Visibility.Visible; } } } catch (Exception) { MessageDialog error = new MessageDialog("Failed to connect to database!"); this.Frame.Navigate(typeof(BlankPage6)); } }
private async void Button_Click_2(object sender, RoutedEventArgs e) { if (pOrderID.Text.Length > 0 && pSupplier.Text.Length > 0 && DateT.Text.Length > 0 && TimeT.Text.Length > 0 && endList.Items.Count > 0 && endList2.Items.Count > 0) { try { client = new FireSharp.FirebaseClient(config); pOrderFinal a = new pOrderFinal(); a.purchaseNumber = pOrderID.Text; a.supplierName = pSupplier.Text; a.date = DateT.Text; a.time = TimeT.Text; a.coilNo = coilNo.Text; FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseRegister/count/"); int c; try { c = response2.ResultAs <int>(); } catch (Exception) { c = 0; } c++; FirebaseResponse response3 = await client.SetAsync("Purchase/PurchaseRegister/count/", c); FirebaseResponse ab = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/", a); foreach (Sales1 tempP in endList2.Items) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/salesLayout/" + tempP.SNo + "/", tempP); FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/salesLayout/" + tempP.SNo + "/count/", tempP.SNo); } foreach (Product1 temp in endList.Items) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/itemLayout/" + temp.SNo + "/", temp); FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/itemLayout/count/", temp.SNo); } FirebaseResponse response4 = await client.GetAsync("Master/Spinner/CoilNo/count/"); int abs; try { abs = response4.ResultAs <int>(); } catch (Exception) { abs = 0; } FirebaseResponse firebaseResponse3 = await client.SetAsync("Master/Spinner/CoilNO/" + ab + "/", coilNo.Text); FirebaseResponse response5 = await client.GetAsync("Purchase/PurchaseRegister/Spinner/finished/count/"); int ac; try { ac = response5.ResultAs <int>(); } catch (Exception) { ac = 0; } ac++; FirebaseResponse response6 = await client.SetAsync("Purchase/PurchaseRegister/Spinner/finished/count/", ac); FirebaseResponse firebaseResponse4 = await client.SetAsync("Purchase/PurchaseRegister/Spinner/finished" + ac + "/", a.purchaseNumber); MessageDialog md = new MessageDialog("Purchase Register Successfully Added!"); await md.ShowAsync(); } 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 Button_Click_2(object sender, RoutedEventArgs e) { if (pOrderID.Text.Length > 0 && pSupplier.Text.Length > 0 && DateT.Text.Length > 0 && TimeT.Text.Length > 0 && endList.Items.Count > 0 && endList2.Items.Count > 0) { try { client = new FireSharp.FirebaseClient(config); pOrderFinal a = new pOrderFinal(); a.purchaseNumber = pOrderID.Text; a.supplierName = pSupplier.Text; a.date = DateT.Text; a.time = TimeT.Text; FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseOrder/count/"); int c; try { c = response2.ResultAs <int>(); } catch (Exception) { c = 0; } c++; FirebaseResponse firebaseResponse1 = await client.GetAsync("Purchase/PurchaseOrder/Spinner/pending/count/"); int cnt; try { cnt = firebaseResponse1.ResultAs <int>(); } catch (Exception) { cnt = 0; } List <string> list2 = new List <string>(); for (int i = 1; i <= cnt; i++) { FirebaseResponse firebase = await client.GetAsync("Purchase/PurchaseOrder/Spinner/pending/"); string abv = firebase.ResultAs <string>(); list2.Add(abv); } int booll = 0; foreach (string y in list2) { if (y == a.purchaseNumber) { booll++; break; } } if (booll == 0) { cnt++; FirebaseResponse firebaseResponse3 = await client.SetAsync("Purchase/PurchaseOrder/Spinner/pending/count/", cnt); FirebaseResponse firebaseResponse = await client.SetAsync("Purchase/PurchaseOrder/Spinner/pending/" + cnt, a.purchaseNumber); FirebaseResponse response3 = await client.SetAsync("Purchase/PurchaseOrder/count/", c); FirebaseResponse ab = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/", a); foreach (Sales1 tempP in endList2.Items) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/salesLayout/" + tempP.SNo + "/", tempP); FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/salesLayout/count/", tempP.SNo); } foreach (Product1 temp in endList.Items) { client = new FireSharp.FirebaseClient(config); FirebaseResponse response = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/itemLayout/" + temp.SNo + "/", temp); FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/itemLayout/count/", temp.SNo); } MessageDialog md = new MessageDialog("SalesOrder Successfully Added!"); await md.ShowAsync(); } else if (booll > 0) { MessageDialog md = new MessageDialog("SalesOrder Already Raised"); await md.ShowAsync(); } } 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(); } }