Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task <string> RegistroMovimiento(MovimientoRequest request)
        {
            try
            {
                Guid _Company = Guid.Empty;
                //Antes de llamar al procedimiento realizamos un inserccion en la tabla CajaMovimiento ,
                //Esto se hace ya que hay un trigerr en dicha tabla y se debe de lanzar
                if (request.uidtipoMovimiento.ToUpper() == "75F161D7-419E-4FD2-BB4C-88F5483752D9")
                {
                    Company_Caja dtoCompany = new Company_Caja();
                    dtoCompany.UID_Company      = Guid.Parse(request.uicompany);
                    dtoCompany.Fecha            = DateTime.Now;
                    dtoCompany.Importe_Apertura = request.importe;
                    await _iunitOfWork.CompanyCajaRepository.InsertEntity(dtoCompany);

                    await _iunitOfWork.CompanyCajaRepository.SaverChangeAsyc();

                    _Company = dtoCompany.UID;
                }
                else
                {
                    var companyCaja = _iunitOfWork.CompanyCajaRepository.FindAllAsync(x => x.UID_Company == Guid.Parse(request.uicompany) && x.Fecha <= DateTime.Now).Result.FirstOrDefault();
                    if (companyCaja != null)
                    {
                        _Company = companyCaja.UID;
                    }
                }
                if (_Company != Guid.Empty)
                {
                    await _iunitOfWork.CajaMovimientoRepository.InsertEntity(new Company_Caja_Movimientos()
                    {
                        Descripcion        = request.descripcion,
                        Importe            = request.importe,
                        UID_TipoMovimiento = Guid.Parse(request.uidtipoMovimiento),
                        UID_User           = Guid.Parse(request.uiperson),
                        Fecha    = DateTime.Now,
                        UID_Caja = _Company
                    });

                    await _iunitOfWork.CajaMovimientoRepository.SaverChangeAsyc();
                }
            }
            catch (CError e)
            {
                throw _errorManager.AddError("RegistroEvento", "Maestros_RegistroEvento", e, MethodBase.GetCurrentMethod(), null);
            }
            catch (System.Exception ex)
            {
                _log.Debug(ex.GetBaseException().ToString());
                throw _errorManager.AddError("Error Generico", "Maestros_RegistroEvento", ex, MethodBase.GetCurrentMethod(), null);
            }

            // return await Task.Run(() => "OK");
            return("OK");
        }
Esempio n. 2
0
        public void VisitBorrowUnaryOp(BorrowUnaryOpNode node)
        {
            IAddressableNode?addressableRhs = node.RHS as IAddressableNode;

            if (addressableRhs == null || !addressableRhs.IsAddressable())
            {
                _errors.AddError("Cannot borrow non-lvalue type", node);
            }
        }
Esempio n. 3
0
        public void VisitBinaryOperation(IBinaryOperationNode node)
        {
            IType lhsType = GetExpressionType(node.LHS);
            IType rhsType = GetExpressionType(node.RHS);

            // Both sides must be of same type. (No implicit conversions in MonC)
            if (lhsType != rhsType)
            {
                string message = "Type mismatch between binary operator.\n" +
                                 $"  LHS: {lhsType.Represent()}\n" +
                                 $"  RHS: {rhsType.Represent()}";
                _errors.AddError(message, node);
            }

            // TODO: Ensure operator is valid based on type.

            SetAndCacheType(node, lhsType);
        }
Esempio n. 4
0
        public void Visit(DeclarationNode node)
        {
            // Ensure declaration doesn't duplicate another declaration in the current scope.
            Scope           scope        = _scopes.GetScope(node).Scope;
            DeclarationNode previousNode = scope.Variables.Find(existingNode => node.Name == existingNode.Name && node != existingNode);

            if (previousNode != null)
            {
                _errors.AddError($"Duplicate declaration {node.Name}", node);
            }
        }
Esempio n. 5
0
        public void Visit(AccessParseNode node)
        {
            IType type = _expressionTypeManager.GetExpressionType(node.Lhs);

            if (!(type is StructType structType))
            {
                _errors.AddError($"Type '{type.Represent()}' has no accessible members.", node);
                return;
            }

            DeclarationNode?declaration = structType.Struct.Members.Find(decl => decl.Name == node.Rhs.Name);

            if (declaration == null)
            {
                _errors.AddError($"No such member {node.Rhs.Name} in struct {structType.Struct.Name}.", node.Rhs);
                return;
            }

            NewNode       = new AccessNode(node.Lhs, declaration);
            ShouldReplace = true;
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task <RetornoProcedureDto> AddRecibos(ReciboRequest dto)
        {
            try {
                RetornoProcedureDto retorno = new RetornoProcedureDto();
                retorno = await _storeProcedure.XportsRecibosInsert(new ReciboRepositoryDto()
                {
                    uiReserva = dto.uiReserva,
                    uidPerson = dto.uidPerson
                });

                return(retorno);
            }
            catch (CError e)
            {
                throw _errorManager.AddError("AddRecibos", "AddRecibos", e, MethodBase.GetCurrentMethod(), null);
            }
            catch (System.Exception ex)
            {
                throw _errorManager.AddError("Error Generico", "AddRecibos", ex, MethodBase.GetCurrentMethod(), null);
            }
        }
Esempio n. 7
0
        public void VisitTypeSpecifier(TypeSpecifierParseNode node)
        {
            IType?type = _typeManager.GetType(node.Name, node.PointerMode);

            if (type == null)
            {
                _errors.AddError($"Undefined type name \"{node.Name}\"", node);
                return;
            }

            NewNode       = new TypeSpecifierNode(type);
            ShouldReplace = true;
        }
        public void Visit(IdentifierParseNode node)
        {
            ShouldReplace = true;

            NodeScopeInfo   nodeScopeInfo = _scopeManager.GetScope(node);
            DeclarationNode?decl          = nodeScopeInfo.Scope.FindNearestDeclaration(node.Name, nodeScopeInfo.DeclarationIndex);

            if (decl != null)
            {
                NewNode = UpdateSymbolMap(new VariableNode(decl), node);
                return;
            }

            if (_semanticModule.EnumInfo.TryGetValue(node.Name, out EnumDeclarationInfo identifierInfo))
            {
                NewNode = UpdateSymbolMap(new EnumValueNode(identifierInfo.Declaration), node);
                return;
            }

            ShouldReplace = false;
            _errors.AddError($"Undeclared identifier {node.Name}", node);
        }
Esempio n. 9
0
        private void ValidateUsage(IAddressableNode addressableNode)
        {
            LValue?lValue = _lValueResolver.Resolve(addressableNode);

            if (lValue == null)
            {
                return;
            }

            if (lValue.Covers(_targetLValue) && !_isTargetCurrentlyAssigned)
            {
                _errors.AddError("Cannot use before assignment", addressableNode);
            }
        }
Esempio n. 10
0
        public void Process(FunctionDefinitionNode function)
        {
            if (TypeUtil.IsVoid(function.ReturnType))
            {
                return;
            }

            _didReturn = false;
            VisitBody(function.Body);

            if (!_didReturn)
            {
                _errors.AddError("Not all code paths return a value", function.Body);
            }
        }
Esempio n. 11
0
        public void Process(StructNode structNode, SemanticContext context, IErrorManager errors)
        {
            for (int i = 0, ilen = structNode.FunctionAssociations.Count; i < ilen; ++i)
            {
                IStructFunctionAssociationNode associationNode = structNode.FunctionAssociations[i];

                if (associationNode is StructFunctionAssociationParseNode parseNode)
                {
                    if (!context.Functions.TryGetValue(parseNode.FunctionName, out FunctionDefinitionNode function))
                    {
                        errors.AddError($"Undefined function \"{parseNode.FunctionName}\"", parseNode);
                        continue;
                    }

                    structNode.FunctionAssociations[i] = new StructFunctionAssociationNode(parseNode.Name, function);
                }
            }
        }
Esempio n. 12
0
        public void Analyze(StructNode node, IErrorManager errors)
        {
            foreach (IStructFunctionAssociationNode associationNode in node.FunctionAssociations)
            {
                if (!(associationNode is StructFunctionAssociationNode processedAssociationNode))
                {
                    continue;
                }

                if (processedAssociationNode.Name == Syntax.FUNCTION_ATTRIBUTE_DROP &&
                    !processedAssociationNode.FunctionDefinition.IsDrop)
                {
                    errors.AddError(
                        "Associated drop function is not defined with drop attribute.",
                        processedAssociationNode);
                }
            }
        }
Esempio n. 13
0
        public void Visit(AssignmentParseNode node)
        {
            IAddressableNode?assignableNode = node.LHS as IAddressableNode;

            if (assignableNode == null || !assignableNode.IsAddressable())
            {
                _errors.AddError("Left hand side of assignment is not assignable.", node);
                return;
            }

            _shouldReplace = true;
            _newNode       = new AssignmentNode(assignableNode, node.RHS);

            // TODO: Need more automated symbol association for new nodes.
            Symbol originalSymbol;

            _semanticModule.SymbolMap.TryGetValue(node, out originalSymbol);
            _semanticModule.SymbolMap[_newNode] = originalSymbol;
        }
Esempio n. 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ValidationModel> Login(UserLogin_Dto request)
        {
            TokenResponse _response = new TokenResponse();

            try {
                var result = await _signInManager.PasswordSignInAsync(request.Login, request.Password, isPersistent : false, lockoutOnFailure : false);

                if (result.Succeeded)
                {
                    return(await _userService.LoginUser(request.Login));
                }
                else
                {
                    _response.ValidationResults.Add(new ValidationResult("Login Incorrecto", new[] { "Credenciales incorrectas" }));
                    return(_response);
                }
            }
            catch (System.Exception ex)
            {
                var jsonModel = JsonConvert.SerializeObject(request);
                throw _errorManagerSrv.AddError("xportsGenerico", "CuentaService_Login", ex, MethodBase.GetCurrentMethod(), jsonModel);
            }
        }
        private void AssertLifetime(IType?lhsType, Scope?lhs, Scope?rhs, ISyntaxTreeNode context)
        {
            if (lhsType is IPointerType rhsPointerType)
            {
                if (rhsPointerType.Mode != PointerMode.Borrowed)
                {
                    return;
                }
            }
            else
            {
                return;
            }

            if (lhs == null || rhs == null)
            {
                return;
            }

            if (lhs.Outlives(rhs))
            {
                _errors.AddError("Incompatible lifetime.", context);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Creacion de usuario
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ValidationModel> AddUserApp(AddUserAppRequest request)
        {
            try
            {
                // return null;
                ApplicationUser appUser = new ApplicationUser()
                {
                    UserName = request.email,
                    Email    = request.email
                };
                var existeUser = await ExisteUsuario(request.email, request.email);

                if (existeUser)
                {
                    request.ValidationResults.Add(new ValidationResult("Usuario existente", new[] { "Usuario Existente" }));
                    return(request);
                }
                return(await CrearUserApp(request));
            }
            catch (CError e)
            {
                var jsonModel = JsonConvert.SerializeObject(request);
                throw _errorManager.AddError("AddUserApp", "UserService_AddUserApp", e, MethodBase.GetCurrentMethod(), jsonModel);
            }
            catch (System.Exception ex)
            {
                var jsonModel = JsonConvert.SerializeObject(request);
                throw _errorManager.AddError("Error metodo AddUserApp", "UserService_AddUserApp", ex, MethodBase.GetCurrentMethod(), jsonModel);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Devuelve las instalaciones
        /// </summary>
        /// <returns></returns>
        public async Task <EventosResponse> GetEventos(string fecha, string uidCompany)
        {
            EventosResponse _response = new EventosResponse();

            try
            {
                if (!string.IsNullOrEmpty(fecha) && (!string.IsNullOrEmpty(uidCompany)))
                {
                    DateTime dtfecha = new DateTime();
                    dtfecha = DateTime.Parse(fecha);
                    ReservaFilterRepositoryDto _filter = new ReservaFilterRepositoryDto();
                    _filter.fecha       = dtfecha;
                    _filter.uid_company = Guid.Parse(uidCompany);
                    _filter.uid_deporte = Guid.Parse("00437B42-A6C5-4079-A47C-FF71C7853B63");
                    _response           = await searchEventsAsync(_filter);
                }
                return(_response);
            }
            catch (CError e)
            {
                throw _errorManager.AddError("GetInstalaciones", "Maestros_GetInstalaciones", e, MethodBase.GetCurrentMethod(), null);
            }
            catch (System.Exception ex)
            {
                throw _errorManager.AddError("Error Generico", "Maestros_GetInstalaciones", ex, MethodBase.GetCurrentMethod(), null);
            }
        }