예제 #1
0
파일: Home.cs 프로젝트: muzztafa/NMS_POS
        private void purchase_btn_Click(object sender, EventArgs e)
        {
            Purchasing p = new Purchasing();

            p.Show();
        }
예제 #2
0
        private async void createOrder_btn_Click(object sender, EventArgs e)
        {
            if (products_grid.Rows[0].Cells[0].Value == null)
            {
                MessageBox.Show("Please select a product first");
            }
            else
            {
                try
                {
                    Vendor_class v = vendorList[vendor_list.SelectedIndex];

                    List <Products_class> newList = new List <Products_class>();

                    newList = selectedProductsList.Concat(newProductList).ToList();

                    PurchaseOrder_class po = new PurchaseOrder_class
                    {
                        vendor      = v,
                        orderNo     = orderNo_editText.Text,
                        orderDate   = orderDate_editText.Text,
                        totalBill   = totalBill_label.Text,
                        productList = newList,
                        punchedBy   = Form1.loggedInUser.name
                    };

                    try
                    {
                        PushResponse response = await client.PushTaskAsync("purchases", po);

                        PurchaseOrder_class p2 = response.ResultAs <PurchaseOrder_class>();
                        for (int i = 0; i < newProductList.Count; i++)
                        {
                            PushResponse res = await client.PushTaskAsync("products", newProductList[i]);

                            Products_class pp = res.ResultAs <Products_class>();
                        }

                        for (int i = 0; i < selectedProductsListUPDATE.Count; i++)
                        {
                            FirebaseResponse response2 = await client.UpdateTaskAsync("products/" + keysUPDATE[i], selectedProductsListUPDATE[i]);

                            Products_class product = response2.ResultAs <Products_class>();
                        }
                    }

                    catch (Exception)
                    {
                        MessageBox.Show("Error connecting to FIREBASE. Please check your internet connection!");
                    }

                    MessageBox.Show("Order added successfully");

                    this.Hide();
                    Purchasing p = new Purchasing();
                    p.Show();
                }
                catch (Exception)
                {
                    MessageBox.Show("Please Select a vendor first!");
                }
            }
        }