public void ProcessPaymentCondition() { logger.LogInformation(this.messageManagement.GetMessage(MessageType.InicioProcessGeneradFile, new object[] { nameFileXml, DateTimeOffset.Now })); var paymentCondition = this.GetPaymentCondition(); if (paymentCondition == null) { this.logger.LogInformation(this.messageManagement.GetMessage(MessageType.NoExitsInformation, new object[] { nameFileXml })); return; } this.managementFile.CreateFileCsv <PaymentConditionEntitie>(nameFileXml, paymentCondition); var paymentConditionXml = new PaymentCondition { CondicionesPago = paymentCondition.ToList() }; this.managementFile.CreateFileXml <PaymentCondition>(nameFileXml, paymentConditionXml); logger.LogInformation(this.messageManagement.GetMessage(MessageType.InicioProcessGeneradFile, new object[] { nameFileXml, paymentCondition?.Count() })); var resultValidatioWithXsd = this.validationXsd.ValidationShemaXml($"{nameFileXml}.xsd", $"{nameFileXml}.xml"); if (resultValidatioWithXsd.Length > 0) { logger.LogWarning(resultValidatioWithXsd); return; } logger.LogInformation(this.messageManagement.GetMessage(MessageType.ValidationXSDSuccess)); logger.LogInformation(this.messageManagement.GetMessage(MessageType.FinishedProcess, new object[] { nameFileXml, DateTimeOffset.Now })); }
public ActionResult <PaymentConditionDTO> Edit([FromBody] PaymentConditionDTO paymentConditionDTO) { try { if (!ModelState.IsValid) { return(UnprocessableEntity(ModelState)); } PaymentCondition paymentCondition = _mapper.Map <PaymentCondition>(_paymentConditionAppService.GetById((long)paymentConditionDTO.Id, this.User)); if (paymentCondition == null) { return(BadRequest()); } paymentCondition.Description = paymentConditionDTO.Description; _paymentConditionAppService.UpdateEntity(paymentCondition); return(new ObjectResult(paymentConditionDTO)); } catch (Exception ex) { return(BadRequest(ex)); } }
public ProductInstallmentsViewModel CalcInstallmentValue(PaymentCondition model, decimal valor, decimal tax) { double valorParcela; tax = model.QtdeParcelas >= 6 ? tax : 0M; valor -= model.ValorEntrada; if (valor > 0) { if (model.QtdeParcelas >= 6) { valorParcela = AddTaxToInstallment(model.QtdeParcelas, tax, valor); } else { valorParcela = (double)valor / model.QtdeParcelas; } } else { valorParcela = 0; } return(new ProductInstallmentsViewModel(model.QtdeParcelas, decimal.Round(Convert.ToDecimal(valorParcela), 2), decimal.Round(tax, 2))); }
/// <summary> /// ”словие подходит под этот фильтр /// </summary> /// <param name="condition"></param> /// <returns></returns> public bool Includes(PaymentCondition condition) { if (!Equals(this.Point, condition.PaymentConditionPoint.PaymentConditionPointEnum)) { return(false); } if (Part.HasValue) { if (!Equals(Part.Value, condition.Part)) { return(false); } } if (DaysToPoint.HasValue) { if (!Equals(DaysToPoint.Value, condition.DaysToPoint)) { return(false); } } return(true); }
public static PaymentConditionDTO Convert(PaymentCondition obj) { return(new PaymentConditionDTO(obj.Condition) { Id = obj.Id, //Condition = obj.Condition }); }
public PaymentConditionViewModel(PaymentConditionSet paymentConditionSet, IUnityContainer container) { _unitOfWork = container.Resolve <IUnitOfWork>(); PaymentConditionWrapper = new PaymentConditionWrapper2(paymentConditionSet) { Part = 1.0 - paymentConditionSet.PaymentConditions.Sum(condition => condition.Part), PaymentConditionPoint = new PaymentConditionPointWrapper(_unitOfWork.Repository <PaymentConditionPoint>().GetAll().First()) }; OkCommand = new DelegateLogCommand( () => { PaymentCondition paymentCondition = this.PaymentConditionWrapper.Model; //если условие новое if (_unitOfWork.Repository <PaymentCondition>() .Find(condition => Equals(condition, paymentCondition)) .Any() == false) { if (_unitOfWork.SaveEntity(paymentCondition).OperationCompletedSuccessfully) { this.PaymentConditionWrapper.AcceptChanges(); container.Resolve <IEventAggregator>().GetEvent <AfterSavePaymentConditionEvent>().Publish(paymentCondition); } else { return; } } IsOk = true; CloseRequested?.Invoke(this, new DialogRequestCloseEventArgs(true)); }, () => PaymentConditionWrapper.IsValid && PaymentConditionWrapper.IsChanged); PaymentConditionWrapper.PropertyChanged += (sender, args) => OkCommand.RaiseCanExecuteChanged(); SelectPaymentConditionPointCommand = new DelegateLogCommand( () => { ISelectService selectService = container.Resolve <ISelectService>(); PaymentConditionPoint point = selectService.SelectItem(_unitOfWork.Repository <PaymentConditionPoint>().GetAll()); if (point != null) { this.PaymentConditionWrapper.PaymentConditionPoint = new PaymentConditionPointWrapper(point); } }); ClearPaymentConditionPointCommand = new DelegateLogCommand( () => { this.PaymentConditionWrapper.PaymentConditionPoint = null; }); }
public static string GetDescription(this PaymentCondition conditionEnum) { switch (conditionEnum) { case PaymentCondition.Cash: return("À Vista"); case PaymentCondition.Monthly: return("Mensal"); case PaymentCondition.Installment: return("Parcelado"); default: return("Desconhecido"); } }
public void PaymentToStartProductionTest() { SalesUnit salesUnit = new SalesUnit(); SalesUnitWrapper suw = new SalesUnitWrapper(salesUnit); Assert.AreEqual(suw.SumToStartProduction, 0.0); //вносим условие - оплатить до запуска производства double part1 = 25; PaymentCondition paymentCondition1 = new PaymentCondition { Part = part1, DaysToPoint = -7, PaymentConditionPoint = PaymentConditionPoint.ProductionStart }; suw.PaymentsConditions.Add(new PaymentConditionWrapper(paymentCondition1)); Assert.AreEqual(suw.SumToStartProduction, part1 * salesUnit.Cost); //вносим условие - оплатить после запуска производства PaymentCondition paymentCondition2 = new PaymentCondition { Part = part1, DaysToPoint = 10, PaymentConditionPoint = PaymentConditionPoint.ProductionStart }; suw.PaymentsConditions.Add(new PaymentConditionWrapper(paymentCondition2)); Assert.AreEqual(suw.SumToStartProduction, part1 * salesUnit.Cost); //вносим условие - оплатить до окончания производства PaymentCondition paymentCondition3 = new PaymentCondition { Part = part1, DaysToPoint = -5, PaymentConditionPoint = PaymentConditionPoint.ProductionEnd }; suw.PaymentsConditions.Add(new PaymentConditionWrapper(paymentCondition3)); Assert.AreEqual(suw.SumToStartProduction, part1 * salesUnit.Cost); //вносим условие - оплатить до запуска производства double part2 = 20; PaymentCondition paymentCondition4 = new PaymentCondition { Part = part2, DaysToPoint = 0, PaymentConditionPoint = PaymentConditionPoint.ProductionStart }; suw.PaymentsConditions.Add(new PaymentConditionWrapper(paymentCondition4)); Assert.AreEqual(suw.SumToStartProduction, (part1 + part2) * salesUnit.Cost); }
public ActionResult Delete(long id) { try { PaymentCondition paymentCondition = _paymentConditionAppService.GetById(id, this.User); if (paymentCondition == null) { return(NotFound()); } _paymentConditionAppService.RemoveEntity(paymentCondition); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex)); } }
public ActionResult <PaymentConditionDTO> Create([FromBody] PaymentConditionDTO paymentConditionDTO) { try { CurrentUser currentUser = new CurrentUser(this.User); if (!ModelState.IsValid || paymentConditionDTO.EstablishmentId != currentUser.EstablishmentId) { return(BadRequest()); } PaymentCondition paymentCondition = _mapper.Map <PaymentCondition>(paymentConditionDTO); if (_paymentConditionAppService.CreateEntity(paymentCondition) != null) { return(Created("/api/v1/paymentcondition", HttpStatusCode.Created)); } return(BadRequest()); } catch (Exception ex) { return(BadRequest(ex)); } }
private void InsertUpdatePaymentMethods(PaymentCondition row) { var item = _foccoWebFormaPagamentoRepository.Get(x => x.CodigoForma == row.Codigo && x.IdForma == row.ID); if (item == null) { item = new FoccoWebApiFormaPagamento(); item.IdForma = row.ID; item.CodigoForma = row.Codigo; item.Descricao = row.Descricao; item.Ativo = true; _foccoWebFormaPagamentoRepository.Insert(item); } else { if (!item.Ativo) { item.Ativo = true; _foccoWebFormaPagamentoRepository.Update(item); } } }
private void Initialize() { Contractor = new Contractor(); Customer = new Customer(); PaymentCondition = new PaymentCondition(); }
private void CreateNewPaymentCondition() { SelectedPaymentCondition = new PaymentCondition(); PaymentConditionList.Add(SelectedPaymentCondition); }
public static bool Update(PaymentCondition PaymentCondition) { return(WebApi <bool> .PutAsync(controllerName, PaymentCondition, "Put").Result); }
public static int Insert(PaymentCondition PaymentCondition) { return(WebApi <int> .PostAsync(controllerName, PaymentCondition, "SinglePost").Result); }