예제 #1
0
        // GET: Indicadores
        public ActionResult Index(FechaModel model)
        {
            DateTime InicioDeLosTiempos = DateTime.MinValue;

            if (model.Fecha == InicioDeLosTiempos)
            {
                model.Fecha = DateTime.Now;
            }

            //estoy probando acá
            int IdMes = model.Fecha.Month;
            int Anio  = model.Fecha.Year;

            String[] Fechas      = ObtenerDias(model.Fecha.Month, model.Fecha.Year);
            String   FInicio     = "01/" + IdMes + "/" + Anio;
            int      CantDiasMes = DateTime.DaysInMonth(Anio, IdMes);
            String   FFin        = CantDiasMes + "/" + IdMes + "/" + Anio;
            DateTime FechaInicio = Convert.ToDateTime(FInicio);
            DateTime FechaFin    = Convert.ToDateTime(FFin);

            int[] CantTurnosPorFecha = RNIndicadores.DevolverCantTurnosOcupados(1, FechaInicio, FechaFin);


            ViewBag.Fechas = Fechas;
            ViewBag.Turnos = CantTurnosPorFecha;
            ViewBag.Mes    = GetMes(IdMes);
            ViewBag.Anio   = Anio;

            return(View());
        }
예제 #2
0
        public IHttpActionResult GetRecesosGrilla(string dia, string mes, string anio, char vista)
        {
            List <FechaModel> fechas = new List <FechaModel>();
            //DateTime fecha = DateTime.ParseExact(dia + "/" + mes + "/" + anio, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime desde   = Convert.ToDateTime(anio + "/" + mes + "/" + dia);
            DateTime hasta   = vista == 's' ? desde.AddDays(7) : desde;
            var      recesos = agendaService.SearchRecesos(desde, hasta);
            var      agenda  = agendaService.GetAgenda();

            bool[] atiendeDia = { agenda.AtiendeDomingo, agenda.AtiendeLunes, agenda.AtiendeMartes, agenda.AtiendeMiercoles, agenda.AtiendeJueves, agenda.AtiendeViernes, agenda.AtiendeSabado };
            recesos.ToList().ForEach(receso =>
            {
                DateTime finicio = receso.FechaDesde > desde ? receso.FechaDesde : desde;
                int total        = receso.FechaHasta < hasta ? (receso.FechaHasta - finicio).Days : (hasta - finicio).Days;
                total++;
                finicio.NextDays(total, atiendeDia).ForEach(day =>
                {
                    var newDate   = new FechaModel();
                    newDate.Fecha = day.ToString("dd/MM/yyyy");
                    newDate.Name  = CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(day.DayOfWeek);
                    fechas.Add(newDate);
                });
            });


            return(Ok(fechas));
        }
예제 #3
0
        public ActionResult graficar(DateTime fecha)
        {
            Models.FechaModel modelo = new FechaModel();
            modelo.Fecha = fecha;



            //return View("Index",modelo);

            return(RedirectToAction("Index", "Indicadores", modelo));
        }
예제 #4
0
        public ActionResult ConvertidosXFecha(FechaModel fechaModel)
        {
            var r = new ConvertidosXFecha()
            {
                FechaInicio = { Value = fechaModel.FechaInicio }, FechaFin = { Value = fechaModel.FechaFin }
            };

            r.CargarDatos();
            report = r;
            return(View("Plantilla"));
        }
예제 #5
0
        public IHttpActionResult GetRangoFecha(string dia, string mes, string anio, char vista)
        {
            List <FechaModel> fechas = new List <FechaModel>();
            var agenda = agendaService.GetAgenda();

            bool[] atiendeDia = { agenda.AtiendeDomingo, agenda.AtiendeLunes, agenda.AtiendeMartes, agenda.AtiendeMiercoles, agenda.AtiendeJueves, agenda.AtiendeViernes, agenda.AtiendeSabado };
            //DateTime fecha = DateTime.ParseExact(dia + "/" + mes + "/" + anio, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime fecha = Convert.ToDateTime(anio + "/" + mes + "/" + dia);

            fecha.NextDays(vista == 's'?7:1, atiendeDia).ForEach(day =>
            {
                var newDate   = new FechaModel();
                newDate.Fecha = day.ToString("dd/MM/yyyy");
                newDate.Name  = CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(day.DayOfWeek);
                fechas.Add(newDate);
            });
            return(Ok(fechas));
        }
예제 #6
0
        public IHttpActionResult GetFeriadoGrilla(string dia, string mes, string anio, char vista)
        {
            List <FechaModel> fechas = new List <FechaModel>();
            //DateTime fecha = DateTime.ParseExact(dia + "/" + mes + "/" + anio, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime desde = Convert.ToDateTime(anio + "/" + mes + "/" + dia);
            DateTime hasta = vista == 's' ? desde.AddDays(7) : desde;

            agendaService.SearchFeriado(desde, hasta)
            .ToList()
            .ForEach(feriado => {
                var newDate   = new FechaModel();
                newDate.Fecha = feriado.Fecha.ToString("dd/MM/yyyy");
                newDate.Name  = CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(feriado.Fecha.DayOfWeek);
                fechas.Add(newDate);
            });

            return(Ok(fechas));
        }
예제 #7
0
        public ActionResult UploadFile(FechaModel model, HttpPostedFileBase file)
        {
            if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName))
            {
                string fileName        = file.FileName;
                string fileContentType = file.ContentType;
                byte[] fileBytes       = new byte[file.ContentLength];
                var    data            = file.InputStream.Read(fileBytes, 0, Convert.ToInt32(file.ContentLength));
                var    kpis            = new List <KPI>();
                using (var package = new ExcelPackage(file.InputStream))
                {
                    var currentSheet = package.Workbook.Worksheets;
                    foreach (var workSheet in currentSheet)
                    {
                        var noOfCol = workSheet.Dimension.End.Column;
                        var noOfRow = workSheet.Dimension.End.Row;

                        for (int rowIterator = 2; rowIterator <= noOfRow; rowIterator++)
                        {
                            var kpi = new KPI();

                            kpi.Description   = workSheet.Cells[rowIterator, 1].Value.ToString().Trim();
                            kpi.YTD           = Convert.ToDouble(workSheet.Cells[rowIterator, 2].Value.ToString().Trim());
                            kpi.Mes_Efectivo  = model.Mes;
                            kpi.Anio_Efectivo = model.Anio;

                            kpis.Add(kpi);
                        }
                    }

                    db.KPIs.AddRange(kpis);
                    db.SaveChanges();
                    return(RedirectToAction("Listado"));
                }
            }

            return(View("Listado"));
        }