Beispiel #1
0
        private ValidacionOperacionResponse CapturaLecturaLuzFinDiaInternal(CapturaLuzRequest capturaLuzRequest)
        {
            String respuestaProxy = "Error al ejecutar el proceso";
            FechaOperacionResponse      fechaOperacionResponse      = new FechaOperacionResponse();
            ValidacionOperacionResponse validacionOperacionResponse = new ValidacionOperacionResponse();

            // Realizar Fin de día con WS Milano
            // -- Inicia Se valida si no está disponible el WS
            try
            {
                respuestaProxy = proxy.CapturaCierre(token.CodeStore, token.CodeEmployee, token.CodeBox, fechaOperacionResponse.FechaOperacion, capturaLuzRequest.ValorLecturaAdicional, capturaLuzRequest.ValorLectura);
                if (respuestaProxy == "100")
                {
                    // Respuesta Web Service Milano OK
                    fechaOperacionResponse = lecturaLuzRepository.CapturaLecturaLuzFinDia(token.CodeStore, token.CodeBox, token.CodeEmployee, capturaLuzRequest);
                    validacionOperacionResponse.CodeNumber      = fechaOperacionResponse.CodeNumber;
                    validacionOperacionResponse.CodeDescription = fechaOperacionResponse.CodeDescription;
                }
                else
                {
                    // Respuesta Web Service Milano ERROR
                    validacionOperacionResponse.CodeDescription = respuestaProxy;
                }
            }
            catch (Exception exeption)
            {
                // El Web Service no está disponible, mando un error por cualquier razón. Se ignora la captura de luz al final del día
                fechaOperacionResponse = lecturaLuzRepository.CapturaLecturaLuzFinDia(token.CodeStore, token.CodeBox, token.CodeEmployee, capturaLuzRequest);
                validacionOperacionResponse.CodeNumber      = fechaOperacionResponse.CodeNumber;
                validacionOperacionResponse.CodeDescription = fechaOperacionResponse.CodeDescription + ". Registro Offline";;
            }
            // -- Termina Se valida si no está disponible el WS
            return(validacionOperacionResponse);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="codeStore"></param>
        /// <param name="codeBox"></param>
        /// <param name="codeEmployee"></param>
        /// <param name="capturaLuzRequest"></param>
        /// <returns></returns>
        public FechaOperacionResponse CapturaLecturaLuzFinDia(int codeStore, int codeBox, int codeEmployee, CapturaLuzRequest capturaLuzRequest)
        {
            FechaOperacionResponse fechaOperacionResponse = new FechaOperacionResponse();
            var parametros = new Dictionary <string, object>();

            parametros.Add("@CodigoTienda", codeStore);
            parametros.Add("@CodigoCaja", codeBox);
            parametros.Add("@CodigoEmpleado", codeEmployee);
            parametros.Add("@ValorLectura", capturaLuzRequest.ValorLectura);
            parametros.Add("@ValorLecturaAdicional", capturaLuzRequest.ValorLecturaAdicional);
            List <System.Data.SqlClient.SqlParameter> parametrosOut = new List <System.Data.SqlClient.SqlParameter>();

            parametrosOut.Add(new System.Data.SqlClient.SqlParameter()
            {
                ParameterName = "@FechaOperacion", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Date
            });
            parametrosOut.Add(new System.Data.SqlClient.SqlParameter()
            {
                ParameterName = "@CodigoResultado", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
            });
            parametrosOut.Add(new System.Data.SqlClient.SqlParameter()
            {
                ParameterName = "@MensajeResultado", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.NVarChar, Size = 4000
            });
            var resultado = data.ExecuteProcedure("[dbo].[sp_vanti_server_CapturaLuzFinDia]", parametros, parametrosOut);

            fechaOperacionResponse.FechaOperacion  = Convert.ToDateTime(resultado["@FechaOperacion"]);
            fechaOperacionResponse.CodeNumber      = resultado["@CodigoResultado"].ToString();
            fechaOperacionResponse.CodeDescription = resultado["@MensajeResultado"].ToString();
            return(fechaOperacionResponse);
        }