示例#1
0
        public bool InsertOrUpdate(ItemOutputStock ItemOutputStock)
        {
            if (_stockManagement.ValidItem(ItemOutputStock.StockItemId, ItemOutputStock.LocalStockId, ItemOutputStock.UnitMeasureId, ItemOutputStock.Quantity, ItemOutputStock.Id))
            {
                var stockItem = _stockItemApp.FindId(ItemOutputStock.StockItemId);

                ItemOutputStock.StandarUnitMeasureId = stockItem.UnitMeasureId;

                if (stockItem.UnitMeasureId != ItemOutputStock.UnitMeasureId)
                {
                    ItemOutputStock.StandardQuantity  = _unitMeasureConversionApp.Convert(ItemOutputStock.UnitMeasureId, stockItem.UnitMeasureId, stockItem.Id, stockItem.FamilyId, ItemOutputStock.Quantity);
                    ItemOutputStock.StandardUnitValue = ItemOutputStock.UnitaryValue / ItemOutputStock.StandardQuantity;
                    ItemOutputStock.StandardTotal     = ItemOutputStock.StandardQuantity * ItemOutputStock.StandardUnitValue;
                }
                else
                {
                    ItemOutputStock.StandardQuantity  = ItemOutputStock.Quantity;
                    ItemOutputStock.StandardUnitValue = ItemOutputStock.UnitaryValue;
                    ItemOutputStock.StandardTotal     = ItemOutputStock.Total;
                }

                return(_epr.InsertOrUpdate(ItemOutputStock));
            }
            else
            {
                return(false);
            }
        }
示例#2
0
 public bool InsertOrUpdate(Translate Translate)
 {
     if (_epr.Search(c => c.PropertyName == Translate.PropertyName && c.Id != Translate.Id).Any())
     {
         return(_epr.InsertOrUpdate(Translate));
     }
     return(false);
 }
示例#3
0
 public bool InsertOrUpdate(Company Company)
 {
     if (FindId(Company.Id) == null)
     {
         CreateFilterCompany(Company);
     }
     return(_epr.InsertOrUpdate(Company));
 }
示例#4
0
        public bool InsertOrUpdate(DebitNote DebitNote)
        {
            var notaDebito = DebitNote;
            var contratada = _contractorApp.Search(c => c.Id == notaDebito.ContractorId).Include(c => c.DebitNotes).FirstOrDefault();

            // Verifico se a nota de débito correponde a empresa selecionada.
            if (contratada.DebitNotes.Any(c => c.NumberDebitNote == notaDebito.NumberDebitNote))
            {
                return(_epr.InsertOrUpdate(DebitNote));
            }
            var numeroNd = "";

            // Pesquiso a última nota de débito do mês recorrente da empresa selecionada.
            // Cano não exista retorna 000000000, para iniciar a contagem.
            var oldNd =
                contratada.DebitNotes.LastOrDefault(
                    c => c.DateRegistration != null && c.DateRegistration.Value.Month == DateTime.Now.Month)?
                .NumberDebitNote ?? "000000000";

            // Pego o cnpj da empresa selecionada
            var cnpj = new Cnpj(contratada.Cnpj).Codigo;

            // Faço este loop, pois pode ocorrer situação de o número ser repetido.
            while (true)
            {
                // Pego o último contador e incremento mais 1 (um).
                var nd = (Convert.ToInt32(oldNd.Remove(0, 6)) + 1).ToString();

                // Crio a ND seguindo a regra: CNPJ (apenas dígitos) + ANO + MÊS + Contador.
                numeroNd = cnpj.Substring(12, 2) + DateTime.Now.Year.ToString().Substring(2, 2) + DateTime.Now.Month.ToString().PadLeft(2, '0') + nd.PadLeft(3, '0');

                notaDebito.NumberDebitNote = numeroNd;

                if (!_epr.Search(c => c.NumberDebitNote == notaDebito.NumberDebitNote).Any())
                {
                    break;
                }

                oldNd = numeroNd;
            }

            return(_epr.InsertOrUpdate(DebitNote));
        }
示例#5
0
        public bool InsertOrUpdate(OsProduct OsProduct)
        {
            try
            {
                _epr.InsertOrUpdate(OsProduct);

                return(_conn.Save());

                //if (_conn.Save())
                //{
                //    //var os = _osApp.FindId(OsProduct.OrderOfServiceId);
                //    //var mapper = new FuneraryMapper();

                //    //if (_integrationCapeStockApp.InsertOrUpdate(mapper.StartMapper(os)))
                //    //{
                //    //    var capaId = _integrationCapeStockApp.GetIdStock(c => (c as OutputStockFunerary).OrderOfServiceId == os.Id, Stock.Domain.Integration.TypeIntegration.OutputStock);
                //    //    var integrationId = _integrationCapeStockApp.Search(c => (c as OutputStockFunerary).OrderOfServiceId == os.Id).FirstOrDefault().Id;

                //    //    var itemIntegration = mapper.StartMapper(OsProduct);
                //    //    itemIntegration.IntegrationCapeStockId = integrationId;

                //    //    itemIntegration.OutputStockId = capaId;

                //    //    return _integrationItemsStockApp.InsertOrUpdate(itemIntegration);
                //    //}
                //}
                //return false;
            }
            catch (Exception ex)
            {
                GlobalUser.Logs.Add(new Log()
                {
                    ProcessStatus = ProcessStatus.Error,
                    Description   = ex.Message
                });
                return(false);
            }
        }
示例#6
0
 public bool InsertOrUpdate(Taxation Taxation)
 {
     return(_epr.InsertOrUpdate(Taxation));
 }
示例#7
0
 public bool InsertOrUpdate(FilterCompany FilterCompany)
 {
     return(_epr.InsertOrUpdate(FilterCompany));
 }
示例#8
0
 public bool InsertOrUpdate(User User)
 {
     return(_epr.InsertOrUpdate(User));
 }
示例#9
0
 public bool InsertOrUpdate(OrderOfService eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#10
0
 public bool InsertOrUpdate(TypePositionFunction TypePositionFunction)
 {
     return(_epr.InsertOrUpdate(TypePositionFunction));
 }
示例#11
0
 public bool InsertOrUpdate(OsProduct eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#12
0
 public bool InsertOrUpdate(State eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
 public bool InsertOrUpdate(InstallmentOfAccountsReceivable eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#14
0
 public bool InsertOrUpdate(Religion eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#15
0
 public bool InsertOrUpdate(OsDocument eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#16
0
 public bool InsertOrUpdate(TypeDocumentFinancial TypeDocumentFinancial)
 {
     return(_epr.InsertOrUpdate(TypeDocumentFinancial));
 }
示例#17
0
 public bool InsertOrUpdate(City city)
 {
     return(_epr.InsertOrUpdate(city));
 }
示例#18
0
 public bool InsertOrUpdate(PersonAddress PersonAddress)
 {
     return(_epr.InsertOrUpdate(PersonAddress));
 }
示例#19
0
 public bool InsertOrUpdate(ReportForm ReportForm)
 {
     return(_epr.InsertOrUpdate(ReportForm));
 }
示例#20
0
 public bool InsertOrUpdate(OsService OsService)
 {
     return(_epr.InsertOrUpdate(OsService));
 }
示例#21
0
 public bool InsertOrUpdate(LegalPerson eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#22
0
 public bool InsertOrUpdate(VehicleModelVehicle eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#23
0
 public bool InsertOrUpdate(ChargeLevel ChargeLevel)
 {
     return(_epr.InsertOrUpdate(ChargeLevel));
 }
示例#24
0
 public bool InsertOrUpdate(Vehicle Vehicle)
 {
     return(_epr.InsertOrUpdate(Vehicle));
 }
示例#25
0
 public bool InsertOrUpdate(ItemInputStock eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#26
0
 public bool InsertOrUpdate(SpecialTax SpecialTax)
 {
     return(_epr.InsertOrUpdate(SpecialTax));
 }
示例#27
0
 public bool InsertOrUpdate(UnitMeasure UnitMeasure)
 {
     return(_epr.InsertOrUpdate(UnitMeasure));
 }
示例#28
0
 public bool InsertOrUpdate(OsContractorProduct OsContractorProduct)
 {
     return(_epr.InsertOrUpdate(OsContractorProduct));
 }
示例#29
0
 public bool InsertOrUpdate(UnitMeasureConversion eobject)
 {
     return(_efcmd.InsertOrUpdate(eobject));
 }
示例#30
0
 public bool InsertOrUpdate(GroupPermission GroupPermission)
 {
     return(_epr.InsertOrUpdate(GroupPermission));
 }