Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Numbercard,Dateofbirth,Cpf,Andress,Service")] Solicitation solicitation)
        {
            if (id != solicitation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(solicitation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SolicitationExists(solicitation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(solicitation));
        }
        private PartialViewResult ViewDeleteSolicitation(Solicitation solicitation, ConfirmDialogFormViewModel viewModel)
        {
            var confirmMessage = $"Are you sure you want to delete this {FieldDefinitionEnum.Solicitation.ToType().GetFieldDefinitionLabel()} '{solicitation.SolicitationName}'?";
            var viewData       = new ConfirmDialogFormViewData(confirmMessage, true);

            return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
        }
        public IEnumerable <Solicitation> GetByPeriod(string dates)
        {
            List <Solicitation> listSolic = new List <Solicitation>();

            Console.WriteLine(dates);
            var initialDate = dates.Substring(0, 10).Replace("-", "/");
            var finalDate   = dates.Substring(11, 10).Replace("-", "/");

            Console.WriteLine("d1 " + initialDate + " d2: " + finalDate);

            var solic = _context.Solicitations.Where(s => s.RequestDate >= DateTime.Parse(initialDate) &&
                                                     s.EndDateAnalysis <= DateTime.Parse(finalDate));

            Parallel.ForEach(solic, x =>
            {
                Solicitation s           = new Solicitation();
                s.SolicitationId         = x.SolicitationId;
                s.RequestDate            = x.RequestDate;
                s.StartDateAnalysis      = x.StartDateAnalysis;
                s.EndDateAnalysis        = x.EndDateAnalysis;
                s.Result                 = x.Result;
                s.TotalValueTransactions = x.TotalValueTransactions;
                s.TotalValueTransfer     = x.TotalValueTransfer;

                listSolic.Add(x);
            });


            return(listSolic);
        }
Esempio n. 4
0
        private static void NotifyOrders(Asset asset)
        {
            var solicitation = new Solicitation(asset);
            var approval     = new Approval(asset, "Approver", DateTime.UtcNow);
            var cancellation = new Cancellation(asset, "Canceler", DateTime.UtcNow, "Incorrect order.");

            solicitation.Notify();
            approval.Notify();
            cancellation.Notify();
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Numbercard,Dateofbirth,Cpf,Andress,Service")] Solicitation solicitation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(solicitation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(solicitation));
        }
Esempio n. 6
0
        public static List <Solicitation> Solicitations()
        {
            var solicitation1 = new Solicitation()
            {
                ID           = 1,
                ShoppingCars = new List <ShoppingCar>()
                {
                    ShoppingCars().Where(x => x.CodeProduct == 5).FirstOrDefault(), ShoppingCars().Where(x => x.CodeProduct == 4).LastOrDefault(), ShoppingCars().Where(x => x.CodeProduct == 1).FirstOrDefault()
                }
            };
            var solicitation2 = new Solicitation()
            {
                ID           = 2,
                ShoppingCars = new List <ShoppingCar>()
                {
                    ShoppingCars().Where(x => x.CodeProduct == 9).FirstOrDefault(), ShoppingCars().Where(x => x.CodeProduct == 1).FirstOrDefault(),
                    ShoppingCars().Where(x => x.CodeProduct == 3).FirstOrDefault(), ShoppingCars().Where(x => x.CodeProduct == 2).FirstOrDefault()
                }
            };
            var solicitation3 = new Solicitation()
            {
                ID           = 3,
                ShoppingCars = new List <ShoppingCar>()
                {
                    ShoppingCars().Where(x => x.CodeProduct == 4).FirstOrDefault(), ShoppingCars().Where(x => x.CodeProduct == 2).FirstOrDefault()
                }
            };
            var solicitation4 = new Solicitation()
            {
                ID           = 4,
                ShoppingCars = new List <ShoppingCar>()
                {
                    ShoppingCars().Where(x => x.CodeProduct == 5).LastOrDefault()
                }
            };
            var solicitation5 = new Solicitation()
            {
                ID           = 5,
                ShoppingCars = new List <ShoppingCar>()
                {
                    ShoppingCars().Where(x => x.CodeProduct == 2).LastOrDefault(), ShoppingCars().Where(x => x.CodeProduct == 3).LastOrDefault()
                }
            };

            return(new List <Solicitation>()
            {
                solicitation1, solicitation2, solicitation3, solicitation4, solicitation5
            });
        }
        public ActionResult New(EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }

            var solicitation = new Solicitation(string.Empty, false);

            viewModel.UpdateModel(solicitation, CurrentFirmaSession);
            HttpRequestStorage.DatabaseEntities.AllSolicitations.Add(solicitation);
            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay($"{FieldDefinitionEnum.Solicitation.ToType().GetFieldDefinitionLabel()} '{solicitation.SolicitationName}' successfully created.");
            return(new ModalDialogFormJsonResult());
        }
Esempio n. 8
0
        public async Task <bool> Handle(CreateSolicitationCommand request, CancellationToken cancellationToken)
        {
            var attendedModality = await _attendedModalityRepository.FindById(request.AttendedModalityId);

            if (attendedModality == null)
            {
                _notificationContext.BadRequest(nameof(Messages.ObjectNotExists), Messages.ObjectNotExists.FormatValues("Modalidade"));
                return(false);
            }

            var solicitation = new Solicitation()
            {
                Id = request.Id,
                AttendedModality   = attendedModality,
                AttendedModalityId = attendedModality.Id,
                ClientId           = request.ClientId,
                ModalityType       = attendedModality.Modality.Key,
                NumberOfEmployeers = 1,
                KiloMeters         = request.KiloMeters,
                ProviderId         = attendedModality.ProviderUserId,
                Remark             = request.Remark,
                SolicitationDate   = request.SolicitationDate,
                EndDateTime        = request.EndDateTime,
                StartDateTime      = request.StartDateTime,
                Location           = new Location()
                {
                    Address       = request.Address,
                    AddressNumber = request.AddressNumber,
                    Burgh         = request.Burgh,
                    Cep           = request.Cep,
                    CityId        = request.CityId,
                    Complement    = request.Complement,
                    Latitude      = request.Latitude,
                    Longitude     = request.Longitude
                },
                Status    = SolicitationStatus.Created,
                TurnStart = request.TurnStart,
                TurnOver  = request.TurnOver,
            };

            await _solicitationRepository.Add(solicitation.RecalculateCost());

            return(true);
        }
Esempio n. 9
0
 public CardApplication(int Id, Solicitation solicitation, Person person, JsonDocument form)
 {
 }
        // POST: api/Solicitation
        public void Post(Solicitation solicitation)
        {
            //TODO: EventLog Add to DB

            solicitations.Add(solicitation);
        }
Esempio n. 11
0
 public void Put(int id, [FromBody] Solicitation solicitation)
 {
 }
Esempio n. 12
0
 public void Post([FromBody] Solicitation solicitation)
 {
 }