Ejemplo n.º 1
0
        public void Create(CreateServiceSolicitationMessage message)
        {
            var serviceSolicitation = new ServiceSolicitation();

            serviceSolicitation.Location      = _locationRepository.Get(message.LocationId);
            serviceSolicitation.Advertiser    = _advertiserRepository.Get(message.AdvertiserId);
            serviceSolicitation.EndDate       = message.EndDate;
            serviceSolicitation.ContractModel = _contractModelRepository.Get(message.ContractModelId);
            serviceSolicitation.MonthlyValue  = serviceSolicitation.Location.MonthlyValue;
            serviceSolicitation.StartDate     = message.StartDate;

            _serviceSolicitationRepository.Add(serviceSolicitation);
            _serviceSolicitationRepository.SaveChanges();
        }
Ejemplo n.º 2
0
        public void Add(CreateServiceSolicitationRequest request)
        {
            var splittedStartMonth = request.StartMonth.Split('/');
            var startMonth         = Int32.Parse(splittedStartMonth[0]);
            var startYear          = Int32.Parse(splittedStartMonth[1]);
            var startDate          = new DateTime(startYear, startMonth, 1);

            var message = new CreateServiceSolicitationMessage();
            var user    = HttpContext.Current.User;

            message.LocationId      = request.LocationId;
            message.AdvertiserId    = user.GetUserId();
            message.StartDate       = startDate;
            message.EndDate         = startDate.AddMonths(request.MonthQuantity);
            message.ContractModelId = request.ContractModelId;

            _serviceSolicitationService.Create(message);
        }