private void barcodeimeiTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter && barcodeimeiTextBox.Text != "")
            {
                stockHistoryDG.Items.Clear();
                salesHistoryDG.Items.Clear();
                try
                {
                    //for stock datagrid
                    Barcode bar     = ProductTableData.getBarcode(barcodeimeiTextBox.Text);
                    Product product = bar.Product;

                    stockHistoryDG.Items.Add(product);

                    //for sales datagrid
                    Gift gif = bar.Gift;
                    if (gif != null)
                    {
                        Customer_Sale cus_sale = gif.Customer_Sale;

                        SalesHistoryDataGrid salesHis = new SalesHistoryDataGrid(cus_sale, gif.Barcode);
                        salesHistoryDG.Items.Add(salesHis);
                    }
                }
                catch (Exception ex)
                {
                    Xceed.Wpf.Toolkit.MessageBox.Show("No product found. Press 'OK' to exit.\n\nDetailed Error:" + ex.Message, "Empty Product", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
 public SalesHistoryDataGrid(Customer_Sale cus_sale, string imei)
 {
     Customer_Sale_ID = cus_sale.ID;
     Product_ID       = (int)cus_sale.Product_ID;
     Invoice_ID       = (int)cus_sale.Invoice_ID;
     Quantity         = (int)cus_sale.Quantity;
     Unit_Price       = (int)cus_sale.Unit_Price;
     Sold_Price       = (int)cus_sale.Sold_Price;
     Customer_ID      = (int)cus_sale.Sale.Customer_ID;
     Name             = cus_sale.Sale.Customer.Name;
     Phone2           = (int)cus_sale.Sale.Customer.Phone2;
     IMEI             = imei;
     Date             = (DateTime)cus_sale.Sale.Date;
 }