private void LimparCampos()
 {
     CampoNome.Clear();
     CampoData.Clear();
     CampoMedico.Clear();
     CampoRecomendacoes.Clear();
     CampoExame.Clear();
 }
Beispiel #2
0
        public void SetValorEnDS(int posicion = 0)
        {
            string valor = "0";

            try
            {
                if (CampoData == null)
                {
                    CampoData = "";
                }

                if ((DSData != null) && (CampoData.Trim() != ""))
                {
                    if ((this.DataSource != null) && (this.ValueMember.Trim() != "") && (this.SelectedValue != null))
                    {
                        valor = this.SelectedValue.ToString();
                    }
                    else if ((this.Items.Count > 0) && (this.SelectedItem != null))
                    {
                        valor = this.SelectedIndex.ToString();
                    }
                    else if (this.Text.Trim() != "")
                    {
                        valor = this.Text.Trim();
                    }

                    if (NombreTabla.Trim() == "")
                    {
                        DSData.Tables[0].Rows[posicion][CampoData] = valor;
                    }
                    else
                    {
                        DSData.Tables[NombreTabla].Rows[posicion][CampoData] = valor;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
        public void GetValorFromDS(bool esNuevo, int posicion = 0)
        {
            string valor = "0";

            try
            {
                if (!esNuevo)
                {
                    this.Enabled = EsEditable;
                }

                if (ValorPorDefecto.Trim() == "")
                {
                    ValorPorDefecto = "0";
                }

                LlenarCombo();
                if (DSData != null)
                {
                    if (esNuevo)
                    {
                        valor = ValorPorDefecto;
                    }
                    else if (NombreTabla.Trim() == "" && CampoData.Trim() != "")
                    {
                        if (DSData.Tables[0].Rows[posicion][CampoData] is DBNull)
                        {
                            valor = ValorPorDefecto;
                        }
                        else
                        {
                            valor = DSData.Tables[0].Rows[posicion][CampoData].ToString();
                        }
                    }
                    else if (CampoData.Trim() != "")
                    {
                        if (DSData.Tables[NombreTabla].Rows[posicion][CampoData] is DBNull)
                        {
                            valor = ValorPorDefecto;
                        }
                        else
                        {
                            valor = DSData.Tables[NombreTabla].Rows[posicion][CampoData].ToString();
                        }
                    }


                    if ((this.DataSource != null) && (this.ValueMember.Trim() != ""))
                    {
                        this.SelectedValue = valor;
                        this.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                    }
                    else if (this.Items.Count > 0)
                    {
                        this.SelectedIndex = int.Parse(valor);
                        this.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                    }
                    else
                    {
                        this.Text = valor;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
        public bool PossuiMesNumerico(Indexacao indexacao)
        {
            var logBatimento = this.logBatimentoRepositorio.ObterPorIndexacao(indexacao);

            return(logBatimento != null && CampoData.PossuiMesNumerico(logBatimento.ValorReconhecido));
        }
        public void GetValorFromDS(bool esNuevo, int posicion = 0)
        {
            DataColumn MyColumna;
            DataRow    MyFila;
            ELRUtils   util   = new ELRUtils();
            string     NDecim = "N";

            string valor = "";

            try
            {
                valor = ValorPorDefecto;

                if (DSData != null)
                {
                    if (NombreTabla.Trim() == "")
                    {
                        if (!DSData.Tables[0].Columns.Contains(CampoData))
                        {
                            throw new Exception("El Campo [" + CampoData + "] No Existe!!");
                        }

                        MyColumna = DSData.Tables[0].Columns[CampoData];
                        MyFila    = DSData.Tables[0].Rows[posicion];
                    }
                    else
                    {
                        if (!DSData.Tables[NombreTabla].Columns.Contains(CampoData))
                        {
                            throw new Exception("El Campo [" + CampoData + "] No Existe!!");
                        }

                        MyColumna = DSData.Tables[NombreTabla].Columns[CampoData];
                        MyFila    = DSData.Tables[NombreTabla].Rows[posicion];
                    }

                    if (MyColumna.MaxLength > 0)
                    {
                        MaxLength = MyColumna.MaxLength;
                    }

                    //APLICAMOS FORMATO DECIMAL
                    if ((MyColumna.DataType == typeof(Decimal)) || (MyColumna.DataType == typeof(Double)))
                    {
                        if (valor.Trim() == "")
                        {
                            valor = "0.0";
                        }

                        if ((Formato == null) || (Formato == tbFormato.Default))
                        {
                            Formato = tbFormato.DecimalPositivo;
                            if (Decimales <= 0)
                            {
                                Decimales = 2;
                            }
                        }

                        if (!esNuevo)
                        {
                            valor = util.GetAsString(CampoData, MyFila, "0");
                        }

                        NDecim   += Decimales.ToString();
                        this.Text = util.ConvertirANumero(valor).ToString(NDecim);
                    }
                    else if ((MyColumna.DataType == typeof(Int16)) || (MyColumna.DataType == typeof(Int32)) || (MyColumna.DataType == typeof(Int64)) || (MyColumna.DataType == typeof(Single)) || (MyColumna.DataType == typeof(SByte)))
                    {
                        if (valor.Trim() == "")
                        {
                            valor = "0";
                        }

                        if ((Formato == null) || (Formato == tbFormato.Default))
                        {
                            Formato = tbFormato.NumerosEnteros;
                        }

                        if (!esNuevo)
                        {
                            valor = util.GetAsString(CampoData, MyFila, "0");
                        }

                        this.Text = valor;
                    }
                    else if ((MyColumna.DataType == typeof(UInt16)) || (MyColumna.DataType == typeof(UInt32)) || (MyColumna.DataType == typeof(UInt64)))
                    {
                        if (valor.Trim() == "")
                        {
                            valor = "0";
                        }

                        if ((Formato == null) || (Formato == tbFormato.Default))
                        {
                            Formato = tbFormato.NumerosEnterosPositivos;
                        }

                        if (!esNuevo)
                        {
                            valor = util.GetAsString(CampoData, MyFila, "0");
                        }

                        this.Text = valor;
                    }
                    else
                    {
                        if (!esNuevo)
                        {
                            valor = util.GetAsString(CampoData, MyFila);
                        }

                        if (CampoData.ToUpper().Contains("CEDULA"))
                        {
                            valor = util.FormatearCedulaRNC(valor);
                        }
                        else if (CampoData.ToUpper().Contains("RNC"))
                        {
                            valor = util.FormatearCedulaRNC(valor);
                        }
                        else if (CampoData.ToUpper().Contains("TELEFONO"))
                        {
                            valor = util.FormatearTelefono(valor);
                        }
                        else if (CampoData.ToUpper().Contains("CELULAR"))
                        {
                            valor = util.FormatearTelefono(valor);
                        }


                        this.Text = valor.Trim();
                    }
                }

                if (EsAutoGenerado)
                {
                    this.Enabled = false;
                }
                if ((!esNuevo) && (this.Enabled))
                {
                    this.Enabled = EsEditable;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void SetValorEnDS(int posicion = 0)
        {
            ELRUtils util = new ELRUtils();

            try
            {
                if (CampoData == null)
                {
                    CampoData = "";
                }

                if (EsAutoGenerado)
                {
                    this.Enabled = false;
                }

                if ((DSData != null) && (CampoData.Trim() != ""))
                {
                    if ((!EsAutoGenerado) && (NombreTabla.Trim() == ""))
                    {
                        if (CampoData.ToUpper().Contains("CEDULA"))
                        {
                            DSData.Tables[0].Rows[posicion][CampoData] = util.FormatearCedulaRNC(this.Text).Trim();
                        }
                        else if (CampoData.ToUpper().Contains("RNC"))
                        {
                            DSData.Tables[0].Rows[posicion][CampoData] = util.FormatearCedulaRNC(this.Text).Trim();
                        }
                        else if (CampoData.ToUpper().Contains("TELEFONO"))
                        {
                            DSData.Tables[0].Rows[posicion][CampoData] = util.FormatearTelefono(this.Text).Trim();
                        }
                        else if (CampoData.ToUpper().Contains("CELULAR"))
                        {
                            DSData.Tables[0].Rows[posicion][CampoData] = util.FormatearTelefono(this.Text).Trim();
                        }
                        else
                        {
                            DSData.Tables[0].Rows[posicion][CampoData] = this.Text.Trim();
                        }
                    }
                    else if (!EsAutoGenerado)
                    {
                        if (CampoData.ToUpper().Contains("CEDULA"))
                        {
                            DSData.Tables[NombreTabla].Rows[posicion][CampoData] = util.FormatearCedulaRNC(this.Text).Trim();
                        }
                        else if (CampoData.ToUpper().Contains("RNC"))
                        {
                            DSData.Tables[NombreTabla].Rows[posicion][CampoData] = util.FormatearCedulaRNC(this.Text).Trim();
                        }
                        else if (CampoData.ToUpper().Contains("TELEFONO"))
                        {
                            DSData.Tables[NombreTabla].Rows[posicion][CampoData] = util.FormatearTelefono(this.Text).Trim();
                        }
                        else if (CampoData.ToUpper().Contains("CELULAR"))
                        {
                            DSData.Tables[NombreTabla].Rows[posicion][CampoData] = util.FormatearTelefono(this.Text).Trim();
                        }
                        else
                        {
                            DSData.Tables[NombreTabla].Rows[posicion][CampoData] = this.Text.Trim();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }