public void when_saving_process_then_can_retrieve_it()
        {
            var dbName = this.GetType().Name + "-" + Guid.NewGuid();
            using (var context = new RegistrationProcessDbContext(dbName))
            {
                context.Database.Create();
            }

            try
            {
                Guid id = Guid.Empty;
                using (var context = new RegistrationProcessDbContext(dbName))
                {
                    var process = new RegistrationProcess();
                    context.RegistrationProcesses.Add(process);
                    context.SaveChanges();
                    id = process.Id;
                }
                using (var context = new RegistrationProcessDbContext(dbName))
                {
                    var process = context.RegistrationProcesses.Find(id);
                    Assert.NotNull(process);
                }
            }
            finally
            {
                using (var context = new RegistrationProcessDbContext(dbName))
                {
                    context.Database.Delete();
                }
            }
        }
Exemple #2
0
 public FriendPoller(TelegramClient telegramClient, PSNService psnService, AccountService accounts, RegistrationProcess registrationProcess)
 {
     _telegramClient      = telegramClient;
     _psnService          = psnService;
     _accounts            = accounts;
     _registrationProcess = registrationProcess;
 }
Exemple #3
0
 public StartCommand(PSNService psnService, TelegramClient telegramClient, AccountService accounts, RegistrationProcess registrationProcess)
 {
     _psnService          = psnService;
     _telegramClient      = telegramClient;
     _accounts            = accounts;
     _registrationProcess = registrationProcess;
     _regex = new Regex("^/start", RegexOptions.IgnoreCase);
 }
Exemple #4
0
 public DeleteCommand(PSNService psnService, TelegramClient telegramClient, AccountService accounts, RegistrationProcess process)
 {
     _psnService     = psnService;
     _telegramClient = telegramClient;
     _accounts       = accounts;
     _regex          = new Regex("^/delete", RegexOptions.IgnoreCase);
     _process        = process;
 }
 LoginService()
 {
     registrationService = RegistrationService.Instance;
     registrationProcess = new RegistrationProcess();
     registrationProcess.MyRegistrationListener = this;
     callService = CallService.Instance;
     callService.setTr87Listener(this);
     aeonixInfoService = AeonixInfoService.Instance;
 }
        public void Register_throws_Exception_when_invalid_user_inforation_ispassed()
        {
            UserDataObject user         = new UserDataObject();
            var            mockUserData = new Mock <IUserData>();

            mockUserData.Setup(x => x.GetEmailAddress(string.Empty)).Returns(string.Empty);
            RegistrationProcess process = new RegistrationProcess(mockUserData.Object);

            process.Register(user);
        }
Exemple #7
0
 public RegistrationProcessManager(RegistrationProcess pInfo)
 {
     if (pInfo == null)
     {
         ProcessInfo = new RegistrationProcess();
     }
     else
     {
         ProcessInfo = pInfo;
     }
 }
        public void Return_true_if_email_is_registered()
        {
            string email        = "*****@*****.**";
            var    mockUserData = new Mock <IUserData>();

            mockUserData.Setup(x => x.GetEmailAddress(email)).Returns(email);
            IRegistrationProcess registrationProcess = new RegistrationProcess(mockUserData.Object);
            bool isregistered = registrationProcess.IsRegisteredEmailAddress(email);

            Assert.IsTrue(isregistered);
        }
Exemple #9
0
        public void insertRow()
        {
            RegistrationProcess RegistrationProcessToInsert = new RegistrationProcess();

            Console.Write("Enter Course Name: ");
            RegistrationProcessToInsert.CourseName = Console.ReadLine();
            Console.Write("Enter Student Name: ");
            RegistrationProcessToInsert.StudentName = Console.ReadLine();

            registration.insertRow(RegistrationProcessToInsert);

            Query();
        }
Exemple #10
0
        private async Task <bool> AddAsync(RegistrationProcessRequest request)
        {
            using var sql = new SqlConnection(_connectionString);
            await sql.OpenAsync();

            using var transaction = sql.BeginTransaction();
            SqlCommand command = sql.CreateCommand();

            command.Transaction = transaction;

            var report = new Report
            {
                Events            = request.Events,
                ID                = Guid.NewGuid(),
                LevelTypeID       = (byte)request.LevelTypeID,
                ReportDescription = request.ReportDescription,
                ReportSource      = request.ReportSource,
                Title             = request.Title,
                Details           = request.Details
            };

            var registrationProcess = new RegistrationProcess
            {
                ReportID          = report.ID,
                CreatedDate       = DateTimeOffset.UtcNow,
                ID                = Guid.NewGuid(),
                EnvironmentTypeID = (byte)request.EnvironmentTypeID,
                IsActive          = true,
                OwnerID           = Guid.Parse(request.OwnerID)
            };

            command = await AddReportAsync(command, report);

            command = await AddRegistrationProcessAsync(command, registrationProcess);

            try
            {
                await transaction.CommitAsync();

                sql.Close();
                return(true);
            }
            catch (Exception ex)
            {
                await transaction.RollbackAsync();

                sql.Close();
                return(false);
            }
        }
Exemple #11
0
        public void updateRow()
        {
            RegistrationProcess RegistrationProcessToUpdate = new RegistrationProcess();

            Console.Write("Enter Serial: ");
            RegistrationProcessToUpdate.Serial = int.Parse(Console.ReadLine());
            Console.Write("Enter Course Name: ");
            RegistrationProcessToUpdate.CourseName = Console.ReadLine();
            Console.Write("Enter Student Name: ");
            RegistrationProcessToUpdate.StudentName = Console.ReadLine();

            registration.updateRow(RegistrationProcessToUpdate);

            Query();
        }
        public given_process_awaiting_for_reservation_confirmation()
        {
            this.sut = new RegistrationProcess();
            this.orderId = Guid.NewGuid();
            this.conferenceId = Guid.NewGuid();

            this.sut.Handle(
                new OrderPlaced
                {
                    SourceId = this.orderId,
                    ConferenceId = this.conferenceId,
                    Seats = new[] { new SeatQuantity(Guid.NewGuid(), 2) },
                    ReservationAutoExpiration = DateTime.UtcNow.Add(TimeSpan.FromMinutes(22))
                });
        }
        public void insertRow(RegistrationProcess tempObject)
        {
            string       insertCommand       = "INSERT INTO registration (CourseName, StudentName) VALUES (@CourseName, @StudentName)";
            SqlCommand   command             = new SqlCommand(insertCommand);
            SqlParameter CourseNameParameter = new SqlParameter("@CourseName", SqlDbType.NVarChar, 50);

            CourseNameParameter.Value = tempObject.CourseName;
            SqlParameter StudentNameParameter = new SqlParameter("@StudentName", SqlDbType.NVarChar, 50);

            StudentNameParameter.Value = tempObject.StudentName;

            command.Parameters.Add(CourseNameParameter);
            command.Parameters.Add(StudentNameParameter);

            ObjectOfDataAccess.ExecuteCommand(command);
        }
Exemple #14
0
        public async Task <GeneralResponse> Send([FromBody] OTPRequest req)
        {
            switch (req.ReqCode)
            {
            case (int)REQUEST.OTPREQUEST:
                return(await RegistrationProcess.ProcessGenerateOTPRequest(req, sender, dBContext));

                break;

            default:
                return(new GeneralResponse()
                {
                    RespCode = (int)RESPONSE.INVALIDREQUEST, Version = APIVERSION
                });
            }
            //return new GeneralResponse(){Resp }
        }
Exemple #15
0
        /// <summary>
        /// Creates an Proxy on the bus.
        /// </summary>
        public override void UnRegisterConnector()
        {
            if (!RegistrationProcess.Equals(ERegistration.REGISTERED))
            {
                return;
            }

            Logger.Info("Unregister the connector with ID: " + ConnectorId);
            IDictionary <string, string> metaData = new Dictionary <string, string>();

            metaData.Add("serviceId", CreationRegistration);
            metaData.Add("contextId", ContextId);
            LocalType      localType = new LocalType(typeof(String));
            IList <string> classes   = new List <string>();

            classes.Add(localType.RemoteTypeFullName);

            IList <object> args = new List <object>();

            args.Add(ConnectorId);

            RemoteMethodCall creationCall = RemoteMethodCall.CreateInstance(UnregistrationMethodName, args, metaData, classes, null);

            JmsDestination destinationinfo = new JmsDestination(Destination);

            destinationinfo.Queue = CreationQueue;

            BeanDescription autinfo = BeanDescription.CreateInstance(AuthentificationClass);

            autinfo.Data.Add("value", Password);
            String            id            = Guid.NewGuid().ToString();
            MethodCallMessage secureRequest = MethodCallMessage.CreateInstance(Username, autinfo, creationCall, id, true, String.Empty);
            IOutgoingPort     portOut       = new JmsOutgoingPort(destinationinfo.FullDestination, ExceptionHandler, ConnectorId);
            string            request       = Marshaller.MarshallObject(secureRequest);

            portOut.Send(request, id);
            WaitAndCheckAnswer(destinationinfo, id);
            if (RegistrationProcess.Equals(ERegistration.REGISTERED))
            {
                RegistrationProcess = ERegistration.CREATED;
            }

            portOut.Close();
            Logger.Info("Unregister done");
        }
        public List <RegistrationProcess> GetList()
        {
            SqlCommand command = new SqlCommand("SELECT * FROM registration");
            DataTable  dt      = ObjectOfDataAccess.Query(command);

            List <RegistrationProcess> registrationList = new List <RegistrationProcess>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                RegistrationProcess obj = new RegistrationProcess();
                obj.Serial      = int.Parse(dt.Rows[i][0].ToString());
                obj.CourseName  = dt.Rows[i][1].ToString();
                obj.StudentName = dt.Rows[i][2].ToString();

                registrationList.Add(obj);
            }

            return(registrationList);
        }
Exemple #17
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;

            var client = new PSNService();
            var task   = client.Login("*****@*****.**", "");

            task.Wait();

            if (!task.Result)
            {
                Console.WriteLine("Failed to login");
                return;
            }

            var telegramClient = new Telegram.TelegramClient("");
            var database       = new DatabaseService("../../../psnbot.sqlite");

            var accounts         = new AccountService(database);
            var timestampService = new TimeStampService(database);

            var registrationProcess = new RegistrationProcess(telegramClient, client, accounts);

            var chatId = -1001019649766;

            using (var poller = new MessagePoller(database, telegramClient, client, accounts, registrationProcess, chatId))
                using (var imagePoller = new ImagePoller(telegramClient, client, accounts, timestampService, chatId))
                    using (var trophyPoller = new TrophyPoller(telegramClient, client, accounts, timestampService, chatId))
                        using (var friendPoller = new FriendPoller(telegramClient, client, accounts, registrationProcess))
                        {
                            poller.Start();
                            imagePoller.Start();
                            //trophyPoller.Start();
                            friendPoller.Start();

                            var host = new WebHostBuilder()
                                       .UseKestrel()
                                       .UseStartup <Startup>()
                                       .Build();
                            host.Run();
                        }
        }
        public void updateRow(RegistrationProcess tempObject)
        {
            string       updateCommand       = "UPDATE registration SET CourseName = @CourseName, StudentName = @StudentName WHERE Serial = @Serial";
            SqlCommand   command             = new SqlCommand(updateCommand);
            SqlParameter CourseNameParameter = new SqlParameter("@CourseName", SqlDbType.NVarChar, 50);

            CourseNameParameter.Value = tempObject.CourseName;
            SqlParameter StudentNameParameter = new SqlParameter("@StudentName", SqlDbType.NVarChar, 50);

            StudentNameParameter.Value = tempObject.StudentName;
            SqlParameter SerialParameter = new SqlParameter("@Serial", SqlDbType.Int);

            SerialParameter.Value = tempObject.Serial;

            command.Parameters.Add(SerialParameter);
            command.Parameters.Add(CourseNameParameter);
            command.Parameters.Add(StudentNameParameter);

            ObjectOfDataAccess.ExecuteCommand(command);
        }
Exemple #19
0
        public MessagePoller(DatabaseService databaseService, TelegramClient client, PSNService psnService, AccountService accounts,
                             RegistrationProcess registrationProcess, long chatId)
        {
            _chatId              = chatId;
            _client              = client;
            _psnService          = psnService;
            _accounts            = accounts;
            _databaseService     = databaseService;
            _registrationProcess = registrationProcess;

            _commands = new Command[]
            {
                new TopCommand(_psnService, client, _accounts),
                new SearchCommand(_psnService, client, _accounts),
                new ListCommand(_psnService, client, _accounts),
                new StartCommand(_psnService, client, _accounts, _registrationProcess),
                new HelpCommand(_psnService, client, _accounts),
                new RulesCommand(_psnService, client, _accounts),
                new OnlineCommand(_psnService, client, _accounts),
                new DeleteCommand(_psnService, client, _accounts, _registrationProcess),
                new SetInterestsCommand(_psnService, client, _accounts, _registrationProcess),
                new SetTrophiesCommand(_psnService, client, _accounts, _registrationProcess),
            };
        }
 public given_uninitialized_process()
 {
     this.sut = new RegistrationProcess();
 }
        public given_process_with_reservation_confirmation_received()
        {
            this.sut = new RegistrationProcess();
            this.orderId = Guid.NewGuid();
            this.conferenceId = Guid.NewGuid();

            var seatType = Guid.NewGuid();

            this.sut.Handle(
                new OrderPlaced
                {
                    SourceId = this.orderId,
                    ConferenceId = this.conferenceId,
                    Seats = new[] { new SeatQuantity(Guid.NewGuid(), 2) },
                    ReservationAutoExpiration = DateTime.UtcNow.Add(TimeSpan.FromMinutes(22))
                });

            var makeReservationCommand = sut.Commands.Select(e => e.Body).OfType<MakeSeatReservation>().Single();
            this.reservationId = makeReservationCommand.ReservationId;

            this.sut.Handle(
                new SeatsReserved
                {
                    SourceId = this.conferenceId,
                    ReservationId = makeReservationCommand.ReservationId,
                    ReservationDetails = new[] { new SeatQuantity(seatType, 2) }
                });
        }
 public Context()
 {
     this.sut = new RegistrationProcess();
 }
Exemple #23
0
        private async Task <SqlCommand> AddRegistrationProcessAsync(SqlCommand command, RegistrationProcess model)
        {
            command.CommandText = RegistrationProcessRequestSQL.QueryAddRegistrationProcess();

            command.Parameters.AddWithValue("@RegistrationProcessID", model.ID);
            command.Parameters.AddWithValue("@CreatedDate", model.CreatedDate);
            command.Parameters.AddWithValue("@IsActive", model.IsActive);
            command.Parameters.AddWithValue("@ReportIDRegistrationProcess", model.ReportID);
            command.Parameters.AddWithValue("@OwnerID", model.OwnerID);
            command.Parameters.AddWithValue("@EnvironmentTypeID", model.EnvironmentTypeID);

            await command.ExecuteNonQueryAsync();

            return(command);
        }