Esempio n. 1
0
 public void SetParameters(bool New, Order order)
 {
     if (New)
     {
         textBoxStatus.Text = "Open";
     }
     else
     {
         string    orderStatus;
         Customer  customer  = new Customer();
         Warehouse warehouse = new Warehouse();
         customer                = customerRepositoryBus.GetCustomerById(order.CustomerId);
         warehouse               = warehouseRepositoryBus.GetWarehouseById(order.WarehouseId);
         labelOrderName.Text    += " " + order.Id;
         textBoxOrderId.Text     = order.Id.ToString();
         textBoxDescription.Text = order.Description;
         textBoxTotalAmount.Text = Convert.ToString(order.TotalAmount);
         if (order.Status == 1)
         {
             orderStatus = "Open";
         }
         else
         {
             orderStatus = "Posted";
         }
         textBoxStatus.Text             = orderStatus;
         comboBoxCustomer.SelectedItem  = customer.Name;
         comboBoxWarehause.SelectedItem = warehouse.Name;
     }
 }
Esempio n. 2
0
 private void buttonOpen_Click(object sender, EventArgs e)
 {
     if (warehouseTable.SelectedRows.Count > 0)
     {
         int       id        = Convert.ToInt32(warehouseTable.SelectedRows[0].Cells["Id"].Value.ToString());
         Warehouse warehouse = new Warehouse();
         warehouse = warehouseRepository.GetWarehouseById(id);
         WarehouseCard warehouseCard = new WarehouseCard(warehouse);
         warehouseCard.SetParameters(false, warehouse);
         warehouseCard.ShowDialog();
         InsertDataIntoTable();
     }
 }
Esempio n. 3
0
        private void InsertDataIntoTable()
        {
            string    orderStatus = "";
            Customer  customer    = new Customer();
            Warehouse warehouse   = new Warehouse();

            ordersTable.Rows.Clear();

            List <Order> orderList = new List <Order>();

            orderList = orderRepositoryBus.GetAllOrders();
            foreach (var order in orderList)
            {
                switch (finishedOrder)
                {
                case true:
                    if (order.Status == 1)
                    {
                        continue;
                    }
                    orderStatus = "Posted";
                    break;

                case false:
                    if (order.Status != 1)
                    {
                        continue;
                    }
                    orderStatus = "Open";
                    break;

                default:
                    break;
                }

                customer  = customerRepositoryBus.GetCustomerById(order.CustomerId);
                warehouse = warehouseRepositoryBus.GetWarehouseById(order.WarehouseId);

                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(ordersTable);
                row.Cells[0].Value = order.Id;
                row.Cells[1].Value = order.Description;
                row.Cells[2].Value = customer.Name;
                row.Cells[3].Value = order.OrderDate;
                row.Cells[4].Value = order.TotalAmount;
                row.Cells[5].Value = orderStatus;
                row.Cells[6].Value = warehouse.Name;
                ordersTable.Rows.Add(row);
            }
        }