コード例 #1
0
        public bool DatosValidos()
        {
            _errorProvider.Clear();
            FormatearGrados(_txtLatitudGrados);
            FormatearGrados(_txtLongitudGrados);
            bool res = true;


            if (_txtAltitud.ValorInt < 0)
            {
                res = false;
                _errorProvider.SetError(_txtAltitud, MessageMgr.Instance.GetMessage("INGRESE_NUM_POSITIVO"));
            }


            if (!_rbtGrados.Checked && !_rbtUTM.Checked)
            {
                res = false;
                _errorProvider.SetError(_gbxUnidadMedida, "Debe registrar los datos de longitud y latitud.");
            }

            if (_rbtGrados.Checked)
            {
                if (!AyudanteGrados.MinutosSegundosValidos(_txtLongitudGrados.Text))
                {
                    res = false;
                    _errorProvider.SetError(_txtLongitudGrados, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                }

                if (!AyudanteGrados.MinutosSegundosValidos(_txtLatitudGrados.Text))
                {
                    res = false;
                    _errorProvider.SetError(_txtLatitudGrados, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                }
            }
            else
            {
                if (_txtLatitudUTM.ValDouble < 0)
                {
                    res = false;
                    _errorProvider.SetError(_txtLatitudUTM, MessageMgr.Instance.GetMessage("INGRESE_NUM_POSITIVO"));
                }

                if (_txtLongitudUTM.ValDouble < 0)
                {
                    res = false;
                    _errorProvider.SetError(_txtLongitudUTM, MessageMgr.Instance.GetMessage("INGRESE_NUM_POSITIVO"));
                }
            }

            return(res);
        }
コード例 #2
0
 private void FormatearGrados(MaskedTextBox txt)
 {
     txt.Text = AyudanteGrados.AsegurarFormato(txt.Text);
 }
コード例 #3
0
        public bool DatosValidos()
        {
            FormatearGrados(_txtLatitudGradosA);
            FormatearGrados(_txtLatitudGradosB);
            FormatearGrados(_txtLongitudGradosA);
            FormatearGrados(_txtLongitudGradosB);
            bool res = true;

            _errorProvider.Clear();
            switch (_proyectoMaestro.DTipoProyecto)
            {
            case (int)D_COD_TIPO_PROYECTO.LINEA_DE_TRANSMISIÓN:
                if (_rbtGrados.Checked)
                {
                    if (!AyudanteGrados.MinutosSegundosValidos(_txtLongitudGradosA.Text))
                    {
                        res = false;
                        _errorProvider.SetError(_txtLongitudGradosA, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                    }

                    if (!AyudanteGrados.MinutosSegundosValidos(_txtLatitudGradosA.Text))
                    {
                        res = false;
                        _errorProvider.SetError(_txtLatitudGradosA, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                    }

                    if (!AyudanteGrados.MinutosSegundosValidos(_txtLongitudGradosB.Text))
                    {
                        res = false;
                        _errorProvider.SetError(_txtLongitudGradosB, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                    }

                    if (!AyudanteGrados.MinutosSegundosValidos(_txtLatitudGradosB.Text))
                    {
                        res = false;
                        _errorProvider.SetError(_txtLatitudGradosB, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                    }
                }

                if (!ValidarDatosLocalizacionA())
                {
                    res = false;
                    _errorProvider.SetError(_txtAltitudA, "Debe ingresar todos los datos.");
                }
                if (!ValidarDatosLocalizacionB())
                {
                    res = false;
                    _errorProvider.SetError(_txtAltitudB, "Debe ingresar todos los datos.");
                }
                break;

            case (int)D_COD_TIPO_PROYECTO.TRANSFORMADOR:
            case (int)D_COD_TIPO_PROYECTO.CAPACITOR:
            case (int)D_COD_TIPO_PROYECTO.REACTOR:
                if (!ValidarDatosLocalizacionA())
                {
                    res = false;
                    _errorProvider.SetError(_txtAltitudA, "Debe ingresar todos los datos.");
                }

                if (_rbtGrados.Checked)
                {
                    if (!AyudanteGrados.MinutosSegundosValidos(_txtLongitudGradosA.Text))
                    {
                        res = false;
                        _errorProvider.SetError(_txtLongitudGradosA, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                    }
                    if (!AyudanteGrados.MinutosSegundosValidos(_txtLatitudGradosA.Text))
                    {
                        res = false;
                        _errorProvider.SetError(_txtLatitudGradosA, "Los datos correspondientes a minutos y segundos deben ser menores a 60.");
                    }
                }
                break;

            default:
                break;
            }

            return(res);
        }