Exemplo n.º 1
0
 private void InitializeAllData()
 {
     listOrder = OrderLAO.GetAllOrders();
     dataGridView1.DataSource = null;
     dataGridView1.DataSource = listOrder;
     but_GetCustomer.Enabled  = false;
     cb_cusId.Visible         = false;
     cb_cusId.Enabled         = false;
     btn_add.Enabled          = false;
     btn_delete.Enabled       = false;
     e_custName.Enabled       = false;
     e_custName.ReadOnly      = true;
     o_number.Enabled         = false;
     listProduct = ProductsLAO.GetAllProducts();
 }
Exemplo n.º 2
0
        public frmOrderQuery()
        {
            InitializeComponent();


            listOrder = OrderLAO.GetAllOrders();
            if (listOrder.Count > 0)
            {
                string[] orderIdList = new string[listOrder.Count];
                for (int i = 0; i < listOrder.Count; i++)
                {
                    orderIdList[i] = ((Order)listOrder[i]).OrderId.ToString();
                }
                this.cbx_id.Items.AddRange(orderIdList);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Save an order
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (prod_qnt.Text == string.Empty)
     {
         MessageBox.Show("Empty quantity", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (o_emp.Text == string.Empty)
     {
         MessageBox.Show("Empty Employee id", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (currentStatus == FormStatus.adding)
         {
             currentStatus       = FormStatus.nonstatus;
             cb_cusId.Enabled    = false;
             cb_cusId.Visible    = false;
             btn_add.Enabled     = false;
             btn_delete.Enabled  = false;
             e_custName.Enabled  = false;
             e_custName.ReadOnly = true;
             o_number.Enabled    = false;
             OrderLAO.CreateNewOrder(GenerateOrder(), GenerateOrderLine());
             e_custName.Text = string.Empty;
             e_cust.Text     = string.Empty;
             cb_cusId.Text   = string.Empty;
             setAddressEnable(false);
             listOrder = OrderLAO.GetAllOrders();
         }
         if (currentStatus == FormStatus.editing)
         {
             OrderLAO.UpdateOrderStatus(o_status.SelectedIndex, Int32.Parse(o_number.Text));
             listOrder = OrderLAO.GetAllOrders();
         }
         dataGridView1.DataSource = null;
         dataGridView1.DataSource = listOrder;
         listcostomer.Clear();
     }
 }