コード例 #1
0
 public UnitMeasurementDTO getById(int id)
 {
     return((UnitMeasurementDTO)unitMeasurementRepository.getById(id));
 }
コード例 #2
0
        public QuotationDetailsViewDTO create(QuotationDTO quotation)
        {
            // registrar solicitud de cotizacion en azure db
            var quotationCreated = (QuotationDTO)quotationRepository.create(quotation);
            // obtener la afiliacion origen de la cotizacion
            var associatedAffiliation = (MembershipDTO)membershipRepository.getById(quotation.id_membership.GetValueOrDefault());

            QuotationDetailsViewDTO quotationDetails = default;

            quotationDetails = new QuotationDetailsViewDTO
            {
                name        = quotation.name,
                company     = quotation.company_name,
                phone       = quotation.phone,
                email       = quotation.email_from,
                serviceType = serviceTypeMembershipRepository.getById(quotation.idServiceType, includes: "TipoServicio").TipoServicio.servicio,
                comment     = quotation.comment
            };
            switch (quotationDetails.serviceType)
            {
            case "Transporte Urbano en SCZ":
                // sin campo en particular
                break;

            case "Almacenamiento de Carga en SCZ":
                quotationDetails.storageCapacity = $"{quotation.storageCapacity} {((UnitMeasurementDTO)unitMeasurementRepository.getById(quotation.idUmStorageCapacity.GetValueOrDefault())).abbreviation}.";

                quotationDetails.storageTime = $"{quotation.storageTime} {((UnitMeasurementDTO)unitMeasurementRepository.getById(quotation.idUmStorageTime.GetValueOrDefault())).abbreviation}.";;
                break;

            case "Transporte Nacional":
                quotationDetails.cityOrigin      = quotation.routeCityOrigin;
                quotationDetails.cityDestination = quotation.routeCityDestination;
                break;

            case "Transporte Internacional":
                quotationDetails.countryOrigin      = ((RouteDTO)routeRepository.getById(quotation.idMacroRouteOrigin.GetValueOrDefault())).name;
                quotationDetails.cityOrigin         = quotation.routeCityOrigin;
                quotationDetails.countryDestination = ((RouteDTO)routeRepository.getById(quotation.idMacroRouteDestination.GetValueOrDefault())).name;
                quotationDetails.cityDestination    = quotation.routeCityDestination;
                break;

            case "Ruta Urbana SCZ":
                quotationDetails.street = quotation.street;
                break;

            default:
                break;
            }
            if (!quotationDetails.serviceType.Equals("Almacenamiento de Carga en SCZ"))
            {
                quotationDetails.loadWeight = $"{quotation.loadWeight} Tn.";
                quotationDetails.loadVolume = $"{quotation.loadVolume} m3";
            }
            switch (associatedAffiliation.company)
            {
            case "Delta Cargo SRL":     // registrar solicitud de cotizacion en ERP Odoo

                quotation.kanban_state = "grey";
                quotation.type         = "lead";

                // Crear el View Model para registrar el campo "internal notes" en oodo
                quotation.description = getDescriptionQuotationWithFormat(quotationDetails);
                quotationRepository.createInERP(quotation);
                break;

            case "Delta Express":     // solo se debe registrar en DeltaDB

                break;

            default:
                break;
            }
            return(quotationDetails);
        }