private void UpdateOrdersButton_OnClick(object sender, RoutedEventArgs e) { IList selectedOrders = OrdersDataGrid.SelectedItems; int ordersSize = selectedOrders.Count; for (var i = 0; i < ordersSize; i++) { DataRowView row = (DataRowView)OrdersDataGrid.SelectedItems[i]; int state = Convert.ToInt32(row["StareComanda"].ToString()); StareComanda orderState = getOrderState(state); string textId = row["Id"].ToString(); int id = Convert.ToInt32(textId); Comanda command = _client.FindOrderById(id); command.Descriere = row["Descriere"].ToString(); command.StareComanda = orderState; command.KmBord = Convert.ToInt32(row["KmBord"].ToString()); command.DataFinalizare = Convert.ToDateTime(row["DataFinalizare"].ToString()); command.DataProgramare = Convert.ToDateTime(row["DataProgramare"].ToString()); command.ValoarePiese = Convert.ToDecimal(row["ValoarePiese"].ToString()); _client.UpdateOrder(command); } OrdersTabItem_OnLoaded(sender, e); }
private void buttonUpdateOrders_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridViewDisplayOrders.SelectedRows) { int state = Convert.ToInt32(row.Cells[7].Value); StareComanda orderState = getOrderState(state); int id = Convert.ToInt32(row.Cells[0].Value); Comanda order = _carService.FindOrderById(id); order.DataProgramare = Convert.ToDateTime(row.Cells[2].Value); order.DataFinalizare = Convert.ToDateTime(row.Cells[3].Value); order.KmBord = Convert.ToInt32(row.Cells[4].Value); order.Descriere = row.Cells[5].Value.ToString(); order.ValoarePiese = Convert.ToDecimal(row.Cells[6].Value); order.StareComanda = orderState; _carService.UpdateOrder(order); } FormDisplayOrders_Load(sender, e); }
/// <inheritdoc /> /// <summary>Sets the stare comanda.</summary> /// <param name="id">The identifier.</param> /// <param name="stareComanda">The stare comanda.</param> public void SetStareComanda(int id, StareComanda stareComanda) { _context.Comenzi.First(c => c.ComandaId == id).StareComanda = stareComanda; }
/// <inheritdoc /> /// <summary> /// Sets the comanda status. /// </summary> /// <param name="comandaId">The comanda identifier.</param> /// <param name="stareComanda">The stare comanda.</param> /// <param name="descriere">The descriere.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> /// <exception cref="NotImplementedException"></exception> public bool SetComandaStatus(int comandaId, StareComanda stareComanda, string descriere) { throw new NotImplementedException(); }