Ejemplo n.º 1
0
        private void getUsuariosCursosClases()
        {
            Comprobante_Especial aux = new Comprobante_Especial();

            aux.getUsuarios().ForEach(name => comboBox1.Items.Add(name));
            Clase clase = new Clase();

            clase.getProfesoresTodos().ForEach(x => comboBox2.Items.Add(x));
            clase.getCursos().ForEach(x => comboBox2.Items.Add(x));
        }
        //Retrive Special Recipes
        private List <Comprobante_Especial> getComrobantesEspecialesProfesor(string profesor)
        {
            List <Comprobante_Especial> resp = new List <Comprobante_Especial>();

            string direccion = this.Date + "Casos Especiales";
            string save      = direccion + ".xlsx";

            try
            {
                File.Copy(Global.MensualServer + Path.GetFileName(save), Global.Mensual + Path.GetFileName(save), true);
            }
            catch (System.IO.FileNotFoundException)
            {
            }

            //open the excel to search for the specific one

            object misValue = System.Reflection.Missing.Value;

            Excel.Application xlApp = new Excel.Application();
            Excel.Workbook    xlWorkbook;
            Excel._Worksheet  xlWorksheet;
            xlWorkbook  = xlApp.Workbooks.Open(Global.Mensual + direccion, Type.Missing, Type.Missing, Type.Missing, Global.Connect());
            xlWorksheet = (Excel.Worksheet)xlWorkbook.Worksheets.get_Item(1);

            Excel.Range xlRange   = xlWorksheet.UsedRange;
            int         rowNumber = xlRange.Rows.Count + 1;

            for (int i = 0; i < rowNumber; i++)
            {
                string clase = xlRange.Cells[i, "C"];
                if (profesor == clase)
                {
                    Comprobante_Especial auxComp = new Comprobante_Especial();
                    auxComp.Fecha                = xlRange.Cells[i, "A"];
                    auxComp.Nombre               = xlRange.Cells[i, "B"];
                    auxComp.Clase_Curso          = xlRange.Cells[i, "C"];
                    auxComp.Motivo               = xlRange.Cells[i, "D"];
                    auxComp.ComprobanteTalonario = xlRange.Cells[i, "E"];
                    auxComp.Monto                = xlRange.Cells[i, "F"];
                    auxComp.Usuario              = xlRange.Cells[i, "G"];
                    resp.Add(auxComp);
                }
            }

            return(resp);
        }