示例#1
0
        public async Task <ActionResult> AddMyShop(AddMyShopForm addMyShopForm)
        {
            if (!ModelState.IsValid)
            {
                return(View(addMyShopForm));
            }

            var shop = addMyShopForm.ToShop();

            shop.Town     = _townService.GetById(addMyShopForm.TownId);
            shop.StatusId = StatusEnum.Pending;

            try
            {
                await _shopService.Create(shop, addMyShopForm.Email, AppSettings.Theme);

                await _notificationService.SendPendingShopEmail(shop.Name, addMyShopForm.Email, true, AppSettings.Theme);
            }
            catch (ApplicationException ex)
            {
                this.ModelState.AddModelError("", ex.Message);
                return(View(addMyShopForm));
            }

            return(RedirectToAction("Index").WithSuccess("Su solicitud ha sido enviada correctamente"));
        }
示例#2
0
        public IActionResult Index()
        {
            List <DisasterModel> disasterListModel = new List <DisasterModel>();
            var disasters = _disasterService.GetAll();

            if (disasters.Count() > 0)
            {
                foreach (var disaster in disasters)
                {
                    DisasterModel model = new DisasterModel();
                    model.DisasterId    = disaster.DisasterId;
                    model.SerialNo      = disaster.SerialNo;
                    model.GlideNo       = disaster.GlideNo;
                    model.StartDate     = disaster.StartDate;
                    model.FinishDate    = disaster.FinishDate;
                    model.DisasterType  = disaster.DisasterType;
                    model.Latitute      = disaster.Latitute;
                    model.Longtitute    = disaster.Longtitute;
                    model.CityName      = _cityService.GetById(disaster.CityId).CityName;
                    model.TownName      = _townService.GetById(disaster.TownId).TownName;
                    model.Why           = disaster.Why;
                    model.Description   = disaster.Description;
                    model.AffectedAreas = disaster.AffectedAreas;
                    model.ApproveState  = disaster.ApproveState;
                    model.fileNames     = disaster.Sources.Select(i => i.SourceName).ToList();


                    disasterListModel.Add(model);
                }
            }

            return(View(disasterListModel));
        }
示例#3
0
        public ActionResult GenerateReportBeneficiaries(ReportBeneficiariesFiltersModel filters)
        {
            var reporteFactory = new ReportFactory();

            var educationalInstitutionName = filters.EducationalInstitutionId.HasValue
                ? _educationalInstitutionService.GetById(filters.EducationalInstitutionId.Value).Name
                : PointExResources.LabelAll;

            var townName = filters.TownId.HasValue
                ? _townService.GetById(filters.TownId.Value).Name
                : PointExResources.LabelAll;

            var sexDescription = filters.Sex.HasValue
                ? filters.Sex.Value == 1 ? "MASCULINO" : "FEMENINO"
                : PointExResources.LabelAll;

            reporteFactory
            .SetParameter("From", filters.From.ToShortDateString(null))
            .SetParameter("To", filters.To.ToShortDateString(null))
            .SetParameter("EducationalInstitutionName", educationalInstitutionName)
            .SetParameter("TownName", townName)
            .SetParameter("SexDescription", sexDescription)
            .SetParameter("ShowEducationalInstitution", AppSettings.ShowEducationalInstitution.ToString());

            var beneficiaries = _reportService.Beneficiaries(filters.From.AbsoluteStart(), filters.To.AbsoluteEnd(),
                                                             filters.Sex,
                                                             filters.TownId,
                                                             filters.EducationalInstitutionId);

            reporteFactory.SetDataSource("BeneficiariesDataSet", beneficiaries)
            .SetFullPath(Server.MapPath("~/Reports/Beneficiaries.rdl"));

            byte[] reportFile = reporteFactory.Render(filters.ReportType);

            return(File(reportFile, reporteFactory.MimeType));
        }