private void txtRetrieveByName_TextChanged(object sender, EventArgs e) { if (txtRetrieveByName.Text == "") { LoadDataGrid(); CleanFields(); } else { try { dgvArea.Rows.Clear(); ObjArea.Area_name = txtRetrieveByName.Text; var ListArea = ApiAccess.RetrieveAllByNameArea <Area>(ObjArea); foreach (Area element in ListArea) { string[] RowArea; RowArea = new string[] { element.ID_Area.ToString(), element.Name_Dpt, element.Area_name }; dgvArea.Rows.Add(RowArea); } } catch (Exception) { throw; } } }
private bool Checkname(string pAreaName) { try { bool finded = false; ObjArea.Area_name = pAreaName; var ListArea = ApiAccess.RetrieveAllByNameArea <Area>(ObjArea); foreach (Area element in ListArea) { if (element.Area_name == pAreaName) { finded = true; if (finded == true) { break; } } } return(finded); } catch (Exception) { throw; } }