Exemple #1
0
        public UserAdministration AddAdministrator(Guid superiorId, RoleEnum role)
        {
            UserAdministration administration = new UserAdministration(superiorId, Id, role);

            Administrators.Add(administration);

            return(administration);
        }
 private void ExecuteAddNew(object parameter)
 {
     Administrators.Add(new AdministratorUserModel()
     {
         ID = 0, Name = string.Empty, LoginName = string.Empty
     });
     ScrollToSelectedItem = Administrators.Count - 1;
 }
 private void AddSampleData()
 {
     Database.EnsureDeleted();
     Database.EnsureCreated();
     Students.AddRange(StudentsSampleData());
     Teachers.Add(new Teacher("Малика", "Абрахманова", DateTime.Parse("05.05.1988"), "*****@*****.**", "Qwertyu123456++", "malika",
                              User.GetHashString("asdfg"))
     {
         MyProblems = AddProblem()
     });
     Administrators.Add(new Administrator("Бахытжан", "Ассилбеков", DateTime.Parse("02.12.1982"), "*****@*****.**", "assilbekov",
                                          User.GetHashString("kaznitu")));
     Problems.AddRange(AddProblem());
     SaveChanges();
 }
Exemple #4
0
        private void AddAdmin()
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(this.TxtUserName.Text.Trim());

            if (usersByUserName.IsNull)
            {
                AdminPage.WriteErrMsg("此前台用户名不存在!");
            }
            AdministratorInfo adminInfo = new AdministratorInfo();

            adminInfo.AdminName            = this.TxtAdminName.Text.Trim();
            adminInfo.UserName             = this.TxtUserName.Text.Trim();
            adminInfo.IsLock               = this.ChkIsLock.Checked;
            adminInfo.EnableModifyPassword = this.ChkEnableModifyPassword.Checked;
            if (string.IsNullOrEmpty(this.TxtPassword.Text.Trim()))
            {
                AdminPage.WriteErrMsg("管理员密码不能为空");
            }
            else
            {
                adminInfo.AdminPassword = StringHelper.MD5(this.TxtPassword.Text);
            }
            adminInfo.EnableMultiLogOn = this.ChkEnableMultiLogin.Checked;
            if (Administrators.IsExist(adminInfo.AdminName))
            {
                AdminPage.WriteErrMsg("已经存在同样的管理员名!");
            }
            if (!Administrators.GetAdministratorByUserName(usersByUserName.UserName).IsNull)
            {
                AdminPage.WriteErrMsg("此前台用户已经被添加为管理员了!");
            }
            if (Administrators.Add(adminInfo))
            {
                if (this.RadPurview1.Checked)
                {
                    RoleMembers.AddMemberToRoles(adminInfo.AdminId, "0");
                }
                else
                {
                    RoleMembers.AddMemberToRoles(adminInfo.AdminId, this.HdnBelongToRole.Value);
                }
                AdminPage.WriteSuccessMsg("添加管理员成功!", "AdministratorManage.aspx");
            }
            else
            {
                AdminPage.WriteErrMsg("添加管理员失败!");
            }
        }
Exemple #5
0
        public void SeedDatabase(string masterUserIdentityName)
        {
            if (!MasterAdministrators.Any(a => a.UserIdentityName == masterUserIdentityName))
            {
                var master = new MasterAdministrator {
                    UserIdentityName = $"{masterUserIdentityName}",
                    Name             = "Master User",
                    Email            = "*****@*****.**",
                    Phone            = "1234"
                };

                Administrators.Add(master);
                Log.Information($"Added Master {masterUserIdentityName}");
            }
            else
            {
                Log.Information($"Master {masterUserIdentityName} already in database.");
            }

            SaveChanges();
        }
        private void ReadOrgDetailsProperties(JsonElement json)
        {
            foreach (JsonProperty prop in json.EnumerateObject())
            {
                switch (prop.Name)
                {
                case OrganizationIdPropertyName:
                    OrganizationId = prop.Value.GetString();
                    break;

                case AdminDetailsPropertyName:
                    foreach (JsonElement elem in prop.Value.EnumerateArray())
                    {
                        var admin = new AdministratorDetails();
                        admin.ReadProperties(elem);
                        Administrators.Add(admin);
                    }
                    Password = prop.Value.GetString();
                    break;
                }
            }
        }
        private void InitProfiles()
        {
            User user1 = new CommonUser(0, "X", DateTime.Now, 5,
                                        "+380*********", "@gmail", Orders, true);

            Users.Add(user1);
            Profile       prof1 = new Profile(0, user1, "url", Orders);
            Administrator user2 = new Administrator(1, "Ozon", DateTime.Now, 4.5,
                                                    "+380*********", "@gmail", new List <Order>());

            Administrators.Add(user2);

            Profile prof2 = new Profile(1, user2, "url1", Orders);

            Profiles.Add(prof1);
            prof1.User.Nickname = "12";
            prof1.User.Nickname = "Sephiroth";
            prof1.User.Nickname = "Sdsdsdsdsdssdsdsdsdsdsdsdssdsd";

            Profiles.Add(new Profile(prof1));

            Profiles.Add(new Profile());
            user1.CreateOrder(DateTime.Now,
                              user1.Id,
                              0,
                              0,
                              new OrderInfo {
                Description = "order", ImageUrl = "url", Naming = "Apples", Price = 100, Validated = false
            });
            user2.CreateOrder(DateTime.Now,
                              user2.Id,
                              0,
                              1,
                              new OrderInfo {
                Description = "order1", ImageUrl = "image", Naming = "Telephone", Price = 5000, Validated = false
            });
        }
Exemple #8
0
        public UserAdministration AddAdministrator(UserAdministration administration)
        {
            Administrators.Add(administration);

            return(administration);
        }
Exemple #9
0
 protected virtual void When(LibraryOpened @event)
 {
     Id   = @event.AggregateId;
     Name = @event.Name;
     Administrators.Add(new AdministratorId(@event.AdministratorId));
 }
Exemple #10
0
        public void EmptyAndCreate()
        {
            EmptyTable();

            Colaborator colaborator1 = new Colaborator();

            colaborator1.name     = "Colab";
            colaborator1.surname  = "Orator";
            colaborator1.mail     = "*****@*****.**";
            colaborator1.password = "******";
            colaborator1.birthday = new DateTime(1992, 9, 10);
            colaborator1.teams    = new List <Team>();
            Colaborators.Add(colaborator1);
            SaveChanges();

            Administrator administrator1 = new Administrator();

            administrator1.name     = "Admin";
            administrator1.surname  = "Istrator";
            administrator1.mail     = "*****@*****.**";
            administrator1.password = "******";
            administrator1.birthday = new DateTime(1992, 9, 10);
            administrator1.teams    = new List <Team>();
            Administrators.Add(administrator1);
            SaveChanges();

            Team team1 = new Team();

            team1.name         = "Team 1";
            team1.maxUsers     = 5;
            team1.description  = "This is the description.";
            team1.creator      = administrator1;
            team1.creationDate = DateTime.Now;
            List <User> usersInTeam = new List <User>();

            usersInTeam.Add(administrator1);
            team1.usersInTeam = usersInTeam;
            Teams.Add(team1);
            SaveChanges();

            Team team2 = new Team();

            team2.name         = "Team 2";
            team2.maxUsers     = 3;
            team2.description  = "Description";
            team2.creator      = administrator1;
            team2.creationDate = DateTime.Now;
            List <User> usersInTeam2 = new List <User>();

            usersInTeam2.Add(administrator1);
            usersInTeam2.Add(colaborator1);
            team2.usersInTeam = usersInTeam2;
            Teams.Add(team2);
            SaveChanges();

            administrator1.teams.Add(team1);
            SaveChanges();
            administrator1.teams.Add(team2);
            SaveChanges();
            colaborator1.teams.Add(team2);
            SaveChanges();
        }
Exemple #11
0
 public void AddAdministrator(User u)
 {
     Administrators.Add(u);
 }