private void ChangeButton_Click(object sender, EventArgs e) { int row = RowIndex; IntercityCallModel model = new IntercityCallModel( IntercityDataView.Rows[row].Cells[1].Value.ToString(), IntercityDataView.Rows[row].Cells[2].Value.ToString(), DateTime.Parse(IntercityDataView.Rows[row].Cells[3].Value.ToString()), int.Parse(IntercityDataView.Rows[row].Cells[5].Value.ToString()), double.Parse(IntercityDataView.Rows[row].Cells[6].Value.ToString()) ); var elements = reqester.GetReqest(); int ID = 0; foreach (IntercityCallModel element in elements) { if (element.Phone.Equals(model.Phone) || element.Surname.Equals(model.Surname) || element.Price.Equals(model.Price) || element.Duration.Equals(model.Duration) ) { ID = element.ID; } } model = new IntercityCallModel(int.Parse(IntercityDataView.Rows[row].Cells[0].Value.ToString()), //id IntercityDataView.Rows[row].Cells[1].Value.ToString(), //sur IntercityDataView.Rows[row].Cells[2].Value.ToString(), //phone DateTime.Parse(IntercityDataView.Rows[row].Cells[3].Value.ToString()), //date int.Parse(IntercityDataView.Rows[row].Cells[5].Value.ToString()), //dur double.Parse(IntercityDataView.Rows[row].Cells[6].Value.ToString()) //cost ); reqester.UpdateReqest(model); UpdateAllView(); }
private void EventView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { EventModel model = new EventModel((int)EventView.CurrentRow.Cells[0].Value, (string)EventView.CurrentCell.Value); reqester.setUpdateRequest(new UpdateEventText()); reqester.UpdateReqest(model); UpdateTable(); }