Пример #1
0
        public static ResponseToLogin ResponseToClientLogin(RequestLogToClient requestLog)
        {
            Log.Debug("Se inició el metodo de la 'Capa de Integración'", new Exception("Bank2.ConnectionException.FaultyCore: Core services are down!"));
            ResponseToLogin        response = null;
            bool                   verified = false;
            CoreProyectoDBEntities entities = new CoreProyectoDBEntities();

            try
            {
                var clients = entities.clientTables.ToList();

                foreach (var element in clients)
                {
                    if (requestLog.Identifier == element.IDENTIFIER &&
                        requestLog.Password == element.PASSWORD)
                    {
                        entities.updateLogin(requestLog.Identifier, requestLog.Password);
                        verified = true;
                        break;
                    }

                    else
                    {
                        verified = false;
                        continue;
                    }
                }

                response = new ResponseToLogin(verified);
            }

            catch (Exception ex)
            {
                Log.Error("Ocurrió un error al procesar 'ResponseToLogin'", ex);
                response = new ResponseToLogin(false);
            }

            finally
            {
                GC.Collect(); entities.SaveChanges();
            }

            Log.Info("El 'ResponseToLogin' se ha procesado exitosamente.");
            return(response);
        }
Пример #2
0
        public static ResponseToLogin ResponseToClientLogin(RequestLogToClient requestLog)
        {
            ResponseToLogin        response = null;
            bool                   verified = false;
            CoreProyectoDBEntities entities = new CoreProyectoDBEntities();

            try
            {
                var clients = entities.clientTables.ToList();

                foreach (var element in clients)
                {
                    if (requestLog.Identifier == element.IDENTIFIER &&
                        requestLog.Password == element.PASSWORD)
                    {
                        entities.updateLogin(requestLog.Identifier, requestLog.Password);
                        verified = true;
                        break;
                    }

                    else
                    {
                        verified = false;
                        continue;
                    }
                }

                response = new ResponseToLogin(verified);
            }

            catch (Exception ex)
            {
                response = new ResponseToLogin(false);
            }

            finally
            {
                GC.Collect(); entities.SaveChanges();
            }

            return(response);
        }
Пример #3
0
        public static ResponseAccountRegister ResponseToAccountRegister(RequestAccountRegister accountToRegister)
        {
            Log.Debug("Se inició el metodo de la 'Capa de Integración'", new Exception("Bank2.ConnectionException.FaultyCore: Core services are down!"));
            ResponseAccountRegister responseAccount;
            CoreProyectoDBEntities  entities = new CoreProyectoDBEntities();

            try
            {
                switch (accountToRegister.Account_Type)
                {
                case "EMPRESARIAL": accountToRegister.Account_Type = AccountTypes.EMPRESARIAL.ToString(); break;

                case "AHORRO": accountToRegister.Account_Type = AccountTypes.AHORRO.ToString(); break;

                case "CORRIENTE": accountToRegister.Account_Type = AccountTypes.CORRIENTE.ToString(); break;

                default: accountToRegister.Account_Type = AccountTypes.OTRO.ToString(); break;
                }

                entities.accountRegister(accountToRegister.Identifier,
                                         accountToRegister.Account_Name, accountToRegister.Account_Type);

                responseAccount = new ResponseAccountRegister(true, accountToRegister.Identifier);
                Log.Info("El 'ResponseAccountRegister' se ha ejecutado exitosamente.");
            }


            catch (Exception ex)
            {
                Log.Error("Ocurrió un error al procesar 'ResponseAccountRegister'.", ex);
                responseAccount = new ResponseAccountRegister(false, accountToRegister.Identifier);
            }

            finally
            {
                GC.Collect(); entities.SaveChanges();
            }

            return(responseAccount);
        }
        public static ResponseAccountRegister ResponseToAccountRegister(RequestAccountRegister accountToRegister)
        {
            ResponseAccountRegister responseAccount;
            CoreProyectoDBEntities  entities = new CoreProyectoDBEntities();

            try
            {
                switch (accountToRegister.Account_Type)
                {
                case "EMPRESARIAL": accountToRegister.Account_Type = AccountTypes.EMPRESARIAL.ToString(); break;

                case "AHORRO": accountToRegister.Account_Type = AccountTypes.AHORRO.ToString(); break;

                case "CORRIENTE": accountToRegister.Account_Type = AccountTypes.CORRIENTE.ToString(); break;

                default: accountToRegister.Account_Type = AccountTypes.OTRO.ToString(); break;
                }

                entities.accountRegister(accountToRegister.Identifier,
                                         accountToRegister.Account_Name, accountToRegister.Account_Type);

                responseAccount = new ResponseAccountRegister(true, accountToRegister.Identifier);
            }


            catch
            {
                responseAccount = new ResponseAccountRegister(false, accountToRegister.Identifier);
            }

            finally
            {
                GC.Collect(); entities.SaveChanges();
            }

            return(responseAccount);
        }