public SupplierCrudHandler(SupplierRepository supplierRepository , CountryRepository countryRepository , PaymentTermRepository paymentTermRepository) : base(supplierRepository) { _countryRepository = countryRepository; _paymentTermRepository = paymentTermRepository; _fromDto = FromDto; _fromEntity = FromEntity; _updateEntity = UpdateEntity; }
/// <summary> /// convert foundry to view model /// </summary> /// <param name="foundry"></param> /// <returns></returns> public FoundryViewModel ConvertToView(PM00200_Foundry foundry) { FoundryViewModel model = new FoundryViewModel(); var _paymentTermRepository = new PaymentTermRepository(); var _shipmentTermRepository = new ShipmentTermRepository(); var _stateRepository = new StateRepository(); var _countryRepository = new CountryRepository(); var state = _stateRepository.GetState(foundry.STATE); var country = _countryRepository.GetCountry(foundry.COUNTRY); var paymentTerm = _paymentTermRepository.GetPaymentTerm(foundry.PYMTRMID); model.FoundryId = foundry.VENDORID; model.VendorId = foundry.VENDORID; model.ShortName = (!string.IsNullOrEmpty(foundry.VENDSHNM.Replace(" ", string.Empty))) ? foundry.VENDSHNM : "N/A"; model.ContactName = (!string.IsNullOrEmpty(foundry.VNDCNTCT.Replace(" ", string.Empty))) ? foundry.VNDCNTCT : "N/A"; model.ContactPhone = FormattingManager.FormatPhone(foundry.PHNUMBR1); model.FaxNumber = FormattingManager.FormatPhone(foundry.FAXNUMBR); model.Address1 = (!string.IsNullOrEmpty(foundry.ADDRESS1.Replace(" ", string.Empty))) ? foundry.ADDRESS1 : "N/A"; model.Address2 = (!string.IsNullOrEmpty(foundry.ADDRESS2.Replace(" ", string.Empty))) ? foundry.ADDRESS2 : "N/A"; model.Address3 = (!string.IsNullOrEmpty(foundry.ADDRESS3.Replace(" ", string.Empty))) ? foundry.ADDRESS3 : "N/A"; model.City = (!string.IsNullOrEmpty(foundry.CITY.Replace(" ", string.Empty))) ? foundry.CITY : "N/A"; model.StateName = (state != null && !string.IsNullOrEmpty(state.Name)) ? state.Name : "N/A"; model.PostalCode = (!string.IsNullOrEmpty(foundry.ZIPCODE.Replace(" ", string.Empty))) ? foundry.ZIPCODE : "N/A"; model.CountryName = (country != null && !string.IsNullOrEmpty(country.Name)) ? country.Name : "N/A"; model.PaymentTermDescription = (paymentTerm != null && !string.IsNullOrEmpty(paymentTerm.Description)) ? paymentTerm.Description : "N/A"; model.IsActive = foundry.VENDSTTS != 1 ? false : true; if (_paymentTermRepository != null) { _paymentTermRepository.Dispose(); _paymentTermRepository = null; } if (_shipmentTermRepository != null) { _shipmentTermRepository.Dispose(); _shipmentTermRepository = null; } if (_stateRepository != null) { _stateRepository.Dispose(); _stateRepository = null; } if (_countryRepository != null) { _countryRepository.Dispose(); _countryRepository = null; } return(model); }
public RequestRepository() { _clientRepository = new ClientRepository(); _itemRepository = new ItemRepository(); _unitOfIssueRepository = new UnitRepository(); _modeService = new ModeService(); _paymentTermService = new PaymentTermRepository(); _orderStatusService = new OrderStatusService(); _manufacturerRepository = new ManufacturerRepository(); _physicalStoreRepository = new PhysicalStoreRepository(); _activityRepository = new ActivityRepository(); }
public InvoiceCrudHandler(InvoiceRepository invoiceRepository, ClientRepository clientRepository, PaymentTermRepository paymentTermRepository, DocumentNumberSequenceHandler numberSequenceHandler) => (_invoiceRepository,
/// <summary> /// convert quote to view model /// </summary> /// <param name="quote"></param> /// <returns></returns> public QuoteViewModel ConvertToView(Quote quote) { QuoteViewModel model = new QuoteViewModel(); var _rfqRepository = new RfqRepository(); var _customerDynamicsRepository = new CustomerDynamicsRepository(); var _customerAddressDynamicsRepository = new CustomerAddressDynamicsRepository(); var _stateRepository = new StateRepository(); var _shipmentTermRepository = new ShipmentTermRepository(); var _paymentTermRepository = new PaymentTermRepository(); var _materialRepository = new MaterialRepository(); var _coatingTypeRepository = new CoatingTypeRepository(); var _htsNumberRepository = new HtsNumberRepository(); var _projectReposiotry = new ProjectPartRepository(); var rfq = _rfqRepository.GetRfq(quote.RfqId); var dynamicsCustomer = _customerDynamicsRepository.GetCustomer(quote.CustomerId); var dynamicsCustomerAddress = _customerAddressDynamicsRepository.GetCustomerAddress(quote.CustomerAddressId); var state = _stateRepository.GetState((dynamicsCustomerAddress != null && !string.IsNullOrEmpty(dynamicsCustomerAddress.STATE)) ? dynamicsCustomerAddress.STATE : string.Empty); var stateName = (state != null) ? ", " + state.Name : string.Empty; var shipmentTerm = _shipmentTermRepository.GetShipmentTerm(quote.ShipmentTermId); var paymentTerm = _paymentTermRepository.GetPaymentTerm(quote.PaymentTermId); var material = _materialRepository.GetMaterial(quote.MaterialId); var coatingType = _coatingTypeRepository.GetCoatingType(quote.CoatingTypeId); var htsNumber = _htsNumberRepository.GetHtsNumber(quote.HtsNumberId); var quoteParts = _projectReposiotry.GetProjectParts().Where(x => x.QuoteId == quote.QuoteId).ToList(); model.QuoteId = quote.QuoteId; model.RfqId = quote.RfqId; model.PriceSheetId = quote.PriceSheetId; model.ProjectId = quote.ProjectId; model.QuoteNumber = (!string.IsNullOrEmpty(quote.Number)) ? quote.Number : "N/A"; model.QuoteDate = quote.QuoteDate; model.QuoteDateStr = quote.QuoteDate.ToShortDateString(); model.RfqNumber = (rfq != null && !string.IsNullOrEmpty(rfq.Number)) ? rfq.Number : "N/A"; model.Validity = quote.Validity; model.ContactName = (!string.IsNullOrEmpty(quote.ContactName)) ? quote.ContactName : "N/A"; model.CustomerId = quote.CustomerId; model.CustomerName = (dynamicsCustomer != null && !string.IsNullOrEmpty(dynamicsCustomer.SHRTNAME)) ? dynamicsCustomer.SHRTNAME : "N/A"; model.CustomerAddressId = quote.CustomerAddressId; model.CustomerAddress = (dynamicsCustomerAddress != null) ? dynamicsCustomerAddress.ADDRESS1 + " " + dynamicsCustomerAddress.CITY + stateName : "N/A"; model.ContactCopy = (!string.IsNullOrEmpty(quote.ContactCopy)) ? quote.ContactCopy : "N/A"; model.ShipmentTermId = quote.ShipmentTermId; model.ShipmentTermDescription = (shipmentTerm != null && !string.IsNullOrEmpty(shipmentTerm.Description)) ? shipmentTerm.Description : "N/A"; model.PaymentTermId = quote.PaymentTermId; model.PaymentTermDescription = (paymentTerm != null && !string.IsNullOrEmpty(paymentTerm.Description)) ? paymentTerm.Description : "N/A"; model.MinimumShipment = (!string.IsNullOrEmpty(quote.MinimumShipment)) ? quote.MinimumShipment : "N/A"; model.ToolingTermDescription = (!string.IsNullOrEmpty(quote.ToolingTermDescription)) ? quote.ToolingTermDescription : "N/A"; model.SampleLeadTime = (!string.IsNullOrEmpty(quote.SampleLeadTime)) ? quote.SampleLeadTime : "N/A"; model.ProductionLeadTime = (!string.IsNullOrEmpty(quote.ProductionLeadTime)) ? quote.ProductionLeadTime : "N/A"; model.MaterialId = quote.MaterialId; model.MaterialDescription = (material != null && !string.IsNullOrEmpty(material.Description)) ? material.Description : "N/A"; model.CoatingTypeId = quote.CoatingTypeId; model.CoatingTypeDescription = (coatingType != null && !string.IsNullOrEmpty(coatingType.Description)) ? coatingType.Description : "N/A"; model.HtsNumberId = quote.HtsNumberId; model.HtsNumberDescription = (htsNumber != null && !string.IsNullOrEmpty(htsNumber.Description)) ? htsNumber.Description + "(" + (htsNumber.DutyRate * 100).ToString() + "%)" : "N/A"; model.IsMachined = quote.IsMachined; model.Notes = quote.Notes; model.IsOpen = quote.IsOpen; model.IsHold = quote.IsHold; model.HoldExpirationDate = (quote.HoldExpirationDate != null) ? quote.HoldExpirationDate : DateTime.MinValue; model.HoldExpirationDateStr = (quote.HoldExpirationDate != null) ? quote.HoldExpirationDate.Value.ToShortDateString() : null; model.HoldNotes = (!string.IsNullOrEmpty(quote.HoldNotes)) ? quote.HoldNotes : "N/A"; model.IsCanceled = quote.IsCanceled; model.CanceledDate = (quote.CanceledDate != null) ? quote.CanceledDate : DateTime.MinValue; model.CanceledDateStr = (quote.CanceledDate != null) ? quote.CanceledDate.Value.ToShortDateString() : null; model.CancelNotes = (!string.IsNullOrEmpty(quote.CancelNotes)) ? quote.CancelNotes : "N/A"; model.Status = quote.IsOpen ? "Open" : quote.IsCanceled ? "Canceled" : quote.IsHold ? "On Hold" : "N/A"; model.Machining = quote.IsMachined == true ? "Included" : "Not Included"; if (quoteParts != null) { model.QuoteParts = new List <QuotePartViewModel>(); foreach (var quotePart in quoteParts) { var quotePartModel = new QuotePartConverter().ConvertToView(quotePart); model.QuoteParts.Add(quotePartModel); } } if (_rfqRepository != null) { _rfqRepository.Dispose(); _rfqRepository = null; } if (_customerDynamicsRepository != null) { _customerDynamicsRepository.Dispose(); _customerDynamicsRepository = null; } if (_customerAddressDynamicsRepository != null) { _customerAddressDynamicsRepository.Dispose(); _customerAddressDynamicsRepository = null; } if (_stateRepository != null) { _stateRepository.Dispose(); _stateRepository = null; } if (_shipmentTermRepository != null) { _shipmentTermRepository.Dispose(); _shipmentTermRepository = null; } if (_paymentTermRepository != null) { _paymentTermRepository.Dispose(); _paymentTermRepository = null; } if (_materialRepository != null) { _materialRepository.Dispose(); _materialRepository = null; } if (_coatingTypeRepository != null) { _coatingTypeRepository.Dispose(); _coatingTypeRepository = null; } if (_htsNumberRepository != null) { _htsNumberRepository.Dispose(); _htsNumberRepository = null; } if (_projectReposiotry != null) { _projectReposiotry.Dispose(); _projectReposiotry = null; } return(model); }
/// <summary> /// convert customer to view model /// </summary> /// <param name="customer"></param> /// <returns></returns> public CustomerViewModel ConvertToView(RM00101_Customer customer) { CustomerViewModel model = new CustomerViewModel(); var _salespersonDynamicsRepository = new SalespersonDynamicsRepository(); var _paymentTermRepository = new PaymentTermRepository(); var _shipmentTermRepository = new ShipmentTermRepository(); var _stateRepository = new StateRepository(); var _countryRepository = new CountryRepository(); var dyanmicsSalesperson = _salespersonDynamicsRepository.GetSalesperson(customer.SLPRSNID); var state = _stateRepository.GetState(customer.STATE); var country = _countryRepository.GetCountry(customer.COUNTRY); var paymentTerm = _paymentTermRepository.GetPaymentTerm(customer.PYMTRMID); model.CustomerId = customer.CUSTNMBR; model.CustomerNumber = customer.CUSTNMBR; model.CustomerName = (!string.IsNullOrEmpty(customer.CUSTNAME.Replace(" ", string.Empty))) ? customer.CUSTNAME : "N/A"; model.ShortName = (!string.IsNullOrEmpty(customer.SHRTNAME.Replace(" ", string.Empty))) ? customer.SHRTNAME : "N/A"; model.SalespersonName = (dyanmicsSalesperson != null) ? dyanmicsSalesperson.SLPRSNFN + " " + dyanmicsSalesperson.SPRSNSLN : "N/A"; model.SalesTerritoryDescription = (!string.IsNullOrEmpty(customer.SALSTERR.Replace(" ", string.Empty))) ? customer.SALSTERR : "N/A"; model.ContactName = (!string.IsNullOrEmpty(customer.CNTCPRSN)) ? customer.CNTCPRSN : "N/A"; model.ContactPhone = FormattingManager.FormatPhone(customer.PHONE1); model.FaxNumber = FormattingManager.FormatPhone(customer.FAX); model.Address1 = (!string.IsNullOrEmpty(customer.ADDRESS1)) ? customer.ADDRESS1 : "N/A"; model.City = (!string.IsNullOrEmpty(customer.CITY)) ? customer.CITY : "N/A"; model.StateName = (state != null) ? state.Name : "N/A"; model.CountryName = (country != null) ? country.Name : "N/A"; model.PostalCode = (!string.IsNullOrEmpty(customer.ZIP)) ? customer.ZIP : "N/A"; model.PaymentTermDescription = (paymentTerm != null && !string.IsNullOrEmpty(paymentTerm.Description)) ? paymentTerm.Description : "N/A"; model.IsActive = customer.INACTIVE != 1 ? true : false; if (_salespersonDynamicsRepository != null) { _salespersonDynamicsRepository.Dispose(); _salespersonDynamicsRepository = null; } if (_paymentTermRepository != null) { _paymentTermRepository.Dispose(); _paymentTermRepository = null; } if (_shipmentTermRepository != null) { _shipmentTermRepository.Dispose(); _shipmentTermRepository = null; } if (_stateRepository != null) { _stateRepository.Dispose(); _stateRepository = null; } if (_countryRepository != null) { _countryRepository.Dispose(); _countryRepository = null; } return(model); }