Exemple #1
0
        public void Create(PriceListDto priceListDto)
        {
            var priceList = mapper.Map <PriceListDto, PriceList>(priceListDto);

            uow.PriceList.Create(priceList);
            uow.Save();
        }
Exemple #2
0
 public IActionResult AddPriceList(PriceListDto priceListDto)
 {
     if (ModelState.IsValid)
     {
         var priceList = GetPriceListFromDto(priceListDto);
         _salesService.AddPriceList(priceList);
         return(RedirectToAction(nameof(Index)));
     }
     return(View());
 }
Exemple #3
0
        public Response <bool> UpdatePriceList(PriceListDto data, string token)
        {
            Response <bool> obj      = null;
            var             hCliente = _global.rspClientPUT("PriceList/" + data.CompanyId, data, token);

            if (hCliente.IsSuccessStatusCode)
            {
                obj = new JavaScriptSerializer().Deserialize <Response <bool> >(hCliente.Content.ReadAsStringAsync().Result);
            }
            return(obj);
        }
Exemple #4
0
        public PriceListDto GetPrice(int patientId, DateTime date)
        {
            var paRepo         = RepositoryHelper.GetRepository <IAppointmentRepository>(UnitOfWork);
            var sgRepo         = RepositoryHelper.GetRepository <ISampleGettingRepository>(UnitOfWork);
            var labTestRepo    = RepositoryHelper.GetRepository <ILabTestRepository>(UnitOfWork);
            var labTestingRepo = this.RepositoryHelper.GetRepository <ILabTestingRepository>(this.UnitOfWork);
            var appRepo        = RepositoryHelper.GetRepository <IAppointmentRepository>(UnitOfWork);

            var apps = appRepo.GetAll().Where(p => p.IsDeleted != true);
            var pas  = paRepo.GetAll().Where(p => p.IsDeleted != true && p.PatientId == patientId);
            var sgs  = sgRepo.GetAll().Where(p => p.IsDeleted != true && p.GettingDate == date);
            var lts  = labTestingRepo.GetAll().Where(p => p.IsDeleted != true);
            var labs = labTestRepo.GetAll().Where(p => p.IsDeleted != true);

            var appPas = apps.Join(pas, p => p.PatientId, c => c.PatientId, (p, c) => new
            {
                app = p,
                pa  = c
            });
            var appPasSgs = appPas.Join(sgs, p => p.app.AppointmentId, c => c.AppointmentId, (p, c) => new
            {
                appPa = p,
                sg    = c
            });
            var appPasSgsLts = appPasSgs.Join(lts, p => p.sg.SampleGettingId, c => c.SampleGettingId, (p, c) => new
            {
                appPaSg = p,
                lt      = c
            });
            var count  = 1;
            var result = appPasSgsLts.Join(labs, p => p.lt.LabTestId,
                                           c => c.LabTestId, (p, c) => new PriceListItemDto
            {
                OrderNumber = count++,
                LabtestName = c.LabTestName,
                Price       = c.Price,
            }).ToList();
            int?total = 0;

            foreach (var i in result)
            {
                total += i.Price;
            }
            var rs = new PriceListDto
            {
                PriceListItemDto = result,
                TotalPrice       = total,
            };

            return(rs);
        }
 private async Task PushInfoToOpenhabAsync(PriceListDto data, CancellationToken token)
 {
     foreach (var item in data.Prices)
     {
         var itemdetails = _options.Value.GasStations.FirstOrDefault(x => x.StationId.ToUpperInvariant() == item.Key.ToUpperInvariant());
         if (itemdetails != null)
         {
             await CheckAndHandleItemAsync(itemdetails.DieselItem, item.Value.Diesel, token).ConfigureAwait(false);
             await CheckAndHandleItemAsync(itemdetails.E5Item, item.Value.E5, token).ConfigureAwait(false);
             await CheckAndHandleItemAsync(itemdetails.E10Item, item.Value.E10, token).ConfigureAwait(false);
         }
     }
     await SendAsync(GenerateUriForItem(_options.Value.ItemLastUpdate), DateTime.Now.ToString("s", CultureInfo.InvariantCulture.DateTimeFormat), token).ConfigureAwait(false);
 }
Exemple #6
0
 public JsonResult SetPrice(PriceListDto data)
 {
     #region TOKEN
     var      sessione  = (SessionModel)Session[Resources.Constante.SessionUsuario];
     LoginDto oLoginDto = new LoginDto();
     oLoginDto.v_UserName = sessione.UserName;
     oLoginDto.v_Password = sessione.Pass;
     var validated = _securityBL.ValidateAccess(oLoginDto);
     if (validated == null)
     {
         return(Json("", "application/json", Encoding.UTF8, JsonRequestBehavior.AllowGet));
     }
     #endregion
     data.InsertUserId = sessione.SystemUserId;
     data.UpdateUserId = sessione.SystemUserId;
     var response = _quotationBL.UpdatePriceList(data, validated.Token);
     return(Json(response, "application/json", Encoding.UTF8, JsonRequestBehavior.AllowGet));
 }
        public PriceListDto GetPrice(int sampleGettingId)
        {
            var sgRepo         = RepositoryHelper.GetRepository <ISampleGettingRepository>(UnitOfWork);
            var labTestRepo    = RepositoryHelper.GetRepository <ILabTestRepository>(UnitOfWork);
            var labTestingRepo = this.RepositoryHelper.GetRepository <ILabTestingRepository>(this.UnitOfWork);

            var sgs  = sgRepo.GetAll().Where(p => p.SampleGettingId == sampleGettingId && p.IsPaid != true);
            var lts  = labTestingRepo.GetAll().Where(p => p.IsDeleted != true);
            var labs = labTestRepo.GetAll().Where(p => p.IsDeleted != true);

            var ltsSgs = sgs.Join(lts, p => p.SampleGettingId, c => c.SampleGettingId, (p, c) => new
            {
                sg = p,
                lt = c
            });
            var count  = 1;
            var result = ltsSgs.Join(labs, p => p.lt.LabTestId,
                                     c => c.LabTestId, (p, c) => new PriceListItemDto
            {
                OrderNumber = count++,
                LabtestName = c.LabTestName,
                Price       = c.Price,
            }).ToList();
            int?total = 0;

            foreach (var i in result)
            {
                total += i.Price;
            }
            var rs = new PriceListDto
            {
                PriceListItemDto = result,
                TotalPrice       = total,
            };

            return(rs);
        }
Exemple #8
0
        public IActionResult Create(PriceListDto priceListDto)
        {
            log.Info(nameof(PriceListsController.Create) + ":Post");

            try
            {
                ViewData["AreaId"] = new SelectList(areaService.GetAreas().Select(a => new { a.Id, a.Name }), "Id", "Name");

                if (ModelState.IsValid)
                {
                    priceListService.Create(priceListDto);

                    return(RedirectToAction(nameof(Index)));
                }

                return(View(priceListDto));
            }
            catch (Exception e)
            {
                log.Error(e);

                return(BadRequest());
            }
        }
Exemple #9
0
        PriceList GetPriceListFromDto(PriceListDto priceListDto)
        {
            var priceList = _mapper.Map <PriceList>(priceListDto);

            return(priceList);
        }
Exemple #10
0
        public void Save(PriceListDto PriceListDto)
        {
            var dbPriceList = Mapper.Map <MST_PRICELIST>(PriceListDto);

            _PriceListService.save(dbPriceList);
        }
Exemple #11
0
        public void Save(PriceListDto PriceListDto, Login userLogin)
        {
            var dbPriceList = Mapper.Map <MST_PRICELIST>(PriceListDto);

            _PriceListService.save(dbPriceList, userLogin);
        }