Esempio n. 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string resp = "";

                if (txtplan.Text == string.Empty && cbldEspecialidad.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, seran remarcados");
                    errorIcono.SetError(txtplan, "Ingrese un valor");
                    errorIcono.SetError(cbldEspecialidad, "Ingrese un valor");
                }
                else
                {
                    if (this.Isnuevo)
                    {
                        resp = PlanLogic.Insertar(txtplan.Text.Trim().ToUpper(), Convert.ToInt32(cbldEspecialidad.SelectedValue));
                    }
                    else
                    {
                        resp = PlanLogic.Editar(Convert.ToInt32(txtidplan.Text), this.txtplan.Text.Trim().ToUpper(), Convert.ToInt32(cbldEspecialidad.SelectedValue));
                    }
                    if (resp.Equals("OK"))
                    {
                        if (this.Isnuevo)
                        {
                            this.MensajeOk("Se Inserto de forma correcto el registro");
                        }
                        else
                        {
                            this.MensajeOk("Se Actualizo de forma correcto el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(resp);
                    }
                    this.Isnuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Listar();


                    //DataGridTextBoxColumn row = dataListado.Columns[2];
                    //r = 80;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }