Esempio n. 1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaciones())
                {
                    return;
                }

                DateTime fechaEmitido = DateTime.Now;

                Pedido p = (Pedido)pedidoBindingSource.Current;

                p.FechaEmitido = fechaEmitido;
                p.Departamento = (Departamento)cbDepartamento.SelectedItem;
                p.Activo       = true;

                DatosPedido.Modificar(p);
                Close();
            }
            catch
            {
                MessageBox.Show("Complete todos los campos");
            }
        }
Esempio n. 2
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            DateTime fechaEmitido = DateTime.Now;
            Usuario  u            = DatosUsuario.getUsuarioPorLogin(GlobalClass.GlobalVar);

            Pedido pedido = new Pedido();

            pedido.Concepto     = "";
            pedido.Descripcion  = "";
            pedido.FechaEmitido = fechaEmitido;
            pedido.Usuario      = (Usuario)DatosUsuario.getUsuario(u.Id);
            pedido.Departamento = (Departamento)DatosDepartamento.getDepartamento(1);
            pedido.Activo       = true;
            DatosPedido.Crear(pedido);

            FrmEditarPedido p = new FrmEditarPedido((int)DatosPedido.getUltimoPedido());

            p.ShowDialog();

            if (this.btnRecibidos.Checked == true)
            {
                Actualizar();
            }
            else
            {
                ActualizarEnviados();
            }
        }
Esempio n. 3
0
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            Pedido p = (Pedido)pedidoBindingSource.Current;

            if (MessageBox.Show("¿Esta seguro de eliminar el pedido?", "Eliminar", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                DatosPedido.Eliminar(p);
                Close();
            }
        }
Esempio n. 4
0
        private void btnSalir_Click(object sender, EventArgs e)
        {
            Usuario u = DatosUsuario.getUsuarioPorLogin(GlobalClass.GlobalVar);

            Pedido p = (Pedido)pedidoBindingSource.Current;

            if (p.Departamento.Nombre == u.Departamento.Nombre && p.Activo)
            {
                p.Activo = false;
            }

            DatosPedido.Modificar(p);
            Close();
        }
Esempio n. 5
0
        private void ActualizarEnviados()
        {
            try
            {
                Usuario u = DatosUsuario.getUsuarioPorLogin(GlobalClass.GlobalVar);

                if (txtBuscar.Text == "Buscar" || txtBuscar.Text == "")
                {
                    pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoEnviadosUsuarioId(u.Id);
                }
            }
            catch
            {
            }
        }
Esempio n. 6
0
        private void Actualizar()
        {
            try
            {
                Usuario      u = DatosUsuario.getUsuarioPorLogin(GlobalClass.GlobalVar);
                Departamento d = DatosDepartamento.getDepartamento(u.Departamento.Id);

                if (txtBuscar.Text == "Buscar" || txtBuscar.Text == "")
                {
                    pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoRecibidosUsuarioId(d.Id);
                }
            }
            catch
            {
            }
        }
Esempio n. 7
0
        public FrmVerPedido(int id)
        {
            InitializeComponent();
            this.id = id;
            Actualizar();

            pedidoBindingSource.Add(DatosPedido.getPedido(id));
            Pedido p = (Pedido)pedidoBindingSource.Current;

            this.txtDeptoDestino.Text = p.Departamento.Nombre;
            this.txtDeptoOrigen.Text  = p.Usuario.Departamento.Nombre;
            this.txtConcepto.Text     = p.Concepto;
            this.txtDescripcion.Text  = p.Descripcion;
            if (p.Concepto != "")
            {
                this.Text = "Pedido de " + p.Concepto;
            }
        }
Esempio n. 8
0
        private List <DatosPedido> ConvertirDatosToDTO(string[] _DatosArchivo)
        {
            List <DatosPedido> lstDatosPedidos = new List <DatosPedido>();

            foreach (var item in _DatosArchivo)
            {
                var         datosSplit = item.Split(',');
                DatosPedido entDatos   = new DatosPedido();
                entDatos.cOrigen          = datosSplit[0];
                entDatos.cDestino         = datosSplit[1];
                entDatos.dDistancia       = decimal.Parse(datosSplit[2]);
                entDatos.cPaqueteria      = datosSplit[3];
                entDatos.cMedioTransporte = datosSplit[4];
                entDatos.dtFechaPedido    = DateTime.Parse(datosSplit[5]);
                lstDatosPedidos.Add(entDatos);
            }

            return(lstDatosPedidos);
        }
Esempio n. 9
0
        public FrmEditarPedido(int id)
        {
            InitializeComponent();
            this.id = id;
            Actualizar();

            pedidoBindingSource.Add(DatosPedido.getPedido(id));

            this.cbDepartamento.ComboBox.DataSource    = DatosDepartamento.getDepartamentos();
            this.cbDepartamento.ComboBox.ValueMember   = "id";
            this.cbDepartamento.ComboBox.DisplayMember = "nombre";

            Pedido p = (Pedido)pedidoBindingSource.Current;

            if (p.Concepto != "")
            {
                this.Text = "Editar " + p.Concepto;
            }
            this.conceptoTextBox.TextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.pedidoBindingSource, "Concepto", true));
        }
Esempio n. 10
0
        public List <DatosPedido> ObtenerDatosPedido(DatosPedidosJson _lstDatosJson)
        {
            List <DatosPedido> lstDatosPedidos = new List <DatosPedido>();

            if (_lstDatosJson.Pedidos != null)
            {
                foreach (var item in _lstDatosJson.Pedidos)
                {
                    DatosPedido entDatos = new DatosPedido();
                    entDatos.cDestino         = item.Destino;
                    entDatos.cOrigen          = item.Procedencia;
                    entDatos.cMedioTransporte = item.MedioTrans;
                    entDatos.cPaqueteria      = item.Empresa;
                    entDatos.dDistancia       = item.Dist_KM;
                    //entDatos.dtFechaPedido = DateTime.ParseExact(item.FechaPedido, "dd-MM-yyyy HH:mm tt", null);
                    entDatos.dtFechaPedido = DateTime.Parse(item.FechaPedido);

                    lstDatosPedidos.Add(entDatos);
                }
            }


            return(lstDatosPedidos);
        }
Esempio n. 11
0
 public EmpresaFactory(ITransporte _Transporte, DatosPedido _Datos, DatosConfiguracion _entDatosConfig)
 {
     Transporte     = _Transporte;
     DatosPedido    = _Datos;
     entDatosConfig = _entDatosConfig;
 }
Esempio n. 12
0
 // Método de Pago: SI
 private void GenerarPedido_Safetypay_Internacional(DatosPedido pedido,
                                                    Models.PedidoRS resultPedido,
                                                    UsuarioLogin DtsUsuarioLogin)
 {
 }
Esempio n. 13
0
 // Método de Pago: IN { Descartado en el proyecto }
 private void GenerarPedido_Independencia(DatosPedido pedido,
                                          Models.PedidoRS resultPedido,
                                          UsuarioLogin DtsUsuarioLogin)
 {
 }
Esempio n. 14
0
        // Método de Pago: PE
        private void GenerarPedido_Pago_Efectivo(DatosPedido pedido,
                                                 Models.PedidoRS resultPedido,
                                                 UsuarioLogin DtsUsuarioLogin)
        {
            DateTime datFechaActual     = DateTime.Now;
            var      ddlHoraExpiraCIP   = pedido.TiempoExpiracionCIP ?? 0;
            var      datFechaExpiraPago = datFechaActual.AddHours(ddlHoraExpiraCIP);

            resultPedido.FechaExpiracion = datFechaExpiraPago;

            var intIdFormaPago = Constantes_FileRetail.INT_ID_FORMA_PAGO_PAGOEFECTIVO_EC;

            try
            {
                var strEmailsCliPE = pedido.Email;
                var dblMontoPagar  = pedido.MontoPagar;
                var intIdPedido    = resultPedido.IdPedido;

                var intIdWeb    = pedido.IdWeb;
                var intIdLang   = pedido.IdLang;
                var intIdCotVta = pedido.IdCotVta;

                // Dim paymentRequest As New BEGenRequest
                var paymentRequest = new ws_pagoefectivo.BEGenRequest();

                paymentRequest.IdMoneda       = ConfigAccess.GetValueInAppSettings("PE_MONEDA");
                paymentRequest.Total          = dblMontoPagar.ToString("0.00");
                paymentRequest.MetodosPago    = ConfigAccess.GetValueInAppSettings("PE_MEDIO_PAGO");
                paymentRequest.Codtransaccion = intIdPedido.ToString("");
                paymentRequest.ConceptoPago   = string.Format("{0}: Orden {1}",
                                                              ConfigAccess.GetValueInAppSettings("PE_COMERCIO_CONCEPTO_PAGO"),
                                                              paymentRequest.Codtransaccion);
                paymentRequest.EmailComercio    = strEmailsCliPE;
                paymentRequest.FechaAExpirar    = datFechaExpiraPago.ToString("yyyy-MM-dd");
                paymentRequest.UsuarioNombre    = DtsUsuarioLogin.LoginUsuario;
                paymentRequest.UsuarioApellidos = DtsUsuarioLogin.ApePatUsuario;
                paymentRequest.UsuarioEmail     = DtsUsuarioLogin.EmailUsuario;
                paymentRequest.IdDepartamento   = DtsUsuarioLogin.IdDep;
                paymentRequest.IdOficina        = DtsUsuarioLogin.IdOfi;

                var paymentResponse = (new ws_pagoefectivo.ws_PagoEfectivo()).GenerarCIP(paymentRequest);

                // Reintento de GENERACIÓN DE CIP
                if (paymentResponse == null || paymentResponse.Estado != "1" || paymentResponse.Token == null)
                {
                    paymentResponse = (new ws_pagoefectivo.ws_PagoEfectivo()).GenerarCIP(paymentRequest);
                }

                var strCIP = resultPedido.CodigoCIP = paymentResponse.NumeroCip;

                //  Enviar correo
                var objEnviarCorreo = new EnviarCorreo();
                var strEmailsCli    = pedido.Email;

                if (Enviar_SolicitudPagoServicioPagoEfectivo(
                        intIdWeb ?? 0,
                        intIdLang ?? 0,
                        intIdCotVta,
                        strEmailsCli,
                        null,
                        pedido.NombreClienteCot,
                        pedido.ApellidoClienteCot,
                        null,
                        DtsUsuarioLogin.NomCompletoUsuario,
                        DtsUsuarioLogin.EmailUsuario,
                        short.Parse(pedido.FormaPago),
                        strCIP,
                        string.Empty,
                        intIdPedido,
                        dblMontoPagar,
                        datFechaExpiraPago))
                {
                    resultPedido.CorreoEnviado = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 15
0
        // Método de Pago: SO
        private void GenerarPedido_Safetypay_Online(DatosPedido pedido,
                                                    Models.PedidoRS resultPedido,
                                                    UsuarioLogin DtsUsuarioLogin)
        {
            var strEmailsCli  = pedido.Email;
            var ws_SafetyPay  = new ws_compra.ws_compra();
            var request       = new CustomOnlinePaymentRequestType();
            var objAmountType = new ws_compra.AmountType();

            objAmountType.CurrencyID        = CurrencyEnumType.USD.ToString();
            objAmountType.Value             = decimal.TryParse(pedido.MontoPagar.ToString(), out decimal dblMontoPagar) ? dblMontoPagar : 0;
            request.BankID                  = string.Empty;
            request.TransactionIdentifier   = string.Empty;
            request.MerchantAccount         = string.Empty;
            request.MerchantSalesID         = resultPedido.IdPedido.ToString();
            request.TrackingCode            = "0";
            request.ExpirationTime          = pedido.TiempoExpiracionCIP ?? 0 * 60;
            request.ExpirationTimeSpecified = true;

            request.Language         = pedido.IdWeb == Webs_Cid.DM_WEB_ID ? "PE": "ES";
            request.CountryID        = "PER";
            request.Amount           = objAmountType;
            request.TransactionOkURL = pedido.IdWeb == Webs_Cid.DM_WEB_ID ?
                                       "http://www.destinosmundialesperu.com/" :
                                       "http://www.nmviajes.com/";
            request.TransactionErrorURL = pedido.IdWeb == Webs_Cid.DM_WEB_ID ?
                                          "http://www.destinosmundialesperu.com/" :
                                          "http://www.nmviajes.com/seguros#";

            request.SendEmailToShopper = true;
            if (request.SendEmailToShopper)
            {
                request.CustomerInformation_Value = DtsUsuarioLogin.EmailUsuario;
            }
            request.IdDepartamento = DtsUsuarioLogin.IdDep;
            request.IdOficina      = DtsUsuarioLogin.IdOfi;
            request.ApplicationID  = (short)(pedido.IdWeb ?? 0);


            //var respond As ws_srv_gnm.ws_compra.RptaPagoSafetyPay
            ws_compra.RptaPagoSafetyPay respond;
            if (pedido.IdWeb == Webs_Cid.DM_WEB_ID)
            {
                request.WebId = pedido.IdWeb ?? 0;
                respond       = ws_SafetyPay.GenerarPago_SafetyPay_OnlineDM(request);
            }
            else
            {
                request.IdDepartamento = DtsUsuarioLogin.IdDep;
                request.IdOficina      = DtsUsuarioLogin.IdOfi;
                respond = ws_SafetyPay.GenerarPago_SafetyPay_Online(request);
            }


            var objRptaPagoSafetyPay = (new Pedido_AW_Repository()).Get_Rpta_SagetyPay(resultPedido.IdPedido);

            var lstPaymentType = new List <Models.PaymentLocationType>();

            if (respond.lst_PaymentLocationType != null)
            {
                var lstPaymentStep         = new List <Models.PaymentStepType>();
                var lstPaymentInstructions = new List <Models.PaymentInstructionType>();

                foreach (var objPaymentLocationTypeRSTmp in respond.lst_PaymentLocationType)
                {
                    var objPaymentLocationTypeRS = new Models.PaymentLocationType();
                    objPaymentLocationTypeRS.Id = objPaymentLocationTypeRSTmp.ID;

                    foreach (var objPaymentStepRSTmp in objPaymentLocationTypeRSTmp.lst_PaymentStepType)
                    {
                        var objPaymentStepRS = new Models.PaymentStepType();
                        objPaymentStepRS.Step          = objPaymentStepRSTmp.Step;
                        objPaymentStepRS.StepSpecified = objPaymentStepRSTmp.StepSpecified;
                        objPaymentStepRS.Value         = objPaymentStepRSTmp.Value;
                        lstPaymentStep.Add(objPaymentStepRS);
                    }

                    if (objPaymentLocationTypeRSTmp.PaymentInstructions != null)
                    {
                        foreach (var objPaymentInstructionTypeRSTmp in objPaymentLocationTypeRSTmp.PaymentInstructions)
                        {
                            var objPaymentInstructionsRS = new Models.PaymentInstructionType();
                            objPaymentInstructionsRS.Name  = objPaymentInstructionTypeRSTmp.Name;
                            objPaymentInstructionsRS.Value = objPaymentInstructionTypeRSTmp.Value;
                            lstPaymentInstructions.Add(objPaymentInstructionsRS);
                        }
                    }

                    objPaymentLocationTypeRS.lstPaymentStepType = lstPaymentStep;
                    objPaymentLocationTypeRS.Name = objPaymentLocationTypeRSTmp.Name;
                    objPaymentLocationTypeRS.PaymentInstructions = lstPaymentInstructions.ToArray();
                    objPaymentLocationTypeRS.PaymentSteps        = lstPaymentStep.ToArray();
                    lstPaymentType.Add(objPaymentLocationTypeRS);
                }
            }
            var intIdFormaPago = Constantes_Pedido.ID_FORMA_PAGO_SAFETYPAY_ONLINE;

            try
            {
                var objEnviarCorreo = new EnviarCorreo();
                var datFechaActual  = DateTime.Now;
                //var datFechaExpiraPago As Date
                var strExpirationDateTime = respond.ExpirationDateTime;
                var arrExp             = strExpirationDateTime.Split('(');
                var datFechaExpiraPago = resultPedido.FechaExpiracion = datFechaActual.AddHours(pedido.TiempoExpiracionCIP ?? 0);

                resultPedido.CorreoEnviado = objEnviarCorreo.Enviar_SolicitudPagoServicioSafetyPay(
                    pedido.IdUsuario.ToString(),
                    Convert.ToInt32(pedido.IdWeb),
                    Convert.ToInt32(pedido.IdLang),
                    pedido.IdCotVta,
                    pedido.Email,
                    null,
                    pedido.NombreClienteCot,
                    pedido.ApellidoClienteCot,
                    null,
                    DtsUsuarioLogin.NomCompletoUsuario,
                    DtsUsuarioLogin.EmailUsuario,
                    (pedido.CodePasarelaPago == Constantes_SafetyPay.CodeSafetyPayOnline ? Constantes_Pedido.ID_FORMA_PAGO_SAFETYPAY_ONLINE : Convert.ToInt16(0)),
                    objRptaPagoSafetyPay.TransaccionIdentifier,
                    resultPedido.IdPedido,
                    Convert.ToDouble(pedido.Monto),
                    objRptaPagoSafetyPay.ExpirationDateTime,
                    objRptaPagoSafetyPay.lstAmountType,
                    lstPaymentType);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 16
0
 public MensajesService(DatosPedido _Datos)
 {
     Datos = _Datos;
 }
Esempio n. 17
0
        private void txtBuscar_KeyUp(object sender, KeyEventArgs e)
        {
            Usuario      u = DatosUsuario.getUsuarioPorLogin(GlobalClass.GlobalVar);
            Departamento d = DatosDepartamento.getDepartamento(u.Departamento.Id);

            try
            {
                if (txtBuscar.Text == "")
                {
                    if (this.btnRecibidos.Checked == true)
                    {
                        Actualizar();
                    }
                    else
                    {
                        ActualizarEnviados();
                    }
                }

                if (cbSelector.SelectedIndex == 0)
                {
                    if (this.btnEnviados.Checked == true)
                    {
                        pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoEnviadosUsuarioIdConcepto(u.Id, txtBuscar.Text);
                    }
                    else
                    {
                        pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoRecibidosUsuarioIdConcepto(d.Id, txtBuscar.Text);
                    }
                }
                else if (cbSelector.SelectedIndex == 1)
                {
                    if (this.btnEnviados.Checked == true)
                    {
                        pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoEnviadosUsuarioIdDescripcion(u.Id, txtBuscar.Text);
                    }
                    else
                    {
                        pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoRecibidosUsuarioIdDescripcion(d.Id, txtBuscar.Text);
                    }
                }
                else if (cbSelector.SelectedIndex == 2)
                {
                    if (this.btnEnviados.Checked == true)
                    {
                        pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoEnviadosUsuarioIdDepartamentoDestino(u.Id, txtBuscar.Text);
                    }
                    else
                    {
                        pedidoBindingSource.DataSource = DatosPedido.getPedidosPorEstadoRecibidosUsuarioIdDepartamentoOrigen(d.Id, txtBuscar.Text);
                    }
                }
            }
            catch
            {
                MessageBox.Show("No se encontro nada en su busqueda");

                if (this.btnRecibidos.Checked == true)
                {
                    Actualizar();
                }
                else
                {
                    ActualizarEnviados();
                }
            }
        }
Esempio n. 18
0
        private void validacionPedido(ref DatosPedido _pedido, ref Models.PedidoRS _resultPedido, ref bool _return, ref UsuarioLogin UserLogin)
        {
            _return = false;
            string mensajeError = string.Empty;

            _pedido.IdLang = 1; _pedido.IdWeb = 0;
            string metodoDePago = string.Empty;

            if (_pedido.IdCotVta <= 0)
            {
                mensajeError += "Envie el codigo de SRV|";
            }
            if (string.IsNullOrEmpty(_pedido.NombreClienteCot) || string.IsNullOrEmpty(_pedido.ApellidoClienteCot))
            {
                mensajeError += "Envie los datos del SRV|";
            }
            if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_PAGOEFECTIVO)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_SAFETYPAY_CASH)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_SAFETYPAY_INTERN)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_SAFETYPAY_ONLINE)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_TARJETA_AMERICANEX)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_TARJETA_DINERS)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_TARJETA_MASTERCARD)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_TARJETA_MASTERCARD_CA)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }
            else if (_pedido.CodePasarelaPago == Constantes_MetodoDePago.CODE_FPAGO_TARJETA_VISA)
            {
                metodoDePago = _pedido.CodePasarelaPago;
            }

            if (string.IsNullOrEmpty(_pedido.CodePasarelaPago))
            {
                mensajeError += "Envie el tipo de pasarela|";
            }
            else if (!_pedido.CodePasarelaPago.Trim().Contains(metodoDePago))
            {
                mensajeError += "No se tiene registrado esta pasarela de pago|";
            }
            if (string.IsNullOrEmpty(_pedido.DetalleServicio))
            {
                mensajeError += "Envie el detalle del servicio|";
            }
            if (string.IsNullOrEmpty(_pedido.Email))
            {
                mensajeError += "Envie su Email|";
            }
            if (string.IsNullOrEmpty(_pedido.Monto))
            {
                mensajeError += "Envie el monto|";
            }
            if (!string.IsNullOrEmpty(_pedido.Monto) && _pedido.Monto.Contains(","))
            {
                mensajeError += "El uso de la coma (,) no es válido como separador decimal.";
            }
            if (_pedido.TiempoExpiracionCIP == null || _pedido.TiempoExpiracionCIP <= 0)
            {
                mensajeError += "Envie el tiempo de expiracion del CIP|";
            }
            if (_pedido.UnidadNegocio == null || string.IsNullOrEmpty(_pedido.UnidadNegocio.Descripcion)) /*Duda*/
            {
                mensajeError += "Envie los datos de su unidad de negocio|";
            }
            if (string.IsNullOrEmpty(_pedido.IdUsuario) == false && ValidateProcess.isInt32(_pedido.IdUsuario) == true)
            {
                /*Cargamos Datos del Usuario*/
                _datosUsuario = new DatosUsuario(_pedido.UnidadNegocio.ID);
                UserLogin     = _datosUsuario.Get_Dts_Usuario_Personal_NM(Convert.ToInt32(_pedido.IdUsuario));
                if (UserLogin == null)
                {
                    mensajeError += "ID del Usuario no registrado|";
                }
                else if (UserLogin.IdUsuario != Convert.ToInt32(_pedido.IdUsuario))
                {
                    _pedido.IdUsuario = UserLogin.IdUsuario.ToString();
                }
            }
            else
            {
                mensajeError += "Envie el ID del Usuario correctamente|";
            }
            if (string.IsNullOrEmpty(_pedido.IdOportunidad_SF))
            {
                mensajeError += "Envie el IdOportunidad_SF|";
            }
            if (string.IsNullOrEmpty(_pedido.IdSolicitudpago_SF))
            {
                mensajeError += "Envie el IdSolicitudpago_SF";
            }

            if (string.IsNullOrEmpty(mensajeError) == false)
            {
                _return = true;
                _resultPedido.CodigoError  = "ER";
                _resultPedido.MensajeError = "VP - " + mensajeError;
            }
            else
            {
                if (_pedido.IdCanalVta != null && _pedido.IdCanalVta == Constantes_Pedido.ID_CANAL_VENTA_CONTACT_CENTER)
                {
                    _pedido.IdWeb = Webs_Cid.ID_WEB_IA;
                }

                if (_pedido.IdWeb == 0)
                {
                    if ((UserLogin.IdOfi == Oficina.ID_OFI_NMV & UserLogin.IdDep == Departamento.ID_DEP_INTERNO) | (UserLogin.IdOfi == Oficina.ID_OFI_NMV & UserLogin.IdDep == Departamento.ID_DEP_RECEPTIVO) | (UserLogin.IdOfi == Oficina.ID_OFI_NMV & UserLogin.IdDep == Departamento.ID_DEP_OPERACIONES))
                    {
                        _pedido.IdWeb = Webs_Cid.ID_WEB_NMV_RECEPTIVO;
                    }
                    else if ((UserLogin.IdOfi == Oficina.ID_OFI_NMVCOM & UserLogin.IdDep == Departamento.ID_DEP_COUNTER) | (UserLogin.IdOfi == Oficina.ID_OFI_NMV & UserLogin.IdDep == Departamento.ID_DEP_SISTEMAS))
                    {
                        _pedido.IdWeb = Webs_Cid.NM_WEB_ID;
                    }
                    else
                    {
                        _pedido.IdWeb = Webs_Cid.ID_WEB_WEBFAREFINDER;
                    }
                }
            }
        }
Esempio n. 19
0
 public GeneradorMensajeFuturo(DatosPedido _Datos, string _cMensajeTiempoTranscurrido)
 {
     datos = _Datos;
     cMensajeTiempoTranscurrido = _cMensajeTiempoTranscurrido;
 }
Esempio n. 20
0
        // Método de Pago: SC
        private void GenerarPedido_Safetypay_Cash(DatosPedido pedido,
                                                  Models.PedidoRS resultPedido,
                                                  UsuarioLogin DtsUsuarioLogin)
        {
            Pedido_AW_Repository _pedidoRepository = new Pedido_AW_Repository();
            var errorPedido = string.Empty;

            /*Generamos el codigo en SafetyPay*/
            ws_compra.ws_compra          Ws_Compra   = new ws_compra.ws_compra();
            CustomCashPaymentRequestType requestCash = new CustomCashPaymentRequestType();

            ws_compra.AmountType objAmountType = new ws_compra.AmountType();

            objAmountType.CurrencyID = "150"; /*Valor del dolar para SafetyPay*/
            objAmountType.Value      = Convert.ToDecimal(pedido.Monto);

            requestCash.BankID                  = String.Empty;
            requestCash.IncludeAllBanks         = true;
            requestCash.TransactionIdentifier   = String.Empty;
            requestCash.MerchantAccount         = String.Empty;
            requestCash.MerchantSalesID         = resultPedido.IdPedido.ToString();
            requestCash.TrackingCode            = "";
            requestCash.ExpirationTime          = (Convert.ToInt16(pedido.TiempoExpiracionCIP) * 60);
            requestCash.ExpirationTimeSpecified = true;
            requestCash.Language                = (pedido.IdWeb == Webs_Cid.DM_WEB_ID ? "PE" : "ES");
            requestCash.CountryID               = "PER";
            requestCash.Amount                  = objAmountType;

            requestCash.SendEmailToShopper = true;
            if (requestCash.SendEmailToShopper)
            {
                requestCash.CustomerInformation_Value = DtsUsuarioLogin.EmailUsuario;
            }

            requestCash.CustomMerchantName = (pedido.IdWeb == Webs_Cid.DM_WEB_ID ? "Destinos Mundiales Perú" : "NMVIAJES");
            requestCash.ApplicationID      = Convert.ToInt16(pedido.IdWeb);

            ws_compra.RptaPagoSafetyPay response = new ws_compra.RptaPagoSafetyPay();
            if (pedido.IdWeb == Webs_Cid.DM_WEB_ID)
            {
                requestCash.WebId = Convert.ToString(pedido.IdWeb);
                response          = Ws_Compra.GenerarPago_SafetyPay_Cash_DM(requestCash);
            }
            else
            {
                requestCash.IdDepartamento = DtsUsuarioLogin.IdDep;
                requestCash.IdOficina      = DtsUsuarioLogin.IdOfi;
                response = Ws_Compra.GenerarPago_SafetyPay_Cash(requestCash);
            }

            if (response.OperationId != null && response.TransaccionIdentifier != null)
            {
                resultPedido.CodigoOperacion   = response.OperationId;
                resultPedido.CodigoTransaction = response.TransaccionIdentifier;

                resultPedido.CodigoError  = "OK";
                resultPedido.MensajeError = "Se generó el código de pedido.";
            }
            else
            {
                resultPedido.CodigoError = "ER"; resultPedido.MensajeError = "GP - Error al intentar generar el CIP";
                //return Ok(resultPedido);
            }

            Models.RptaPagoSafetyPay RptaPagoSafetyPayBD = _pedidoRepository.Get_Rpta_SagetyPay(resultPedido.IdPedido);

            List <Models.PaymentLocationType> lstPaymentType = new List <Models.PaymentLocationType>();

            if (response.lst_PaymentLocationType != null)
            {
                List <Models.PaymentStepType>        lstPaymentStep         = new List <Models.PaymentStepType>();
                List <Models.PaymentInstructionType> lstPaymentInstructions = new List <Models.PaymentInstructionType>();
                foreach (ws_compra.PaymentLocationType objPaymentLocationTypeRSTmp in response.lst_PaymentLocationType)
                {
                    Models.PaymentLocationType objPaymentLocationTypeRS = new Models.PaymentLocationType();
                    objPaymentLocationTypeRS.Id = objPaymentLocationTypeRSTmp.ID;

                    foreach (ws_compra.PaymentStepType objPaymentStepRSTmp in objPaymentLocationTypeRSTmp.lst_PaymentStepType)
                    {
                        Models.PaymentStepType objPaymentStepRS = new Models.PaymentStepType();
                        objPaymentStepRS.Step          = objPaymentStepRSTmp.Step;
                        objPaymentStepRS.StepSpecified = objPaymentStepRSTmp.StepSpecified;
                        objPaymentStepRS.Value         = objPaymentStepRSTmp.Value;
                        lstPaymentStep.Add(objPaymentStepRS);
                    }

                    if (objPaymentLocationTypeRSTmp.PaymentInstructions != null)
                    {
                        foreach (ws_compra.PaymentInstructionType objPaymentInstructionTypeRSTmp in objPaymentLocationTypeRSTmp.PaymentInstructions)
                        {
                            Models.PaymentInstructionType objPaymentInstructionsRS = new Models.PaymentInstructionType();
                            objPaymentInstructionsRS.Name  = objPaymentInstructionTypeRSTmp.Name;
                            objPaymentInstructionsRS.Value = objPaymentInstructionTypeRSTmp.Value;
                            lstPaymentInstructions.Add(objPaymentInstructionsRS);
                        }
                    }

                    objPaymentLocationTypeRS.lstPaymentStepType = lstPaymentStep;
                    objPaymentLocationTypeRS.Name = objPaymentLocationTypeRSTmp.Name;
                    objPaymentLocationTypeRS.PaymentInstructions = lstPaymentInstructions.ToArray();
                    objPaymentLocationTypeRS.PaymentSteps        = lstPaymentStep.ToArray();
                    lstPaymentType.Add(objPaymentLocationTypeRS);
                }
            }

            /*Realizamos el envio del correo*/
            try
            {
                IEnviarCorreo objEnviarCorreo = new EnviarCorreo(pedido.UnidadNegocio.ID);
                DateTime      datFechaActual  = DateTime.Now;
                DateTime      datFechaExpiraPago;
                string        strExpirationDateTime = response.ExpirationDateTime;
                string[]      arrExp = strExpirationDateTime.Split('(');
                datFechaExpiraPago = datFechaActual.AddHours(Convert.ToInt16(pedido.TiempoExpiracionCIP));

                resultPedido.CorreoEnviado = objEnviarCorreo.Enviar_SolicitudPagoServicioSafetyPay(
                    pedido.IdUsuario.ToString(), Convert.ToInt32(pedido.IdWeb), Convert.ToInt32(pedido.IdLang),
                    pedido.IdCotVta, pedido.Email, null, pedido.NombreClienteCot, pedido.ApellidoClienteCot, null,
                    DtsUsuarioLogin.NomCompletoUsuario, DtsUsuarioLogin.EmailUsuario,
                    (pedido.CodePasarelaPago == Constantes_SafetyPay.CodeSafetyPayCash ? Constantes_Pedido.ID_FORMA_PAGO_SAFETYPAY_CASH : Convert.ToInt16(0)),
                    RptaPagoSafetyPayBD.TransaccionIdentifier, resultPedido.IdPedido, Convert.ToDouble(pedido.Monto),
                    RptaPagoSafetyPayBD.ExpirationDateTime, RptaPagoSafetyPayBD.lstAmountType, lstPaymentType);
                objEnviarCorreo = null;
            }
            catch (Exception ex)
            {
                errorPedido = "Error al enviar el correo |" + ex.Message;
                /*return InternalServerError(ex);*/
            }
        }