Esempio n. 1
0
        public ResponseDTO CrearMesa(CrearMesaDTO mesaDTO)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);
            var responseDTO = new ResponseDTO();

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_MESA";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(mesaDTO.nombre);
            inParam.Add(mesaDTO.cantidadPersonas.ToString());
            inParam.Add(mesaDTO.estadoMesa.ToString());
            inParam.Add(mesaDTO.categoriaMesa.ToString());
            outParam.Add("o_result");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code    = 0;
                response.message = "OK";
            }
            else
            {
                response.code    = 999;
                response.message = String.Concat("NoOk - ", result[0].ToString());
            }

            return(response);
        }
Esempio n. 2
0
        public ResponseDTO CreateReserve(CreateReserveDTO createReserveDTO)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_RESERVA";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(createReserveDTO.isTotem);
            inParam.Add(createReserveDTO.cantPerson.ToString());
            inParam.Add(createReserveDTO.reserveDate);
            inParam.Add(createReserveDTO.usuarioEmail);
            inParam.Add(createReserveDTO.usuarioFono.ToString());

            outParam.Add("o_result");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code    = 0;
                response.message = "OK";
            }
            else
            {
                response.code    = 999;
                response.message = String.Concat("NoOk - ", result[0].ToString());
            }

            return(response);
        }
Esempio n. 3
0
        public ResponseDTO flow(int numero)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);
            var responseDTO = new ResponseDTO();

            string        packageName   = "PKG_TEST";
            string        procedureName = "TEST1";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(numero.ToString());
            outParam.Add("o_result");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code    = 0;
                response.message = "OK";
            }
            else
            {
                response.code    = 999;
                response.message = "NoOk";
            }

            return(response);
        }
Esempio n. 4
0
        public ResponseDTO CrearPedido(IngresarPedidoDTO pedidoDTO)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_PEDIDO";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            int id = 0;

            foreach (var producto in pedidoDTO.listaProducto)
            {
                inParam  = new List <string>();
                outParam = new List <string>();
                result   = new List <string>();

                inParam.Add(id.ToString());
                inParam.Add(pedidoDTO.usuarioId.ToString());
                inParam.Add(producto.productoId.ToString());
                inParam.Add(producto.cantidadProducto.ToString());
                inParam.Add(pedidoDTO.mesaId.ToString());
                inParam.Add(producto.observacion);

                outParam.Add("o_result");
                outParam.Add("o_id");

                result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

                if (result[0].ToString().Equals("OK"))
                {
                    response.code    = 0;
                    response.message = "OK";
                    id = Int32.Parse(result[1].ToString());
                }
                else
                {
                    response.code    = 999;
                    response.message = String.Concat("NoOk - ", result[0].ToString());
                }
            }

            return(response);
        }
Esempio n. 5
0
        public ResponseDTO createUser(CreateUserDTO createUserDTO)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);
            var responseDTO = new ResponseDTO();

            string        packageName   = "pkg_iteracion_1";
            string        procedureName = "CREATE_USER";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(createUserDTO.rut);
            inParam.Add(createUserDTO.name);
            inParam.Add(createUserDTO.lastName);
            inParam.Add(createUserDTO.motherName);
            inParam.Add(createUserDTO.birthdate);
            inParam.Add(createUserDTO.sexId.ToString());
            inParam.Add(createUserDTO.email);
            inParam.Add(createUserDTO.password);
            outParam.Add("o_result");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code    = 0;
                response.message = "OK";
            }
            else
            {
                response.code    = 999;
                response.message = String.Concat("NoOk - ", result[0].ToString());
            }

            return(response);
        }
Esempio n. 6
0
        public ResponseDTO CrearInsumo(CrearInsumoDTO insumoDTO)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);
            var responseDTO = new ResponseDTO();

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_INSUMO";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(insumoDTO.nombre);
            inParam.Add(insumoDTO.marca.ToString());
            inParam.Add(insumoDTO.categoriaInsumo.ToString());
            inParam.Add(insumoDTO.isActivo.ToString());
            inParam.Add(insumoDTO.precio.ToString());
            inParam.Add(insumoDTO.unidadMedida.ToString());
            outParam.Add("o_result");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code    = 0;
                response.message = "OK";
            }
            else
            {
                response.code    = 999;
                response.message = String.Concat("NoOk - ", result[0].ToString());
            }

            return(response);
        }
Esempio n. 7
0
        public ResponseProductoDTO CrearProducto(ProductoDTO productoDTO)
        {
            ResponseProductoDTO response = new ResponseProductoDTO();

            _IResultlSetHelper.setDataSource(conectionString);

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_PRODUCTO";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(productoDTO.nombre);
            inParam.Add(productoDTO.precio.ToString());
            inParam.Add(productoDTO.descripcion);
            inParam.Add(productoDTO.categoriaId.ToString());

            outParam.Add("o_result");
            outParam.Add("o_id");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code       = 0;
                response.message    = "OK";
                response.productoId = int.Parse(result[1].ToString());
            }
            else
            {
                response.code    = 999;
                response.message = String.Concat("NoOk - ", result[0].ToString());
            }

            return(response);
        }
Esempio n. 8
0
        public ResponseDTO CrearReceta(IngresarRecetaDTO recetaDTO)
        {
            ResponseDTO response = new ResponseDTO();

            _IResultlSetHelper.setDataSource(conectionString);

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_RECETA";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            foreach (var insumo in recetaDTO.listaInsumo)
            {
                inParam  = new List <string>();
                outParam = new List <string>();
                result   = new List <string>();

                inParam.Add(recetaDTO.productoId.ToString());
                inParam.Add(insumo.cantidad.ToString());
                inParam.Add(insumo.unidadMedidaId.ToString());
                inParam.Add(insumo.insumoId.ToString());

                outParam.Add("o_result");

                result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

                if (result[0].ToString().Equals("OK"))
                {
                    response.code    = 0;
                    response.message = "OK";
                }
                else
                {
                    response.code    = 999;
                    response.message = String.Concat("NoOk - ", result[0].ToString());
                }
            }

            return(response);
        }
Esempio n. 9
0
        public InsertarTrabajadorOutDTO InsertarTrabajador(InsertarTrabajadorInDTO trabajadorDTO)
        {
            InsertarTrabajadorOutDTO response = new InsertarTrabajadorOutDTO();

            _IResultlSetHelper.setDataSource(conectionString);

            string        packageName   = "pkg_iteracion_2";
            string        procedureName = "INSERTAR_TRABAJADOR";
            List <string> inParam       = new List <string>();
            List <string> outParam      = new List <string>();
            List <string> result        = new List <string>();

            inParam.Add(trabajadorDTO.rut.ToString());
            inParam.Add(trabajadorDTO.nombre);
            inParam.Add(trabajadorDTO.apellidoPat);
            inParam.Add(trabajadorDTO.apellidoMat);
            inParam.Add(trabajadorDTO.fechaNacimiento);
            inParam.Add(trabajadorDTO.sexoId.ToString());
            inParam.Add(trabajadorDTO.perfilId.ToString());

            outParam.Add("o_result");
            outParam.Add("o_usuario");
            outParam.Add("o_password");

            result = _IResultlSetHelper.executePackage(packageName, procedureName, inParam, outParam);

            if (result[0].ToString().Equals("OK"))
            {
                response.code          = 0;
                response.message       = "OK";
                response.correoUsuario = result[1].ToString();
                response.password      = result[2].ToString();
            }
            else
            {
                response.code    = 999;
                response.message = String.Concat("NoOk - ", result[0].ToString());
            }

            return(response);
        }