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); } }
public bool InsertOrUpdate(Translate Translate) { if (_epr.Search(c => c.PropertyName == Translate.PropertyName && c.Id != Translate.Id).Any()) { return(_epr.InsertOrUpdate(Translate)); } return(false); }
public bool InsertOrUpdate(Company Company) { if (FindId(Company.Id) == null) { CreateFilterCompany(Company); } return(_epr.InsertOrUpdate(Company)); }
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)); }
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); } }
public bool InsertOrUpdate(Taxation Taxation) { return(_epr.InsertOrUpdate(Taxation)); }
public bool InsertOrUpdate(FilterCompany FilterCompany) { return(_epr.InsertOrUpdate(FilterCompany)); }
public bool InsertOrUpdate(User User) { return(_epr.InsertOrUpdate(User)); }
public bool InsertOrUpdate(OrderOfService eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(TypePositionFunction TypePositionFunction) { return(_epr.InsertOrUpdate(TypePositionFunction)); }
public bool InsertOrUpdate(OsProduct eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(State eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(InstallmentOfAccountsReceivable eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(Religion eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(OsDocument eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(TypeDocumentFinancial TypeDocumentFinancial) { return(_epr.InsertOrUpdate(TypeDocumentFinancial)); }
public bool InsertOrUpdate(City city) { return(_epr.InsertOrUpdate(city)); }
public bool InsertOrUpdate(PersonAddress PersonAddress) { return(_epr.InsertOrUpdate(PersonAddress)); }
public bool InsertOrUpdate(ReportForm ReportForm) { return(_epr.InsertOrUpdate(ReportForm)); }
public bool InsertOrUpdate(OsService OsService) { return(_epr.InsertOrUpdate(OsService)); }
public bool InsertOrUpdate(LegalPerson eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(VehicleModelVehicle eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(ChargeLevel ChargeLevel) { return(_epr.InsertOrUpdate(ChargeLevel)); }
public bool InsertOrUpdate(Vehicle Vehicle) { return(_epr.InsertOrUpdate(Vehicle)); }
public bool InsertOrUpdate(ItemInputStock eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(SpecialTax SpecialTax) { return(_epr.InsertOrUpdate(SpecialTax)); }
public bool InsertOrUpdate(UnitMeasure UnitMeasure) { return(_epr.InsertOrUpdate(UnitMeasure)); }
public bool InsertOrUpdate(OsContractorProduct OsContractorProduct) { return(_epr.InsertOrUpdate(OsContractorProduct)); }
public bool InsertOrUpdate(UnitMeasureConversion eobject) { return(_efcmd.InsertOrUpdate(eobject)); }
public bool InsertOrUpdate(GroupPermission GroupPermission) { return(_epr.InsertOrUpdate(GroupPermission)); }