WFA_psychometric_chart.Form_handler.AddOrUpdateNewRecord C# (CSharp) 메소드

AddOrUpdateNewRecord() 공개 메소드

public AddOrUpdateNewRecord ( string name, System.Windows.Forms.DataGridViewCellEventArgs e ) : void
name string
e System.Windows.Forms.DataGridViewCellEventArgs
리턴 void
        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);

            }
        }