public ActorConfigurationBuilder Register <T>(Func <IWorkContext, ActorKey, IActorManager, T> createImplementation) where T : IActor
        {
            Verify.IsNotNull(nameof(createImplementation), createImplementation);

            Registration.Add(new ActorTypeRegistration(typeof(T), (c, x, m) => createImplementation(c, x, m)));
            return(this);
        }
        public ActorConfigurationBuilder Register <T>(Func <IWorkContext, T> createImplementation) where T : IActor
        {
            createImplementation.Verify(nameof(createImplementation)).IsNotNull();

            Registration.Add(new ActorTypeRegistration(typeof(T), x => createImplementation(x)));
            return(this);
        }
        public ActionResult RegistrationView(Users user)
        {
            if (Registration.Add(user))
            {
                ViewBag.Success = "Пользователь успешно зарегестрирован!";
                return(View("../Admin/UsersProfile", user));
            }

            else
            {
                ViewBag.ErrorMessage = "Такой пользователь уже существует!";
            }
            return(View());
        }
예제 #4
0
        public async void ConfirmButton_Clicked(object sender, EventArgs e)
        {
            if (CodeEntry.Text != Storage.ConfirmCode)
            {
                await DisplayAlert("Ошибка", "Неверный код!\nПопробуйте ещё раз", "OK");
            }
            else
            {
                activityIndicator.Start();
                string res = "", res1 = "";
                if (Storage.IsEntering)
                {
                    Storage.User       = Storage.temporaryData;
                    Storage.IsEntering = false;
                    App.Current.Properties.Clear();
                    App.Current.Properties.Add("user", Storage.User.Id);
                    App.LogIn(true);
                    await Navigation.PushAsync(new MainPage());

                    return;
                }
                else
                {
                    res = await Task.Run(() => Registration.Add(Storage.temporaryData));

                    res1 = await Task.Run(() => BloodData.Push(Storage.temporaryData.Id, Storage.temporaryData.BloodGroup,
                                                               Storage.temporaryData.RFactor));
                }
                activityIndicator.Stop();
                if (res == "OK" && res1 == "OK")
                {
                    await Navigation.PopToRootAsync();
                }
                else if (res == "OK")
                {
                    await DisplayAlert("Предупреждение", "Возможно данные крови не были добавлены", "OK");

                    await Navigation.PopToRootAsync();
                }
                else
                {
                    await DisplayAlert("Ошибка", "Некорректные данные или проблемы с интернетом", "OK");
                }
            }
        }
예제 #5
0
 private KeyTypeInfo(System.Type Type, KeyTypeInfo <Key> Base, KeyTypeInfo <Key> Root, int TraitDepth)
 {
     this.Type = Type;
     this.Base = Base;
     if (Root == null)
     {
     }
     this.Root       = (KeyTypeInfo <Key>) this;
     this.TraitDepth = TraitDepth;
     if (this.Root == this)
     {
         this.AssignableTo = new HashSet <KeyTypeInfo <Key> >();
     }
     else
     {
         this.AssignableTo = new HashSet <KeyTypeInfo <Key> >(this.Base.AssignableTo);
     }
     this.AssignableTo.Add((KeyTypeInfo <Key>) this);
     Registration <Key> .Add((KeyTypeInfo <Key>) this);
 }
예제 #6
0
        public IActionResult Create(RegistrationViewModel rv)
        {
            TempData["ReturnUrl"] = null;
            var  username = rv.CustUserName;
            bool exists   = CustomerManager.checkCustomerExist(username);

            if (exists == true)
            {
                _reg.Add(rv);
                _reg.SaveChanges();
                ViewBag.message = "Customer " + rv.CustUserName + " Has Been Saved Successfully!";
                //return View("Login");
                return(RedirectToAction(nameof(Login)));
            }
            else
            {
                ViewBag.message = "User name already exists!Please try again.";
                return(View("Create"));
            }
        }
예제 #7
0
        public static void InteractionWithUser()
        {
            string login, pass, filename, s, notebooktext = " ";

            Registration listofusers = new Registration();

            foreach (var user in (new RegisterUsers()).ExistedUsers)
            {
                listofusers.Add(user);
            }

            Authorization auth = new Authorization(listofusers);

            while (true)
            {
                Console.WriteLine(new string('-', 120));
                Console.WriteLine("\nLog in or Registration:" +
                                  "\n\nPress '1' if you are already registered" +
                                  "\nPress '2' if you want to register" +
                                  "\nPrint 'data' and press Enter to get the list of existing users\n");

                s = Console.ReadLine();
                switch (s)
                {
                case "1":
                    EnterLoginInfo(out login, out pass);

                    if (auth.ValidateAuthorization(login, pass, out DateTime date))
                    {
                        Console.WriteLine("\nYour authorization is successful !!!");
                        Console.WriteLine("Please enter your today's notes to your 'Electronic Notebook' row by row (Press 'quit' when you finish your writting)\n");

                        Console.WriteLine("\n\nThe current date is {0}", date);
                        notebooktext += "\nThe current date is " + date;
                        while (true)
                        {
                            notebooktext += "\n" + Console.ReadLine();
                            if (notebooktext.Contains("quit"))
                            {
                                filename = login + " " + pass + ".txt";
                                File.AppendAllText(Directory + filename, notebooktext.Substring(0, notebooktext.Length - 5));
                                break;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("\nYour authorization isn't successful !!! Please try to Log in again or create a new account.");
                    }

                    break;

                case "2":
                    EnterLoginInfo(out login, out pass);
                    listofusers.Add(new Users(login, pass));

                    filename = login + " " + pass + ".txt";
                    File.CreateText(Directory + filename);
                    break;

                case "data":
                    Console.WriteLine("\n\nList of Users:");
                    foreach (Users user in listofusers)
                    {
                        Console.WriteLine("Login: "******" Password: "******"\n");
                    break;

                case " ":
                    break;
                }
            }

            Console.ReadKey();
        }