Example #1
0
        private void ActualizarMascota()
        {
            string rpta = "";

            if (string.IsNullOrEmpty(txtCliente.Text))
            {
                txtCliente.Focus();
                epMascota.SetError(txtCliente, "Ingrese datos del cliente");
            }
            else if (string.IsNullOrEmpty(txtNombre.Text))
            {
                txtNombre.Focus();
                epMascota.Clear();
                epMascota.SetError(txtNombre, "Ingrese nombre de la mascota");
            }
            else if (string.IsNullOrEmpty(txtEdad.Text))
            {
                txtEdad.Focus();
                epMascota.Clear();
                epMascota.SetError(txtEdad, "Ingrese la edad de la mascota");
            }
            else if (string.IsNullOrEmpty(txtPeso.Text))
            {
                txtPeso.Focus();
                epMascota.Clear();
                epMascota.SetError(txtPeso, "Ingrese el peso de la mascota");
            }

            else if (string.IsNullOrEmpty(cboEspecie.Text))
            {
                cboEspecie.Focus();
                epMascota.Clear();
                epMascota.SetError(cboEspecie, "Indique la especie");
            }
            else if (string.IsNullOrEmpty(cboRaza.Text))
            {
                cboRaza.Focus();
                epMascota.Clear();
                epMascota.SetError(cboRaza, "Indique la raza");
            }
            else if (string.IsNullOrEmpty(cboSexo.Text))
            {
                cboSexo.Focus();
                epMascota.Clear();
                epMascota.SetError(cboSexo, "Indique el sexo de la mascota");
            }

            else
            {
                rpta = NMascota.ActualizarMascota(
                    _idMascota,
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(txtNombre.Text).Trim(),
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(txtEdad.Text).Trim(),
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(cboSexo.SelectedItem.ToString()).Trim(),
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(txtPeso.Text).Trim(),
                    txtDescripcion.Text.Trim(),
                    Convert.ToInt32(cboRaza.SelectedValue),
                    _idCliente,
                    ImageToByteArray(pbFoto.Image)
                    );
                if (rpta == "Ok")
                {
                    MessageBox.Show(rpta + "---Actualizado");
                    Limpiar();
                }
                else
                {
                    MessageBox.Show("error");
                }
            }
        }