Beispiel #1
0
        private void CbProduct_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            productSelected       = cbProduct.SelectedItem as Product;
            updownQuatity.Maximum = productSelected.remaining;
            if (updownQuatity.Value > updownQuatity.Maximum)
            {
                updownQuatity.Value = updownQuatity.Maximum;
            }
//            DataRowView selected = cbProduct.SelectedItem as DataRowView;
//            updownQuatity.Maximum = (int)selected.Row.ItemArray[5];
//            if (updownQuatity.Value > updownQuatity.Maximum)
//            {
//                updownQuatity.Value = updownQuatity.Maximum;
//            }
        }
Beispiel #2
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
//            DataRowView selected = cbProduct.SelectedItem as DataRowView;
            productSelected = cbProduct.SelectedItem as Product;
            quantity        = (int)updownQuatity.Value;

            var statusCode = Database.AddToCart(productSelected.id, quantity);

            if (statusCode == HttpStatusCode.OK)
            {
                this.Close();
            }
            else if (statusCode == (HttpStatusCode)422)
            {
                MessageBox.Show("Invalid input");
            }
        }