Пример #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            #region Consulta al Server para traer datos del Sello

            try
            {
                string         SelloConsulta = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                SqlParameter[] Parametros    = new SqlParameter[1];
                Parametros[0] = new SqlParameter("@Sello", SelloConsulta);

                ConsultaEntidades Entidad = new ConsultaEntidades();
                Ent_MinaSello     Reader  = new Ent_MinaSello();
                Reader = Entidad.MinaSello("ConsultarSelloSGS", Parametros);

                if (Reader.Consecutivo == 0)
                {
                    this.StsLabel1.Text = " Sello No Encontrado";
                }
                else
                {
                    this.StsLabel1.Text = Reader.Mina + " ==> " + Reader.Consecutivo + " Fecha: " + Reader.Fecha.ToShortDateString();
                }
            }
            catch (Exception Ext)
            {
                MessageBox.Show("OCURRIÓ UN ERROR AL CONSULTAR O CARGAR LOS DATOS: \n\n" + Ext.Message, "Error del Sistema...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            #endregion
        }
Пример #2
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            #region Llenado los Textbox
            double        SumTenor = 0.00;
            double        Tenor1   = 0.00;
            double[]      ArrayTenor;
            List <double> ListArray = new List <double>();

            string Sello    = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            int    TotalReg = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (Convert.ToBoolean(row.Cells[0].Value) & Convert.ToString(row.Cells[3].Value) == Sello)
                {
                    TotalReg += 1;
                    SumTenor  = SumTenor + Convert.ToDouble(row.Cells[4].Value);
                    ListArray.Add(Convert.ToDouble(row.Cells[4].Value));
                    string SelloP = Convert.ToString(row.Cells[2].Value);
                    if (SelloP.IndexOf("a") + SelloP.IndexOf("b") + SelloP.IndexOf("c") == -3)
                    {
                        Tenor1 = Convert.ToDouble(row.Cells[4].Value);
                    }
                }
            }
            ArrayTenor         = ListArray.ToArray();
            this.TxbTenor.Text = Tenor1.ToString().Trim();
            //this.TxbTenorMedia.Text = Convert.ToString(SumTenor / TotalReg);
            this.TxbTenorMedia.Text = Estadisticas.Mediana(ListArray).ToString();
            this.TxbDesv.Text       = Math.Round(Estadisticas.Desv(ArrayTenor), 4).ToString().Trim();
            this.TxbTenorMin.Text   = ArrayTenor.Min().ToString().Trim();
            this.TxbTenorMax.Text   = ArrayTenor.Max().ToString().Trim();
            #endregion

            #region Consulta al Server para traer datos del Sello

            try
            {
                string         SelloConsulta = dataGridView1.CurrentRow.Cells[3].Value.ToString();
                SqlParameter[] Parametros    = new SqlParameter[1];
                Parametros[0] = new SqlParameter("@Sello", SelloConsulta);

                ConsultaEntidades Entidad = new ConsultaEntidades();
                Ent_MinaSello     Reader  = new Ent_MinaSello();
                Reader = Entidad.MinaSello("ConsultarSelloSGS", Parametros);

                this.TxbMina.Text  = Reader.Mina + " ==> " + Reader.Consecutivo;
                this.TxbFecha.Text = Reader.Fecha.ToString().Trim();
            }
            catch (Exception Ext)
            {
                MessageBox.Show("OCURRIÓ UN ERROR AL CONSULTAR O CARGAR LOS DATOS: \n\n" + Ext.Message, "Error del Sistema...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            #endregion
        }
Пример #3
0
        private void TxbConsecutivo_Leave(object sender, EventArgs e)
        {
            #region LLenado el DataGridView con los registros relacionados
            try
            {
                SqlParameter[] Parametros_Consulta = new SqlParameter[4];
                Parametros_Consulta[0] = new SqlParameter("@Op", "MuestrasSGS2_2");
                Parametros_Consulta[1] = new SqlParameter("@ParametroChar", "");
                Parametros_Consulta[2] = new SqlParameter("@ParametroInt", this.TxbConsecutivo.Text.Trim());
                Parametros_Consulta[3] = new SqlParameter("@ParametroNuemric", "0");

                DataTable dt = new DataTable();
                dt.Columns.Add("Id");
                dt.Columns.Add("LimSupPadre");
                dt.Columns.Add("LimSupHijo");
                dt.Columns.Add("G_TM");
                dt.Columns.Add("PesoMuestra");
                DataRow Registro = dt.NewRow();

                DataSet DS;
                DS = LlenarGrid.Datos("SpConsulta_Tablas", Parametros_Consulta);

                foreach (DataRow row in DS.Tables[0].Rows)
                {
                    this.TxbCliente.Text    = row["Cliente"].ToString();
                    this.TxbReferencia.Text = row["Referencia"].ToString();
                    this.TxbRecepcion.Text  = row["Recepcion"].ToString();
                    this.TxbReporte.Text    = row["Reporte"].ToString();
                    this.TxbOrden.Text      = row["Orden"].ToString();
                    this.TxbLugar.Text      = row["Lugar"].ToString();
                    this.TxbMuestras.Text   = row["Muestra"].ToString();
                    this.TxbPath.Text       = row["Ruta"].ToString();

                    Registro["Id"]          = row["Id"];
                    Registro["LimSupPadre"] = row["SelloP"];
                    Registro["LimSupHijo"]  = row["SelloH"];
                    Registro["G_TM"]        = row["Tenor"];
                    Registro["PesoMuestra"] = row["Peso"];
                    dt.Rows.Add(Registro);
                    Registro = dt.NewRow();
                }

                DataSet DSR = new DataSet();
                DSR.Tables.Add(dt);

                dataGridView1.DataSource = DSR.Tables[0];
                dataGridView1.AutoResizeColumns();

                int I = 0;
                foreach (DataRow row in DS.Tables[0].Rows)
                {
                    this.dataGridView1[0, I].Value = row["Incluir"];
                    I += 1;
                }

                foreach (DataGridViewColumn Column in dataGridView1.Columns)
                {
                    Column.ReadOnly = true;
                }
            }
            catch (Exception Exc)
            {
                MessageBox.Show("OCURRIÓ UN ERROR AL CONSULTAR O CARGAR LOS DATOS..: \n\n" + Exc.Message, "Error del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion

            #region LLenado de DataGrid Auxiliar

            DataTable date = new DataTable();
            date.Columns.Add("Id");
            date.Columns.Add("IdPadre");
            date.Columns.Add("Sello");
            date.Columns.Add("Tenor");
            DataRow Row     = date.NewRow();
            string  IdLim   = "";
            string  LimSupP = "";
            string  G_TM    = "";
            int     Id      = 1;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                string SelloP = Convert.ToString(row.Cells[2].Value);
                if (SelloP.IndexOf("a") + SelloP.IndexOf("b") + SelloP.IndexOf("c") == -3)
                {
                    IdLim   = Convert.ToString(row.Cells[1].Value);
                    LimSupP = Convert.ToString(row.Cells[2].Value);
                    G_TM    = Convert.ToString(row.Cells[5].Value);

                    Row["Id"]      = Id;
                    Row["IdPadre"] = IdLim;
                    Row["Sello"]   = LimSupP;
                    Row["Tenor"]   = G_TM;
                    date.Rows.Add(Row);
                    Row = date.NewRow();
                    Id++;
                }
            }

            DataSet DataS = new DataSet();
            DataS.Tables.Add(date);
            dataGridView2.DataSource = DataS.Tables[0];
            dataGridView2.AutoResizeColumns();

            try
            {
                foreach (DataGridViewRow Row2 in dataGridView2.Rows)
                {
                    string         SelloConsulta = Convert.ToString(Row2.Cells[2].Value);
                    SqlParameter[] Parametros    = new SqlParameter[1];
                    Parametros[0] = new SqlParameter("@Sello", SelloConsulta);

                    ConsultaEntidades Entidad = new ConsultaEntidades();
                    Ent_MinaSello     Reader  = new Ent_MinaSello();
                    Reader = Entidad.MinaSello("ConsultarSelloSGS", Parametros);

                    if (Reader.Consecutivo == 0)
                    {
                        dataGridView2.Rows[Row2.Index].DefaultCellStyle.BackColor = Color.SkyBlue;
                    }
                }
            }
            catch (Exception Ext)
            {
                MessageBox.Show(Ext.Message);
            }
            #endregion
        }
Пример #4
0
        private void btnProcesar_Click(object sender, EventArgs e)
        {
            this.StsLabel1.Text        = "Llenando Encabezado";
            this.StsProgressBar1.Value = 25;
            #region Llenando el Encabezado
            if (this.TxbPath.Text.Length != 0)
            {
                Ent_EncabezadoExcel Encabezado = LeerExcel.Encabezado(this.TxbPath.Text);
                this.TxbCliente.Text    = Encabezado.Cliente;
                this.TxbOrden.Text      = Encabezado.Orden;
                this.TxbLugar.Text      = Encabezado.Lugar;
                this.TxbMuestras.Text   = Encabezado.Muestras;
                this.TxbReferencia.Text = Encabezado.Referencia;
                this.TxbReporte.Text    = Encabezado.Reporte;
                this.TxbRecepcion.Text  = Encabezado.Recepcion;
            }
            #endregion


            this.StsLabel1.Text        = "Llenando Tabla Principal";
            this.StsProgressBar1.Value = 50;
            #region Llenando el dataGridView Principal
            if (this.TxbPath.Text.Length != 0)
            {
                DataSet DS;
                DS = LeerExcel.DatosGQ15(this.TxbPath.Text);
                dataGridView1.DataSource = DS.Tables[0];
                dataGridView1.AutoResizeColumns();

                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    row.Cells[0].Value = true;
                }
                this.chbMarcar.Checked = true;

                int I = 0;
                foreach (DataGridViewColumn Column in dataGridView1.Columns)
                {
                    if (I == 0)
                    {
                        Column.ReadOnly = false;
                    }
                    else
                    {
                        Column.ReadOnly = true;
                    }
                    I += 1;
                }
            }
            else
            {
                MessageBox.Show("Seleccione un archivo");
            }
            #endregion


            this.StsLabel1.Text        = "Llenando Tabla Resumen";
            this.StsProgressBar1.Value = 75;
            #region LLenado de DataGrid Auxiliar
            DataTable dt = new DataTable();
            dt.Columns.Add("Id");
            dt.Columns.Add("IdPadre");
            dt.Columns.Add("Sello");
            dt.Columns.Add("Tenor");
            DataRow Row     = dt.NewRow();
            string  IdLim   = "";
            string  LimSupP = "";
            string  G_TM    = "";
            int     Id      = 1;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                string SelloP = Convert.ToString(row.Cells[2].Value);
                if (SelloP.IndexOf("a") + SelloP.IndexOf("b") + SelloP.IndexOf("c") == -3)
                {
                    IdLim   = Convert.ToString(row.Cells[1].Value);
                    LimSupP = Convert.ToString(row.Cells[2].Value);
                    G_TM    = Convert.ToString(row.Cells[5].Value);

                    Row["Id"]      = Id;
                    Row["IdPadre"] = IdLim;
                    Row["Sello"]   = LimSupP;
                    Row["Tenor"]   = G_TM;
                    dt.Rows.Add(Row);
                    Row = dt.NewRow();
                    Id++;
                }
            }

            DataSet DataS = new DataSet();
            DataS.Tables.Add(dt);
            dataGridView2.DataSource = DataS.Tables[0];
            dataGridView2.AutoResizeColumns();

            try
            {
                foreach (DataGridViewRow Row2 in dataGridView2.Rows)
                {
                    string         SelloConsulta = Convert.ToString(Row2.Cells[2].Value);
                    SqlParameter[] Parametros    = new SqlParameter[1];
                    Parametros[0] = new SqlParameter("@Sello", SelloConsulta);

                    ConsultaEntidades Entidad = new ConsultaEntidades();
                    Ent_MinaSello     Reader  = new Ent_MinaSello();
                    Reader = Entidad.MinaSello("ConsultarSelloSGS", Parametros);

                    if (Reader.Consecutivo == 0)
                    {
                        dataGridView2.Rows[Row2.Index].DefaultCellStyle.BackColor = Color.SkyBlue;
                    }
                }
            }
            catch (Exception Ext)
            {
                MessageBox.Show(Ext.Message);
            }


            #endregion


            for (int i = 0; i < 1000; i++)
            {
                i += 1;
            }
            this.StsProgressBar1.Value = 100;
            this.StsLabel1.Text        = "Listo";
            this.StsProgressBar1.Value = 0;
        }
Пример #5
0
        private void btnProcesar_Click(object sender, EventArgs e)
        {
            this.StsLabel1.Text        = "Llenando Encabezado";
            this.StsProgressBar1.Value = 50;
            #region Llenando el Encabezado
            if (this.TxbPath.Text.Length != 0)
            {
                Ent_EncabezadoHume Encabezado = LeerExcel.EncabezadoHume(this.TxbPath.Text);
                this.TxbFecha.Text                  = Encabezado.Fecha;
                this.TxbMuestras.Text               = Encabezado.Muestras;
                this.TxbCliente.Text                = Encabezado.Cliente;
                this.TxbAuUnidad.Text               = Encabezado.AuUnidad;
                this.TxbAuMetodo.Text               = Encabezado.AuMetodo;
                this.TxbAgUnidad.Text               = Encabezado.AgUnidad;
                this.TxbAgMetodo.Text               = Encabezado.AgMetodo;
                this.TxbHumeUnidad.Text             = Encabezado.HumedadUnd;
                this.TxbHumeMetodo.Text             = Encabezado.HumedadMet;
                this.TxbTipoMuestra.Text            = Encabezado.TipoMuestras;
                this.TxbOrden.Text                  = Encabezado.Orden;
                this.TxbClienteOrden.Text           = Encabezado.ClienteOrden;
                this.TxbNumMuestras.Text            = Encabezado.NumMuestras;
                this.TxbFechaMuestreo.Text          = Encabezado.FechaMuestreo;
                this.TxbFechaReporte.Text           = Encabezado.FechaReporte;
                this.TxbNotas.Text                  = Encabezado.Notas;
                this.TxbCodigoPreparacion.Text      = Encabezado.CodigoPrepa;
                this.TxbDescripcionPreparacion.Text = Encabezado.DescripcionPrepa;
                this.TxbCodigoAnalisis.Text         = Encabezado.CodigoAnalisis;
                this.TxbDescripcionAnalisis.Text    = Encabezado.DescripcionAnalisis;
                this.LblZC.Text = Encabezado.Orden;
            }
            #endregion



            this.StsLabel1.Text        = "Llenando Tabla Principal";
            this.StsProgressBar1.Value = 75;
            #region Llenando el dataGridView Principal
            if (this.TxbPath.Text.Length != 0)
            {
                DataSet DS;
                DS = LeerExcel.DatoHumedad(this.TxbPath.Text);
                dataGridView1.DataSource = DS.Tables[0];
                dataGridView1.AutoResizeColumns();
            }
            else
            {
                MessageBox.Show("Seleccione un archivo");
            }
            #endregion

            this.StsLabel1.Text        = "Marcando Sellos no reportados";
            this.StsProgressBar1.Value = 90;

            #region Marcando Sellos no reportados
            try
            {
                foreach (DataGridViewRow Row2 in dataGridView1.Rows)
                {
                    string         SelloConsulta = Convert.ToString(Row2.Cells[1].Value);
                    SqlParameter[] Parametros    = new SqlParameter[1];
                    Parametros[0] = new SqlParameter("@Sello", SelloConsulta);

                    ConsultaEntidades Entidad = new ConsultaEntidades();
                    Ent_MinaSello     Reader  = new Ent_MinaSello();
                    Reader = Entidad.MinaSello("ConsultarSelloSGS", Parametros);

                    if (Reader.Consecutivo == 0)
                    {
                        dataGridView1.Rows[Row2.Index].DefaultCellStyle.BackColor = Color.SkyBlue;
                    }
                }
            }
            catch (Exception Ext)
            {
                MessageBox.Show(Ext.Message);
            }
            #endregion

            for (int i = 0; i < 10000; i++)
            {
            }

            this.StsLabel1.Text        = "Listo";
            this.StsProgressBar1.Value = 100;
            this.StsProgressBar1.Value = 0;
        }