public FileResult Export(DealerFilter filter)
        {
            var response = _dealerService.Filter(filter);
            var csv      = new CsvExport();

            csv.ConcatRow(0, "CONCESIONARIO,ESTADO");
            csv.ConcatRows(0, "Name,Status", response.Dealers);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Concesionarios"));
        }
        public FileResult Export(UserFilter filter)
        {
            var response = _userService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "USUARIO,ALIAS,CONCESIONARIO,ROL,ESTADO");
            csv.ConcatRows(0, "Name,UserName,Dealer,Role,Status", response.Users);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Usuarios"));
        }
Exemplo n.º 3
0
        public FileResult Export(WarningFilter filter)
        {
            var response = _warningService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "CÓDIGO,ADVERTENCIA,ENFERMEDAD,ESTADO");
            csv.ConcatRows(0, "Code,Name,Disease,Status", response.Warnings);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Advertencias"));
        }
        public FileResult Export(IngredientFilter filter)
        {
            var response = _ingredientService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "INGREDIENTE,GRUPO,UNIDAD,PESO NETO,ENERGÍA,PROTEÍNAS,CARBOHIDRATOS,AZÚCAR,LÍPIDOS,SODIO,ESTADO");
            csv.ConcatRows(0, "Name,IngredientGroup,UnitLabel,NetWeight,Energy,Protein,Carbohydrate,Sugar,Lipid,Sodium,Status", response.Ingredients);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Ingredientes"));
        }
        public FileResult Export(DiseaseFilter filter)
        {
            var response = _diseaseService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "CÓDIGO,ENFERMEDAD,ESTADO");
            csv.ConcatRows(0, "Code,Name,Status", response.Diseases);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Enfermedades"));
        }
Exemplo n.º 6
0
        public FileResult Export(JobFilter filter)
        {
            var response = _jobService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "PUESTO,ESTADO");
            csv.ConcatRows(0, "Name,Status", response.Jobs);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Puestos"));
        }
Exemplo n.º 7
0
        public FileResult Export(RegionFilter filter)
        {
            var response = _regionService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "REGIÓN,ESTADO");
            csv.ConcatRows(0, "Name,Status", response.Regions);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Regiones"));
        }
Exemplo n.º 8
0
        public FileResult Export(MenuFilter filter)
        {
            var response = _menuService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "TIPO,DÍA,FECHA INICIO,FECHA FIN,PLATILLO,CONCESIONARIO,COMENTARIO,ESTADO");
            csv.ConcatRows(0, "MealTypeLabel,DayWeekLabel,StartDate,EndDate,Saucer,Dealer,Comment,Status", response.Menus);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Menús"));
        }
Exemplo n.º 9
0
        public FileResult Export(DepartmentFilter filter)
        {
            var response = _departmentService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "DEPARTAMENTO,ESTADO");
            csv.ConcatRows(0, "Name,Status", response.Departments);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Departamentos"));
        }
Exemplo n.º 10
0
        public FileResult Export(CompanyFilter filter)
        {
            var response = _companyService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "COMPAÑÍA,ESTADO");
            csv.ConcatRows(0, "Name,Status", response.Companies);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Compañías"));
        }
        public FileResult Export(TipFilter filter)
        {
            var response = _tipService.Filter(filter);

            var csv = new CsvExport();

            csv.ConcatRow(0, "CONSEJO,ESTADO");
            csv.ConcatRows(0, "Name,Status", response.Tips);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Consejos"));
        }
        public FileResult Export(WorkerFilter filter)
        {
            var response = _workerService.Filter(filter);
            var branches = _branchService.Filter(new BranchFilter()).Branches;

            var csv = new CsvExport();

            if (filter.IsReport)
            {
                csv.ConcatRow(0, "COMPAÑÍA,ID SUCURSAL,SUCURSAL,DEPARTAMENTO,PUESTO,CÓDIGO,NOMBRE,GÉNERO,NSS,FECHA CONSUMO,CONSUMIDO,RECOMENDADO");
                foreach (var worker in response.Workers)
                {
                    var today            = DateTimeExtensions.Today();
                    var startDate        = filter.Month.IsGreaterThanZero() ? new DateTime(today.Year, today.Month, 1).ConvertToString() : "";
                    var endDate          = filter.Month.IsGreaterThanZero() ? new DateTime(today.Year, today.Month, DateTime.DaysInMonth(today.Year, today.Month)).ConvertToString() : "";;
                    var responseCalories = _reservationService.Report(new ReservationReport {
                        WorkerId = worker.Id, StartDate = startDate, EndDate = endDate
                    });
                    var currentCompany = branches.First(branch => branch.Id.IsEqualTo(worker.BranchId)).Company.Name;
                    //var responseCalories = new ReservationReportResponse
                    //{
                    //    Calories = new List<ReservationCalorieReportResponse>
                    //{
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-7).ConvertToString(),Dinner = 200, Lunch = 1000, BreakFast = 150},
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-6).ConvertToString(),Dinner = 164, Lunch = 1000, BreakFast = 150},
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-5).ConvertToString(),Dinner = 195, Lunch = 1000, BreakFast = 150},
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-4).ConvertToString(),Dinner = 109, Lunch = 1000, BreakFast = 203},
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-3).ConvertToString(),Dinner = 287, Lunch = 1000, BreakFast = 343},
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-2).ConvertToString(),Dinner = 207, Lunch = 1000, BreakFast = 150},
                    //    new ReservationCalorieReportResponse{Date = DateTimeExtensions.Today().AddDays(-1).ConvertToString(),Dinner = 218, Lunch = 1000, BreakFast = 145}
                    //}
                    //};
                    foreach (var calorie in responseCalories.Calories)
                    {
                        var sumCalories = calorie.BreakFast + calorie.Dinner + calorie.Lunch;
                        var row         = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", currentCompany, worker.BranchId, worker.Branch.Name, worker.Department.Name, worker.Job.Name, worker.Code, worker.FullName, EnumResolver.Gender(worker.Gender.GetValue()), worker.Imss, calorie.Date, sumCalories.RoundDecimal(), worker.LimitEnergy);
                        csv.ConcatRow(0, row);
                    }
                }
            }
            else
            {
                csv.ConcatRow(0, "CÓDIGO,NOMBRE,APELLIDO,EMAIL,IMSS,GÉNERO,GAFFETE,INGESTA CALÓRICA,SUCURSAL,DEPARTAMENTO,PUESTO,ROL,ESTADO");
                csv.ConcatRows(0, "Code,FirstName,LastName,Email,Imss,GenderLabel,Badge,LimitEnergy,Branch,Department,Job,Role,Status", response.Workers);
            }

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Ingesta calórica por colaborador"));
        }
Exemplo n.º 13
0
        public FileResult Export(BranchFilter filter)
        {
            var response = _branchService.Filter(filter);

            foreach (var branch in response.Branches)
            {
                branch.Dealers = _dealerService.OnlyWithBranchId(branch.Id);
            }

            var csv = new CsvExport();

            csv.ConcatRow(0, "CÓDIGO,SUCURSAL,REGIÓN,COMPAÑÍA,CONCESIONARIOS,ESTADO");
            csv.ConcatRows(0, "Code,Name,Region,Company,Dealers,Status", response.Branches);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Sucursales"));
        }
Exemplo n.º 14
0
        public FileResult Export(SaucerFilter filter)
        {
            var response = _saucerService.Filter(filter);

            foreach (var saucer in response.Saucers)
            {
                saucer.SaucerConfigurations = _saucerConfigurationService.OnlyWithSaucerId(saucer.Id);
            }

            var csv = new CsvExport();

            csv.ConcatRow(0, "PLATILLO,TIPO,INGREDIENTES,ESTADO");
            csv.ConcatRows(0, "Name,TypeLabel,SaucerConfigurations,Status", response.Saucers);

            var stream = csv.RetrieveFile();

            return(new StreamFactory().Csv(stream, "Platillos"));
        }