private void fillGrid(string cond) { AgentEntity entity = null; if (_readOnly) { entity = _AgentBL.getOnlyActives(cond); } else { entity = _AgentBL.get(cond); } System.Collections.Hashtable hash = new Hashtable(); _gridTools.bindDataToGrid(dataGridView1, entity, null, hash); }
private void init() { if (_id > 0) { AgentEntity entity = null; entity = _AgentBL.get(_id); txtAgentName.Text = entity.get(AgentEntity.FIELD_Agent_NAME).ToString(); txtAgentCode.Text = entity.get(AgentEntity.FIELD_AGENTCODE).ToString(); txtTelephone.Text = entity.get(AgentEntity.FIELD_TELEPHONE).ToString(); txtMobile.Text = entity.get(AgentEntity.FIELD_MOBILE).ToString(); txtFax.Text = entity.get(AgentEntity.FIELD_FAX).ToString(); txtAddress.Text = entity.get(AgentEntity.FIELD_ADDRESS).ToString(); if (entity.get(AgentEntity.FIELD_ACTIVE) != null && entity.get(AgentEntity.FIELD_ACTIVE).ToString().Length > 0 && ((bool)entity.get(AgentEntity.FIELD_ACTIVE)) == false) { cmbActive.SelectedIndex = 1; } else { cmbActive.SelectedIndex = 0; } } else { if (_id == 0) { _readOnly = true; } cmbActive.SelectedIndex = 0; } if (_readOnly) { txtAgentName.Enabled = false; txtAgentCode.Enabled = false; txtTelephone.Enabled = false; txtMobile.Enabled = false; txtFax.Enabled = false; txtAddress.Enabled = false; cmbActive.Enabled = false; } }