private void saveCraft() { if (gvcraft.DataRowCount > 0) { gvcraft.CloseEditor(); gvcraft.UpdateCurrentRow(); var ds = (List <T_Crafts>) this.gvcraft.DataSource; foreach (var craft in ds) { if (craft.id == 0) { m_client.AddNewCraft(craft); } else { m_client.UpdateCraft(craft); } } } }