private void EditarUsuario_Load(object sender, EventArgs e)
        {
            Mantenimiento llenar = new Mantenimiento();

            llenar.llenarPst(comboBox1);

            users us = new users();

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("select [Descripcion] from [dbo].[Estados/Entidad]  where [IDEntidad] = 1 ", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    comboBox2.Items.Add(Lect["Descripcion"].ToString());
                }
                Cone.Close();
            }

            comboBox1.SelectedItem = txtPuesto.Text;
            comboBox2.SelectedItem = txtEstado.Text;
        }
Exemple #2
0
        public void llenarPuesto(ComboBox cb)
        {
            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                SqlCommand comando = new SqlCommand("select DESC_PUESTO from PUESTO", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    cb.Items.Add(Lect["DESC_PUESTO"].ToString());
                }
            }
        }
Exemple #3
0
        public void llenarCB(ComboBox cb, string x, string y)
        {
            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand(x, Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    cb.Items.Add(Lect[y].ToString());
                }
                Cone.Close();
            }
        }
Exemple #4
0
        public void llenarTipoDis(ComboBox cb)
        {
            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("select Descripcion from TipoDispositivo", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    cb.Items.Add(Lect["Descripcion"].ToString());
                }
                Cone.Close();
            }
        }
Exemple #5
0
        private void Form2_Load(object sender, EventArgs e)
        {
            tipo.Items.Add("MEDICO");
            tipo.Items.Add("ENFERMERIA");
            tipo.Items.Add("GENERAL");

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("SELECT [Nombre],[FechaIngreso],[TipoEmpleado],[TipoContrato],[TieneProfilactica], IDEmpleado FROM Empleado where Nombre = '" + nombre.Text + "'", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    fecha1.Value = Lect.GetDateTime(1);

                    tipo.SelectedIndex = Lect.GetInt32(2) - 1;

                    if (Lect.GetString(3) == "P")
                    {
                        radP.Checked = true;
                    }
                    else
                    {
                        radC.Checked = true;
                    }

                    if (Lect.GetString(4) == "SI")
                    {
                        radsi.Checked = true;
                    }
                    else
                    {
                        radno.Checked = true;
                    }

                    idEmp = Lect.GetInt32(5);
                }
                Cone.Close();
            }
        }
        public ModificarDispositivo()
        {
            InitializeComponent();

            /*Mantenimiento man = new Mantenimiento();
             *
             * man.llenarPst(comboBox2);*/

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("select [Descripcion] from [dbo].[Estados/Entidad]  where [IDEntidad] = 2 ", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    comboBox1.Items.Add(Lect["Descripcion"].ToString());
                }
                Cone.Close();
            }

            /************************/
            SqlDataReader Lect1;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("select NOM_EMPLEADO from USUARIO", Cone);

                Lect1 = comando.ExecuteReader();

                while (Lect1.Read())
                {
                    comboBox2.Items.Add(Lect1["NOM_EMPLEADO"].ToString());
                }
                Cone.Close();
            }


            /************************/
        }
Exemple #7
0
        //Para llenar stringbox
        public void stringfiller(string cb, string x, string y)
        {
            SqlDataReader Lect;

            cb = "";

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand(x, Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    cb += (Lect[y].ToString()) + "\n";
                }
                Cone.Close();
            }
        }
Exemple #8
0
        public void llenarModelo(ComboBox cb, int Marca)
        {
            cb.Items.Clear();

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("select Descripcion from Modelo where IDmarca = " + Marca + "", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    cb.Items.Add(Lect["Descripcion"].ToString());
                }
                Cone.Close();
            }
        }
Exemple #9
0
        public void updater()
        {
            Cursor.Current = Cursors.WaitCursor;

            //Convenios Start
            conveniosTXT.Text = "";

            xd = Mantenimiento.returnInt("SELECT [IDEmpleado] FROM [Empleado] where [Nombre] ='" + enfCmb.Text + "'");

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("SELECT top 10 FechaInicio FROM Convenio where IDEmpleado = " + xd + "and month(FechaInicio) = month(GETDATE()) order by FechaInicio DESC", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    dateconv           = DateTime.Parse(Lect["FechaInicio"].ToString());
                    conveniosTXT.Text += dateconv.ToString("dd-MM-yyyy hh:mm tt") + "\n";
                }
                Cone.Close();
            }
            //ConveniosEnd

            //CalendarReset
            for (int i = radCalendar1.SpecialDays.Count - 1; i >= 0; i--)
            {
                radCalendar1.SpecialDays.Remove(radCalendar1.SpecialDays[i]);
            }


            //Counters
            permiso.Text     = Mantenimiento.lookerSt("select count(IDpermiso) from Permiso where month(FechaInicio) = month(getdate()) and year(FechaInicio) = year(getdate()) and  IDEmpleado =" + xd + "");
            incapacidad.Text = Mantenimiento.lookerSt("select count(IDIncapacidad) from Incapacidad where month(FechaInicio) = month(getdate()) and year(FechaInicio) = year(getdate()) and  IDEmpleado =" + xd + "");

            //CalendarPainter
            Mantenimiento bol = new Mantenimiento();

            if (bol.Buscar("select * from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria'") == false)
            {
                vac1.Text = "--/--/----";
                prof.Text = "--/--/----";
            }
            else
            {
                //Ordinaria START
                f1        = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Inicio from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria' order by IDVac desc"));
                f2        = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Final from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria' order by IDVac desc"));
                vac1.Text = f1.ToString("dd-MM-yyyy") + " - " + f2.ToString("dd-MM-yyyy");

                double xi = (f2 - f1).TotalDays;
                for (int i = 0; i <= xi; i++)
                {
                    DateTime date1 = f1;
                    DateTime data2 = date1.AddDays(0 + i);
                    Telerik.WinControls.UI.RadCalendarDay day = new Telerik.WinControls.UI.RadCalendarDay(data2);
                    radCalendar1.SpecialDays.Add(day);

                    radCalendar1.ElementRender += radCalendar1_ElementRender;
                }
                //Ordinaria END

                //Profilactica START

                if (Mantenimiento.lookerSt("select TieneProfilactica from Empleado where IDEmpleado =" + xd + "") == "SI")
                {
                    if (bol.Buscar("select * from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Profilactica'") == false)
                    {
                        //MessageBox.Show("No tiene vacaciones profilacticas asignadas");
                        prof.Text = "--/--/----";
                    }
                    else
                    {
                        pro1      = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Inicio from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Profilactica' order by IDVac desc"));
                        pro2      = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Final from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Profilactica' order by IDVac desc"));
                        prof.Text = pro1.ToString("dd-MM-yyyy") + " - " + pro2.ToString("dd-MM-yyyy");
                    }
                }

                double xr = (pro2 - pro1).TotalDays;
                for (int i = 0; i <= xr; i++)
                {
                    DateTime date1 = pro1;
                    DateTime data2 = date1.AddDays(0 + i);
                    Telerik.WinControls.UI.RadCalendarDay day = new Telerik.WinControls.UI.RadCalendarDay(data2);
                    radCalendar1.SpecialDays.Add(day);

                    radCalendar1.ElementRender += radCalendar1_ElementRender;
                }

                //Profilactica END

                radCalendar1.FocusedDate = f1;
            }

            Cursor.Current = Cursors.Default;
        }