Ejemplo n.º 1
0
        public SuppliesUC()
        {
            InitializeComponent();

            List <TradePoint> tradePointsList = TradePointsController.GetInstance().GetTradePoints();

            tradePointsList.Sort((x, y) => x.FullName.CompareTo(y.FullName));
            TradePoints = new ObservableCollection <TradePoint>(tradePointsList);

            Binding bind1 = new Binding();

            bind1.Source = TradePoints;
            TradePointComboBox.DisplayMemberPath = "FullName";
            TradePointComboBox.SetBinding(ComboBox.ItemsSourceProperty, bind1);
            TradePoint = TradePoints.FirstOrDefault();
            TradePointComboBox.SelectedItem = TradePoint;

            List <Product> productsList = ProductsController.GetInstance().GetProducts();

            Products = new ObservableCollection <Product>(productsList);

            Binding bind2 = new Binding();

            bind2.Source = Products;
            ProductComboBox.DisplayMemberPath = "Name";
            ProductComboBox.SetBinding(ComboBox.ItemsSourceProperty, bind2);
            Product = Products.FirstOrDefault();
            ProductComboBox.SelectedItem = Product;

            List <Supplier> suppliersList = SuppliersController.GetInstance().GetSuppliers();

            Suppliers = new ObservableCollection <Supplier>(suppliersList);

            Binding bind3 = new Binding();

            bind3.Source = Suppliers;
            SupplierComboBox.DisplayMemberPath = "Name";
            SupplierComboBox.SetBinding(ComboBox.ItemsSourceProperty, bind3);
            Supplier = Suppliers.FirstOrDefault();
            SupplierComboBox.SelectedItem = Supplier;

            List <Order> ordersList = OrdersController.GetInstance().GetOrders();

            Orders = new ObservableCollection <Order>(ordersList);

            Binding bind4 = new Binding();

            bind4.Source = Orders;
            OrderComboBox.DisplayMemberPath = "Id";
            OrderComboBox.SetBinding(ComboBox.ItemsSourceProperty, bind4);
            Order = Orders.FirstOrDefault();
            OrderComboBox.SelectedItem = Order;
        }
Ejemplo n.º 2
0
        private void ClearShipmentandgridsinfo()
        {
            SupplierComboBox.SelectedIndex     = -1;
            ShippingModeComboBox.SelectedIndex = -1;
            ShipmentOrderNoTextBox.Clear();

            SupplierComboBox.ResetText();
            ShippingModeComboBox.ResetText();

            textBox1.Clear();
            textBox2.Clear();

            listView1.Items.Clear();
            dataGridView1.Rows.Clear();
            dataGridView1.Refresh();
        }
Ejemplo n.º 3
0
        private void ClearShipmentandgridsinfo()
        {
            SupplierComboBox.SelectedIndex = -1;

            //ShipmentOrderNoTextBox.Clear();

            SupplierComboBox.ResetText();

            comboBox1.SelectedIndex = -1;
            comboBox1.ResetText();
            listView1.Items.Clear();
            dataGridView1.Rows.Clear();
            dataGridView1.Refresh();
            SupplierComboBox.Items.Clear();
            comboBox1.Items.Clear();
            Deliveryorder();
            LoadGetpasses();
        }
Ejemplo n.º 4
0
        private void AddDataItemDetails_Click(object sender, RoutedEventArgs e)
        {
            ItemDetailController CallItem = new ItemDetailController();

            //var combo = CategoryComboBox.SelectedValue.ToString();
            //MessageBox.Show(CategoryComboBox.Text);
            if (SerialNumberTextBox.Text.Length == 0 && ItemConditionTextBox.Text.Length == 0 && ItemComboBox.Text == "" && SupplierComboBox.Text == "")
            {
                ItemNameErrorMessage.Text      = "Item Name Can't Be Empty!";
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                SerialNumberErrorMessage.Text  = "Item Serial Number Can't Be Empty!";
                SupplierErrorMessage.Text      = "Supplier Can't Be Empty!";
                ItemComboBox.Focus();
                SupplierComboBox.Focus();
                SerialNumberTextBox.Focus();
                ItemConditionTextBox.Focus();
            }
            else if (ItemConditionTextBox.Text.Length == 0 && ItemComboBox.Text == "" && SupplierComboBox.Text == "")
            {
                ItemNameErrorMessage.Text      = "Item Name Can't Be Empty!";
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                SupplierErrorMessage.Text      = "Supplier Can't Be Empty!";
                ItemComboBox.Focus();
                SupplierComboBox.Focus();
                ItemConditionTextBox.Focus();
            }
            else if (SerialNumberTextBox.Text.Length == 0 && ItemComboBox.Text == "" && SupplierComboBox.Text == "")
            {
                ItemNameErrorMessage.Text     = "Item Name Can't Be Empty!";
                SerialNumberErrorMessage.Text = "Item Serial Number Can't Be Empty!";
                SupplierErrorMessage.Text     = "Supplier Can't Be Empty!";
                ItemComboBox.Focus();
                SupplierComboBox.Focus();
                SerialNumberTextBox.Focus();
            }
            else if (SerialNumberTextBox.Text.Length == 0 && ItemConditionTextBox.Text.Length == 0 && SupplierComboBox.Text == "")
            {
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                SerialNumberErrorMessage.Text  = "Item Serial Number Can't Be Empty!";
                SupplierErrorMessage.Text      = "Supplier Can't Be Empty!";
                SupplierComboBox.Focus();
                SerialNumberTextBox.Focus();
                ItemConditionTextBox.Focus();
            }
            else if (SerialNumberTextBox.Text.Length == 0 && ItemConditionTextBox.Text.Length == 0 && ItemComboBox.Text == "")
            {
                ItemNameErrorMessage.Text      = "Item Name Can't Be Empty!";
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                SerialNumberErrorMessage.Text  = "Item Serial Number Can't Be Empty!";
                ItemComboBox.Focus();
                SerialNumberTextBox.Focus();
                ItemConditionTextBox.Focus();
            }
            ///////
            else if (SerialNumberTextBox.Text.Length == 0 && ItemConditionTextBox.Text.Length == 0)
            {
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                SerialNumberErrorMessage.Text  = "Item Serial Number Can't Be Empty!";
                SerialNumberTextBox.Focus();
                ItemConditionTextBox.Focus();
            }
            else if (SerialNumberTextBox.Text.Length == 0 && ItemComboBox.Text == "")
            {
                ItemNameErrorMessage.Text     = "Item Name Can't Be Empty!";
                SerialNumberErrorMessage.Text = "Item Serial Number Can't Be Empty!";
                SerialNumberTextBox.Focus();
                ItemComboBox.Focus();
            }
            else if (SerialNumberTextBox.Text.Length == 0 && SupplierComboBox.Text == "")
            {
                SupplierErrorMessage.Text     = "Supplier Can't Be Empty!";
                SerialNumberErrorMessage.Text = "Item Serial Number Can't Be Empty!";
                SerialNumberTextBox.Focus();
                SupplierComboBox.Focus();
            }
            ///////
            else if (ItemConditionTextBox.Text.Length == 0 && SupplierComboBox.Text == "")
            {
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                SupplierErrorMessage.Text      = "Supplier Can't Be Empty!";
                SerialNumberTextBox.Focus();
                SupplierComboBox.Focus();
            }
            else if (ItemConditionTextBox.Text.Length == 0 && ItemComboBox.Text == "")
            {
                ItemNameErrorMessage.Text      = "Item Name Can't Be Empty!";
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                ItemConditionTextBox.Focus();
                ItemComboBox.Focus();
            }
            ///////
            else if (ItemComboBox.Text == "" && SupplierComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                SupplierErrorMessage.Text = "Supplier Can't Be Empty!";
                ItemComboBox.Focus();
                SupplierComboBox.Focus();
            }
            ///////
            else if (ItemComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                ItemComboBox.Focus();
            }
            else if (SupplierComboBox.Text == "")
            {
                SupplierErrorMessage.Text = "Supplier Can't Be Empty!";
                SupplierComboBox.Focus();
            }
            else if (ItemConditionTextBox.Text.Length == 0)
            {
                ItemConditionErrorMessage.Text = "Item Quantity Can't Be Empty!";
                ItemConditionTextBox.Focus();
            }
            else if (SerialNumberTextBox.Text.Length == 0)
            {
                SerialNumberErrorMessage.Text = "Item Serial Number Can't Be Empty!";
                SerialNumberTextBox.Focus();
            }
            else
            {
                string Snumber    = SerialNumberTextBox.Text;
                string Scondition = ItemConditionTextBox.Text;
                int    Iitem      = Convert.ToInt32(ItemComboBox.SelectedValue.ToString());
                int    Isup       = Convert.ToInt32(SupplierComboBox.SelectedValue.ToString());

                var result = CallItem.AddItem(Snumber, Scondition, Iitem, Isup);

                if (result == true)
                {
                    MessageBox.Show("Add Data Item Detail Successful!");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Add Data Item Detail Failed!");
                }
            }
        }