private void vacaciones_Load(object sender, EventArgs e) { ord.Checked = true; counter = Mantenimiento.returnInt("select DATEDIFF(YEAR, FechaIngreso, getdate()) from Empleado where IDEmpleado = " + frm1.xd + ""); if (Mantenimiento.lookerSt("select TieneProfilactica from Empleado where IDEmpleado =" + frm1.xd + "") == "NO") { prof.Enabled = false; } else { string p = Mantenimiento.lookerSt("select TipoContrato from Empleado where IDEmpleado = " + frm1.xd + ""); if (p == "P") { profs.Text = "18 DIAS"; } else { profs.Text = "12 DIAS"; } } if (counter <= 1) { dias.Text = "12 DIAS"; diasV = 12; } if (counter == 2) { dias.Text = "15 DIAS"; diasV = 15; } if (counter == 3) { dias.Text = "18 DIAS"; diasV = 18; } if (counter == 4) { dias.Text = "22 DIAS"; diasV = 22; } if (counter == 5) { dias.Text = "26 DIAS"; diasV = 26; } if (counter >= 6) { dias.Text = "30 DIAS"; diasV = 30; } }
public void updater() { Cursor.Current = Cursors.WaitCursor; xd = Mantenimiento.returnInt("SELECT [IDEmpleado] FROM [Empleado] where [Nombre] ='" + userCmb.Text + "'"); //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 = "--/--/----"; } 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 radCalendar1.FocusedDate = f1; } Cursor.Current = Cursors.Default; }
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; }