Beispiel #1
0
        private void grados_Click(object sender, EventArgs e)
        {
            limpiar();
            EmpleadoNombre emp = new EmpleadoNombre(con);

            emp.label1.Visible       = false;
            emp.button1.Text         = "Editar";
            emp.button2.Visible      = false;
            emp.cbEmpleadoID.Visible = false;

            emp.ShowDialog();
            int id_eval = emp.id_eval;

            limpiar();
            if (emp.exiting)
            {
                return;
            }
            EditarGrados gr = new EditarGrados(con, id_eval);

            tabStrip1.MdiForm = this;
            gr.MdiParent      = this;
            gr.Show();
            //gr.ShowDialog();
        }
Beispiel #2
0
        private void Evaluador_Load(object sender, EventArgs e)
        {
            if (id.Equals(""))
            {
                EmpleadoNombre en = new EmpleadoNombre(con);

                en.ShowDialog();
                shouldExit = en.exiting;
                if (en.exiting)
                {
                    if (con.State != ConnectionState.Closed)
                    {
                        con.Close();
                    }

                    return;
                }

                id      = en.id;
                id_eval = en.id_eval;
            }
            resultadosPorCategoriaTexto = new List <string>();
            Fecha.Text = DateTime.Now.ToString();
            try
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }

                DataTable dt    = new DataTable();//casi para el final la usamos
                string    n_gen = "";
                //Loaders
                loadFirstDataSets();
                //cargando otros datos
                loadDataTableTre();
                loadCosmeticDetails();
                dt = loadSecondPart(dt);
                //Another load
                loadCheckBeforeDataGrid(dt, n_gen);
                //=========CHECKBOX
                loadCheckDataGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Beispiel #3
0
        private void Evaluador_Load(object sender, EventArgs e)
        {
            if (id.Equals(""))
            {
                EmpleadoNombre en = new EmpleadoNombre(con);
                
                en.ShowDialog();
                shouldExit = en.exiting;
                if (en.exiting)
                {
                    if (con.State != ConnectionState.Closed)
                        con.Close();

                    return;
                }

                id = en.id;
                id_eval = en.id_eval;
            }
            resultadosPorCategoriaTexto = new List<string>();
            Fecha.Text = DateTime.Now.ToString();
            try
            {
                if (con.State != ConnectionState.Open)
                    con.Open();

                DataTable dt = new DataTable();//casi para el final la usamos
                string n_gen = "";
                //Loaders
                loadFirstDataSets();                             
                //cargando otros datos
                loadDataTableTre();
                loadCosmeticDetails();
                dt = loadSecondPart(dt);
                //Another load
                loadCheckBeforeDataGrid(dt, n_gen);
                //=========CHECKBOX
                loadCheckDataGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();
            }
        }
Beispiel #4
0
 private void indiadores_Click(object sender, EventArgs e)
 {
     limpiar();
     EmpleadoNombre emp = new EmpleadoNombre(con);
     emp.label1.Visible = false;
     emp.button1.Visible = false;
     emp.cbEmpleadoID.Visible = false;
     emp.ShowDialog();           
     int id_eval = emp.id_eval;
     limpiar();
     if (emp.exiting)
         return;
     Editar_Indicadores ei = new Editar_Indicadores(con, id_eval);
     tabStrip1.MdiForm = this;
     ei.MdiParent = this;
     ei.Show();
 }
Beispiel #5
0
        private void indiadores_Click(object sender, EventArgs e)
        {
            limpiar();
            EmpleadoNombre emp = new EmpleadoNombre(con);

            emp.label1.Visible       = false;
            emp.button1.Visible      = false;
            emp.cbEmpleadoID.Visible = false;
            emp.ShowDialog();
            int id_eval = emp.id_eval;

            limpiar();
            if (emp.exiting)
            {
                return;
            }
            Editar_Indicadores ei = new Editar_Indicadores(con, id_eval);

            tabStrip1.MdiForm = this;
            ei.MdiParent      = this;
            ei.Show();
        }
Beispiel #6
0
        private void Evaluador_Load(object sender, EventArgs e)
        {
            EmpleadoNombre en = new EmpleadoNombre(con);
            List<string> bloquear = new List<string>();
            en.ShowDialog();
            shouldExit = en.exiting;
            if (en.exiting)
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();

                return;
            }

            id = en.id;
            id_eval = en.id_eval;
            resultadosPorCategoriaTexto = new List<string>();
            Fecha.Text = DateTime.Now.ToString();
            try
            {
                if (con.State != ConnectionState.Open)
                    con.Open();
                DataTable dt1 = new DataTable();
                SqlCommand cmd1 = new SqlCommand();
                cmd1.Connection = con;
                cmd1.CommandType = System.Data.CommandType.Text;
                cmd1.CommandText = "SELECT CONCAT(NOMBRES,' ',APELLIDOS) FROM EMPLEADOS WHERE ID_EMPLEADO = " + this.id;
                SqlDataAdapter da1 = new SqlDataAdapter(cmd1);

                DataSet ds1 = new DataSet();
                da1.Fill(ds1);
                dt1 = ds1.Tables[0];

                DataTable dt3 = new DataTable();
                SqlCommand cmd3 = new SqlCommand();
                cmd3.Connection = con;
                cmd3.CommandType = System.Data.CommandType.Text;
                cmd3.CommandText = "select g.NOMBRE,I.NOMBRE as n from INDICADORES I INNER JOIN GRADOS g on I.ID_IND = g.ID_IND WHERE I.ID = " + id_eval;
                SqlDataAdapter da3 = new SqlDataAdapter(cmd3);

                DataSet ds3 = new DataSet();
                da3.Fill(ds3);
                dt3 = ds3.Tables[0];
                gradosesp = dt3;
                dataGridView1.Columns.Add("Indicadores", "Indicadores");
                for (int i = 0; i < dt3.Rows.Count; i++)
                {
                    if (cols.Count == 0)
                        cols.Add(dt3.Rows[0][0].ToString());
                    else
                        for (int j = 0; j < cols.Count; j++)
                        {
                            if (cols.ElementAt(j) == dt3.Rows[i][0].ToString())
                                break;
                            if (cols.ElementAt(j) != dt3.Rows[i][0].ToString() && j == cols.Count - 1)
                                cols.Add(dt3.Rows[i][0].ToString());
                        }
                }

                DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
                cmb.HeaderText = "Grado";
                cmb.Name = "Grado";
                dataGridView1.Columns.Add(cmb);
                //Buscar el nombre en la base de datos, ya tenemos el ID

                label2.Text = id;
                Nombre.Text = dt1.Rows[0][0].ToString();
                //cargar de la base de datos los indicadores y los grados!!
                //Temporal, solo como ejemplo

                dataGridView1.ColumnHeadersVisible = true;
                DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

                columnHeaderStyle.BackColor = Color.Beige;
                columnHeaderStyle.Font = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
                dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

                DataTable dt = new DataTable();
                SqlCommand cmd2 = new SqlCommand();
                cmd2.Connection = con;
                cmd2.CommandType = System.Data.CommandType.Text;
                cmd2.CommandText = "SELECT I.NOMBRE,I.PESO, IE.NOMBRE, IE.PESO,I.ID_IND,IE.ID_IND from INDICADORES I INNER JOIN INDICADORES IE ON I.ID_IND = IE.ID_GEN WHERE I.ID = " + id_eval;
                SqlDataAdapter da = new SqlDataAdapter(cmd2);

                DataSet ds = new DataSet();
                da.Fill(ds);
                dt = ds.Tables[0];
                string n_gen = "";
                DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][0].ToString() != n_gen)
                    {
                        n_gen = dt.Rows[i][0].ToString();
                        bloquear.Add(n_gen);
                        dataGridView1.Rows.Add();
                        dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Indicadores"].Value = n_gen;

                        indicadores.Add(new Indicadores_Arr(n_gen, float.Parse(dt.Rows[i][1].ToString()), int.Parse(dt.Rows[i][4].ToString()), null));
                    }
                    //ver aca
                    if (dt.Rows[i][0].ToString() == n_gen)
                    {
                        dataGridView1.Rows.Add();

                        dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Indicadores"].Value = " ---" + dt.Rows[i][2].ToString();
                        cell = new DataGridViewComboBoxCell();
                        for (int l = 0; l < gradosesp.Rows.Count; l++)
                        {
                            if (dt.Rows[i][2].ToString() == gradosesp.Rows[l][1].ToString())
                            {
                                cell.Items.Add(gradosesp.Rows[l][0].ToString());
                            }
                        }
                        dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Grado"] = cell;
                        indicadores.ElementAt(indicadores.Count - 1).IndicadoresEspecificos.Add(new Indicadores_Arr(dt.Rows[i][2].ToString(), float.Parse(dt.Rows[i][3].ToString()), int.Parse(dt.Rows[i][4].ToString()), null));
                    }
                }
                //========= CHECKBOX

                DataTable dt4 = new DataTable();
                SqlCommand cmd4 = new SqlCommand();
                cmd4.Connection = con;
                cmd4.CommandType = System.Data.CommandType.Text;
                cmd4.CommandText = "SELECT NOMBRE FROM GRADOS WHERE ID_IND= (SELECT TOP 1 ID_IND FROM INDICADORES WHERE ID='" + id_eval + "' AND ID_GEN IS NULL)";
                SqlDataAdapter da4 = new SqlDataAdapter(cmd4);

                DataSet ds4 = new DataSet();
                da4.Fill(ds4);
                dt4 = ds4.Tables[0];
                for (int i = 0; i < dt4.Rows.Count; i++)
                {
                    DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn();
                    col.Name = dt4.Rows[i][0].ToString();
                    col.DataPropertyName = dt4.Rows[i][0].ToString();
                    col.HeaderText = dt4.Rows[i][0].ToString();
                    dataGridView1.Columns.Add(col);
                }
                for (int i = 0; i < bloquear.Count; i++)
                {
                    for (int x = 0; x < dataGridView1.Rows.Count - 1; x++)
                    {
                        if (dataGridView1.Rows[x].Cells[0].Value.Equals(bloquear.ElementAt(i)))
                        {
                            for (int c = 2; c < dataGridView1.Columns.Count; c++)
                            {
                                dataGridView1.Rows[x].Cells[c] = new DataGridViewTextBoxCell();
                                dataGridView1.Rows[x].Cells[c].ReadOnly = true;
                            }
                            break;
                        }
                    }
                }

                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {

                    resultadosPorCategoriaTexto.Add(dataGridView1.Rows[i].Cells[0].Value.ToString());
                    if (dataGridView1.Rows[i].Cells[0].Value.ToString().Contains("---"))
                    {
                        DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[1];
                        int k = 0;

                        for (int h = 2; h < dataGridView1.Columns.Count; h++)
                        {
                            DataGridViewCheckBoxCell cellbox =
                                (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[h];
                            if (
                                cb.Items[k].ToString() !=
                                dataGridView1.Columns[h].HeaderText)
                            {
                                dataGridView1.Rows[i].Cells[h] = new DataGridViewTextBoxCell();
                                dataGridView1.Rows[i].Cells[h].ReadOnly = true;
                                //cellbox.ReadOnly = true;
                            }
                            else
                            {
                                cellbox.ReadOnly = false;
                                if (k < cb.Items.Count - 1)
                                    k++;
                            }
                        }
                    }
                }

                dataGridView1.Columns[1].Visible = false;
                for (int i = 0; i < dataGridView1.Columns.Count; i++)
                {
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[i] = new DataGridViewTextBoxCell();
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[i].ReadOnly = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();
            }
        }
Beispiel #7
0
 private void grados_Click(object sender, EventArgs e)
 {
     limpiar();
     EmpleadoNombre emp = new EmpleadoNombre(con);
     emp.label1.Visible = false;
     emp.cbEmpleadoID.Visible = false;
     emp.ShowDialog();
     int id_eval = emp.id_eval;
     limpiar();
     if (emp.exiting)
         return;
     EditarGrados gr = new EditarGrados(con, id_eval);
     tabStrip1.MdiForm = this;
     gr.MdiParent = this;
     gr.Show();
     //gr.ShowDialog();
 }