private void button_Click(object sender, EventArgs e) { try { string selecionado = dataGridUnexecuted.SelectedCells[0].Value.ToString(); int id = Int32.Parse(selecionado); Order tempOrder = new Order(); tempOrder.Id = id; tempOrder.Client_id = Int32.Parse(dataGridUnexecuted.SelectedCells[1].Value.ToString()); DateTime dt; DateTime.TryParse(dataGridUnexecuted.SelectedCells[2].Value.ToString(), out dt); tempOrder.Creation_date = dt; tempOrder.Quantity = Int32.Parse(dataGridUnexecuted.SelectedCells[3].Value.ToString()); tempOrder.State = dataGridUnexecuted.SelectedCells[4].Value.ToString(); tempOrder.Type = dataGridUnexecuted.SelectedCells[5].Value.ToString(); tempOrder.Value = Int32.Parse(dataGridUnexecuted.SelectedCells[6].Value.ToString()); tempOrder.Execution_date = DateTime.Now; todaysExecutedOrders.Add(tempOrder); bankAProxy.updateStock(id); ordersToExecute.RemoveAt(dataGridUnexecuted.SelectedCells[0].RowIndex); updateUnexecutedOrders(); updateExecutedOrders(); Cliente client = bankAProxy.getClient(tempOrder.Client_id); sendEmail(client, tempOrder.Quantity, tempOrder.Value, tempOrder.Type); save(); } catch (Exception exc) { Console.WriteLine("Exception: " + exc.Message); MessageBox.Show("Nenhum Item selecionado", "Alerta"); } }
private void atualizaLista(List <Order> orders) { try { ordersList.Rows.Clear(); foreach (Order ped in orders) { Company c = bankAProxy.getCompany(ped.Company_id); Cliente cl = bankAProxy.getClient(ped.Client_id); string[] temp = { ped.Id.ToString(), c.Name, cl.Name, ped.Creation_date.ToString(), ped.Quantity.ToString(), ped.State, ped.Type, ped.Value.ToString() }; ordersList.Rows.Add(temp); } } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } }