private void IBtnCreate_Click(object sender, EventArgs e) { if (IBtnCreate.Text.Equals("Crear")) { if (ValidateFields()) { if (!serviceLog.Read_once_exist(txtCode.Text)) { Service service = new Service(txtCode.Text, txtActivity.Text, nupDuration.Value.ToString(), txtCost.Text, char.Parse(cboType.Text)); CleanFields(); serviceLog.Create(service); IbtnRefresh_Click(null, e); } else { MessageBox.Show("El servicio ya existe en el sistema", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else if (IBtnCreate.Text.Equals("Guardar")) { if (ValidateFields()) { Service service = new Service(txtCode.Text, txtActivity.Text, nupDuration.Value.ToString(), txtCost.Text, char.Parse(cboType.Text)); CleanFields(); serviceLog.Update(service); IbtnRefresh_Click(null, e); txtCode.Enabled = true; txtCode.Focus(); IBtnCreate.Text = "Crear"; } } }