private void button1_Click(object sender, EventArgs e) { DateTime x1 = DateTime.Parse(fecha1.Value.ToString("yyyy-MM-dd")); DateTime x2 = DateTime.Parse(fecha2.Value.ToString("yyyy-MM-dd")); Cursor.Current = Cursors.WaitCursor; Mantenimiento man = new Mantenimiento(); string query = @"select a.Nombre, a.TipoContrato, a.FechaIngreso, b.Inicio, b.Final, b.TipoVacacion, datediff(day, b.Inicio, b.Final) as 'Dias Totales', c.Descripcion as TipoEmpleado from Empleado as a left join Vacaciones as b on a.IDEmpleado = b.IDEmpleado inner join TipoEmpleado c on a.TipoEmpleado = c.IDTipo where b.Inicio between '" + x1 + "' and '" + x2 + "'"; man.cargarDGgeneral(gridAdmin, query); copyAlltoClipboard(); Microsoft.Office.Interop.Excel.Application xlexcel; Microsoft.Office.Interop.Excel.Workbook xlWorkBook; Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlexcel = new Excel.Application(); xlexcel.Visible = true; xlWorkBook = xlexcel.Workbooks.Add(misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Excel.Range CR = (Excel.Range)xlWorkSheet.Cells[1, 1]; CR.Select(); xlWorkSheet.PasteSpecial(CR, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true); Cursor.Current = Cursors.Default; this.Close(); }
private void tipo_SelectedIndexChanged(object sender, EventArgs e) { int x = tipo.SelectedIndex + 1; Mantenimiento man = new Mantenimiento(); string query = "SELECT [Nombre] FROM [Empleado] where TipoEmpleado = " + x + " order by Nombre"; man.cargarDGgeneral(gridSel, query); }
private void Selector_Load(object sender, EventArgs e) { Mantenimiento man = new Mantenimiento(); string query = "SELECT [Nombre] FROM [Empleado] where TipoEmpleado = 1 order by Nombre"; man.cargarDGgeneral(gridSel, query); DataGridViewColumn column = gridSel.Columns[0]; column.Width = 175; }
private void Selector_Load(object sender, EventArgs e) { Mantenimiento man = new Mantenimiento(); string query = "SELECT [Nombre] FROM [Empleado] where TipoEmpleado = 1 order by Nombre"; man.cargarDGgeneral(gridSel, query); DataGridViewColumn column = gridSel.Columns[0]; column.Width = 215; tipo.Items.Add("MEDICO"); tipo.Items.Add("ENFERMERIA"); tipo.Items.Add("GENERAL"); tipo.SelectedIndex = 0; }