public void AddOrUpdateNewRecord(string name, DataGridViewCellEventArgs e)
{
/*
//--We need to count the index of the current datagridview if the row index
is greater then the data in the list of data
*/
if(e.RowIndex+1 > listForDataFromDB.Count)
{
//insert the data...
string nameValue = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
insertNewDataFromDGV(nameValue);
}
else
{
//--Update the data
int id = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
string nameValue = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
UpdateNewDataFromDGV(nameValue, id);
}
}