示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(11);

            frmS.ShowDialog();
            npId = "";
            if (frmS.Emp != null)
            {
                txtEmp.Text = frmS.Emp;
                busqueEmpleado();
            }
            frmS.Dispose();
        }
示例#2
0
        private void btn_ciSearch_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(10);

            frmS.ShowDialog();
            npId = "";
            if (frmS.ciId != null)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {

                    #region carga busqueda
                    string sqlEmpl = "";

                    conAcc.Open();
                    sqlEmpl = "select * from IndirectosAsignadosDepartementosPlanta where codigo_indirecto ='" + frmS.ciId + "'";
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);

                    if (dtEmpl.Rows.Count > 0)
                    {
                        txtDepto.Text = dtEmpl.Rows[0][0].ToString();
                        txtCi.Text = dtEmpl.Rows[0][1].ToString();
                        txtDesc.Text = dtEmpl.Rows[0][2].ToString();
                    }
                    ciId = frmS.ciId;
                    dtEmpl.Dispose();
                    da.Dispose();

                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion
                    btn_ciNew.Enabled = true;
                    btn_ciDel.Enabled = true;
                    btn_ciEdit.Enabled = true;
                    btn_ciSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el codigo indirecto: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#3
0
        private void btn_scSearch_Click(object sender, EventArgs e)
        {
            string tipo = tabControl.TabPages["tabSc"].Text;
            int rep = 6;
            if (tipo == "Supervisores")
                rep = 5;

            frmSearchcomun frmS = new frmSearchcomun(rep);

            frmS.ShowDialog();

            if (frmS.scId != "")
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {

                    #region carga busqueda
                    string sqlEmpl = "";
                    if (tipo == "Supervisores")
                        sqlEmpl = "select * from supervisores where supervisor ='" + frmS.scId + "'";
                    else
                        sqlEmpl = "select * from coordinadores where id_coordinador ='" + frmS.scId + "'";

                    conAcc.Open();
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);
                    int totEmpl = dtEmpl.Rows.Count;
                    if (dtEmpl.Rows.Count > 0)
                    {
                        scId.Text = dtEmpl.Rows[0][0].ToString();
                        scNom.Text = dtEmpl.Rows[0][1].ToString();
                    }
                    dtEmpl.Dispose();
                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion

                    da.Dispose();
                    btn_scNew.Enabled = true;
                    btn_scDel.Enabled = true;
                    btn_scEdit.Enabled = true;
                    btn_scSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el " + tipo + ": " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#4
0
        private void btn_tSearch_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(7);

            frmS.ShowDialog();

            if (frmS.tId != null)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {

                    #region carga busqueda
                    string sqlEmpl = "";

                    conAcc.Open();
                    sqlEmpl = "select * from turnos where turno =" + frmS.tId;
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);

                    if (dtEmpl.Rows.Count > 0)
                    {
                        tId.Text = dtEmpl.Rows[0][0].ToString();
                        tEnt.Text = dtEmpl.Rows[0][1].ToString();
                        tSal.Text = dtEmpl.Rows[0][2].ToString();
                        tHrs.Text = dtEmpl.Rows[0][3].ToString();
                    }
                    dtEmpl.Dispose();
                    da.Dispose();
                    //horas hija
                    sqlEmpl = "select entrada,salida from turnos_hija where turno_id =" + frmS.tId;
                    OleDbDataAdapter da2 = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl2 = new DataTable();
                    da2.Fill(dtEmpl2);

                    for (int x = 0; x < dtEmpl2.Rows.Count; x++)
                    {
                        if (x == 0)
                        {
                            td1_1.Text = dtEmpl2.Rows[x][0].ToString();
                            td1_2.Text = dtEmpl2.Rows[x][1].ToString();
                        }
                        else if (x == 1)
                        {
                            td2_1.Text = dtEmpl2.Rows[x][0].ToString();
                            td2_2.Text = dtEmpl2.Rows[x][1].ToString();
                        }
                        else if (x == 2)
                        {
                            td3_1.Text = dtEmpl2.Rows[x][0].ToString();
                            td3_2.Text = dtEmpl2.Rows[x][1].ToString();
                        }
                    }
                    dtEmpl2.Dispose();
                    da2.Dispose();
                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion
                    btn_tNew.Enabled = true;
                    btn_tDel.Enabled = true;
                    btn_tEdit.Enabled = true;
                    btn_tSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el Turno: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#5
0
        private void btn_pSearch_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(12);

            frmS.ShowDialog();
            npId = "";
            if (frmS.idProc != null)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {

                    #region carga busqueda
                    string sqlEmpl = "";

                    conAcc.Open();
                    sqlEmpl = "select * from procesos where proc_id =" + frmS.idProc;
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);

                    if (dtEmpl.Rows.Count > 0)
                    {
                        txtProc.Text = dtEmpl.Rows[0][1].ToString();

                    }
                    idProc = frmS.idProc;
                    dtEmpl.Dispose();
                    da.Dispose();

                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion
                    btn_pNew.Enabled = true;
                    btn_pDel.Enabled = true;
                    btn_pEdit.Enabled = true;
                    btn_pSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el proceso: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#6
0
        private void btn_lSearch_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(3);

            frmS.ShowDialog();
            if (frmS.lineId != 0)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {

                    #region carga busqueda
                    string sqlEmpl = "select * from lineas where l_id =" + frmS.lineId;

                    conAcc.Open();
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);
                    int totEmpl = dtEmpl.Rows.Count;
                    if (dtEmpl.Rows.Count > 0)
                    {

                        lDepto.SelectedValue = dtEmpl.Rows[0][0].ToString();
                        lCt.SelectedValue = dtEmpl.Rows[0][1].ToString();
                        lFbu.SelectedValue = dtEmpl.Rows[0][2].ToString();
                        linea.Text = dtEmpl.Rows[0][3].ToString();
                        lDesc.Text = dtEmpl.Rows[0][4].ToString();
                        lblLineId.Text = frmS.lineId.ToString();
                    }
                    dtEmpl.Dispose();
                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion

                    da.Dispose();
                    btn_lNew.Enabled = true;
                    btn_lDel.Enabled = true;
                    btn_lEdit.Enabled = true;
                    btn_lSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar la Linea: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#7
0
        private void btn_dSearch_Click(object sender, EventArgs e)
        {
            //frmS.tbVoucher.Text = "";
            //frmS.tbEmp.Text = "";
            //frmS.tbCo.Text = "";
            frmSearchcomun frmS = new frmSearchcomun(1);

            frmS.ShowDialog();
            if (frmS.nDepto != null)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {
                    //indVoucher = frmS.noVoucher;
                    #region carga los empl
                    string sqlEmpl = "select * from departamentos where departamento ='" + frmS.nDepto + "'";

                    conAcc.Open();
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);
                    int totEmpl = dtEmpl.Rows.Count;
                    if (dtEmpl.Rows.Count > 0)
                    {
                        dFbu.SelectedValue = dtEmpl.Rows[0][0].ToString();
                        dNumDepto.Text = dtEmpl.Rows[0][1].ToString();
                        dDepto.Text = dtEmpl.Rows[0][2].ToString();
                        string[] ohArray = dtEmpl.Rows[0][3].ToString().Split('.');
                        dOverHead.Text = ohArray[0];
                        if (ohArray.Length > 1)
                            ohDec.Text = ohArray[1];
                    }
                    dtEmpl.Dispose();
                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion

                    da.Dispose();
                    btn_dNew.Enabled = true;
                    btn_dDel.Enabled = true;
                    btn_dEdit.Enabled = true;
                    btn_dSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el departamento: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#8
0
        private void btn_ctSearch_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(2);

            frmS.ShowDialog();
            if (frmS.ct != 0)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {

                    #region carga los empl
                    string sqlEmpl = "select * from centrostrabajos where centrotrabajo ='" + frmS.ct + "'";

                    conAcc.Open();
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);
                    int totEmpl = dtEmpl.Rows.Count;
                    if (dtEmpl.Rows.Count > 0)
                    {
                        ctFbu.SelectedValue = dtEmpl.Rows[0][2].ToString();
                        ctDepto.SelectedValue = dtEmpl.Rows[0][1].ToString();
                        ct.Text = dtEmpl.Rows[0][0].ToString();
                        ctDesc.Text = dtEmpl.Rows[0][3].ToString();

                    }
                    dtEmpl.Dispose();
                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion

                    da.Dispose();
                    btn_ctNew.Enabled = true;
                    btn_ctDel.Enabled = true;
                    btn_ctEdit.Enabled = true;
                    btn_ctSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el departamento: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }
示例#9
0
文件: frmPriv.cs 项目: ramonfe/Simgap
        private void btn_dSearch_Click(object sender, EventArgs e)
        {
            frmSearchcomun frmS = new frmSearchcomun(9);

            frmS.ShowDialog();
            if (frmS.uId != null)
            {
                //dgEmpleados.Rows.Clear();
                //dgVoucher.Rows.Clear();
                //tbTurno.Text = "";
                OleDbConnection conAcc = new OleDbConnection(capaDb.dbPath());
                try
                {
                    #region carga busqueda
                    string sqlEmpl = "select userid,moduloingenieria,captura,reportes,seguridad,clave,consulta from permisos where "+
                        " userid ='" + frmS.uId + "'";

                    conAcc.Open();
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlEmpl, conAcc);
                    DataTable dtEmpl = new DataTable();
                    da.Fill(dtEmpl);
                    int totEmpl = dtEmpl.Rows.Count;
                    if (dtEmpl.Rows.Count > 0)
                    {
                        txtUid.Text = dtEmpl.Rows[0][0].ToString();
                        chkMi.Checked = Convert.ToBoolean(dtEmpl.Rows[0][1]);
                        chkV.Checked = Convert.ToBoolean(dtEmpl.Rows[0][2]);
                        chkRep.Checked = Convert.ToBoolean(dtEmpl.Rows[0][3]);
                        chkPriv.Checked = Convert.ToBoolean(dtEmpl.Rows[0][4]);
                        chkEmp.Checked = Convert.ToBoolean(dtEmpl.Rows[0][6]);
                        txtUid.Tag = dtEmpl.Rows[0][5].ToString();
                    }
                    dtEmpl.Dispose();
                    // txtBox_conteo.Text = totEmpl.ToString();
                    #endregion
                    da.Dispose();
                    btn_dNew.Enabled = true;
                    btn_dDel.Enabled = true;
                    btn_dEdit.Enabled = true;
                    btn_dSearch.Enabled = true;
                }
                catch (Exception err)
                {
                    MessageBox.Show("Error al cargar el user Id: " + err.Message);
                    //dgEmpleados.CurrentRow.Cells[0].Value = null;
                    //dgEmpleados.CurrentRow.Cells[1].Value = null;
                }
                finally
                {
                    if (conAcc.State == ConnectionState.Open)
                        conAcc.Close();
                    conAcc.Dispose();
                }

            }
            frmS.Dispose();
        }