Exemplo n.º 1
0
 private void OnSaveUsersChangesCommandExecuted(object parameter)
 {
     foreach (var user in Users)
     {
         UsersManager.UpdateUser(user);
     }
 }
Exemplo n.º 2
0
        //Edit Reservation
        public IActionResult ReservationEdit(int id)
        {
            LogRestaurant();
            if (TempData["ErrorMessage"] != null)
            {
                ViewBag.ErrorMessage = TempData["ErrorMessage"];
            }
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"];
            }

            var    reservation     = RestaurantsManager.GetReservationById(id);
            var    userId          = CustomersManager.GetUserIdByCustomerId(reservation.CustomerId);
            var    customerUser    = UsersManager.GetUserByUserId(userId);
            string fullName        = $"{customerUser.FirstName} {customerUser.LastName}";
            var    viewreservation = new ResCustomerModelView
            {
                CustomerName       = fullName,
                EntryOrigin        = reservation.EntryOrigin,
                PartySize          = reservation.PartySize,
                ReservationStatus  = reservation.ReservationStatus,
                ReservationDate    = reservation.ReservationDateTime,
                ReservationEntryId = reservation.ReservationId,
                RestaurantID       = reservation.RestaurantId
            };

            ViewBag.ReservationStatus = GetReservationStatus();
            return(View(viewreservation));
        }
Exemplo n.º 3
0
        public IActionResult RestaurantOwnersShow()
        {
            LogRestaurant();
            ClaimsPrincipal       cp                   = this.User;
            var                   claims               = cp.Claims.ToList();
            var                   restId               = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var                   restaurantOwners     = RestaurantsManager.GetRestauranOwnersByID(restId);
            List <OwnerModelView> viewRestaurantOwners = new List <OwnerModelView>();

            foreach (RestaurantOwners rowner in restaurantOwners)
            {
                if (rowner.Request == false)
                {
                    var    ownerUser = UsersManager.GetUserByUserId(rowner.Owner.UserId);
                    string fullName  = $"{ownerUser.FirstName} {ownerUser.LastName}";
                    var    viewOwner = new OwnerModelView
                    {
                        RestaurantId  = rowner.RestaurantId,
                        OwnerId       = rowner.OwnerId,
                        UserId        = ownerUser.UserId,
                        OwnerFullName = fullName,
                        Active        = rowner.Active,
                        Status        = rowner.Status,
                        StartDate     = (DateTime)rowner.StartDate,
                        EndDate       = rowner.EndDate,
                        RequestFlag   = rowner.Request,
                        RequestStatus = rowner.RequestStatus
                    };
                    viewRestaurantOwners.Add(viewOwner);
                }
            }
            ViewBag.RestaurantID = restId;
            return(View(viewRestaurantOwners));
        }
Exemplo n.º 4
0
        public void NotRegisteredTest()
        {
            IUsersManager manager = new UsersManager(new UserDataStorageInRAMStrategy());

            Assert.Null(manager.Login("user", "pass"));
            Assert.Equal(0, manager.AllUsers.Count);
        }
Exemplo n.º 5
0
        public IActionResult RestaurantEmployeesShow()
        {
            LogRestaurant();
            ClaimsPrincipal          cp     = this.User;
            var                      claims = cp.Claims.ToList();
            var                      restId = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var                      restaurantEmployees     = RestaurantsManager.GetRestauranEmployeesByID(restId);
            List <EmployeeModelView> viewRestaurantEmployees = new List <EmployeeModelView>();

            foreach (RestaurantEmployees remployee in restaurantEmployees)
            {
                if (remployee.NewRequestFlag != true)
                {
                    var    employeeUser = UsersManager.GetUserByUserId(remployee.Employee.UserId);
                    string fullName     = $"{employeeUser.FirstName} {employeeUser.LastName}";
                    var    viewEmployee = new EmployeeModelView
                    {
                        RestaurantId     = remployee.RestaurantId,
                        EmployeeId       = remployee.EmployeeId,
                        UserId           = employeeUser.UserId,
                        EmployeeFullName = fullName,
                        Active           = remployee.Active,
                        Status           = remployee.Status,
                        StartDate        = (DateTime)remployee.StartDate,
                        EndDate          = remployee.EndDate,
                        RequestFlag      = remployee.NewRequestFlag,
                        RequestStatus    = remployee.RequestStatus
                    };
                    viewRestaurantEmployees.Add(viewEmployee);
                }
            }
            ViewBag.RestaurantID = restId;
            return(View(viewRestaurantEmployees));
        }
Exemplo n.º 6
0
 public void ShowMenu()
 {
     while (true)
     {
         Console.Clear();
         Console.WriteLine("Hello, {0}!", AuthenticationManager.LoggedUser.Username);
         Console.WriteLine("[1] User Management");
         Console.WriteLine("[X] Exit");
         string choice = Console.ReadLine();
         if (choice.ToLower() == "x")
         {
             return;
         }
         else if (Int32.Parse(choice) == 1)
         {
             Console.Clear();
             UsersManager userManager = new UsersManager();
             userManager.Show();
             return;
         }
         else
         {
             Console.WriteLine("Invalid choice. Please try again! (Press any key to continue)");
             Console.ReadKey(true);
             Console.Clear();
         }
     }
 }
Exemplo n.º 7
0
        public void AlreadyRegisteredTest()
        {
            IUsersManager manager = new UsersManager(new UserDataStorageInRAMStrategy());

            manager.Register("user", "pass");
            Assert.Null(manager.Register("user", "pass"));
        }
        protected void btnlogin_Click(object sender, EventArgs e)
        {
            if (this.txtusername.Text == "" || this.txtuserpwd.Text == "" || this.txtpwdagin.Text == "" || this.txtphone.Text == "" || this.txtname.Text == "")
            {
                Response.Write("<script>alert('登录账号,登录密码,确认密码,电话,用户名均不能为空!');</script>");
                return;
            }
            if (this.txtuserpwd.Text != this.txtpwdagin.Text)
            {
                Response.Write("<script>alert('俩次密码输入不一致!');</script>");
                return;
            }
            if (this.txtphone.Text.Length != 11)
            {
                Response.Write("<script>alert('电话号格式不正确!');</script>");
                return;
            }
            string pwd  = PasswordEncrytion(this.txtuserpwd.Text);
            Users  user = new Users()
            {
                LoginId = this.txtusername.Text, LoginPwd = pwd, Phone = this.txtphone.Text, UserName = this.txtname.Text
            };

            if (UsersManager.UserRegist(user))
            {
                Response.Write("<script>alert('注册成功,返回登录!');window.location.href='Login.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('注册失败!');</script>");
                return;
            }
        }
Exemplo n.º 9
0
 public ManageController()
 {
     usersManager    = new UsersManager();
     journalsManager = new JournalsManager();
     coursesManager  = new CoursesManager();
     logManager      = new LogManager();
 }
Exemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //绑定最新博客
         DataTable dt = new BlogManager().SelectLatest();
         Replatest.DataSource = dt;
         Replatest.DataBind();
         //绑定最热博客
         dt = new BlogManager().SelectPopular();
         Reppopular.DataSource = dt;
         Reppopular.DataBind();
         //绑定最佳博主
         dt = new UsersManager().SelectTopUser();
         Reptopuser.DataSource = dt;
         Reptopuser.DataBind();
         //绑定热门博主
         dt = new UsersManager().SelectPopularUsers();
         Reppopularuser.DataSource = dt;
         Reppopularuser.DataBind();
         //绑定热文
         dt = new BlogManager().SelectPopular();
         Rephotblogs.DataSource = dt;
         Rephotblogs.DataBind();
     }
 }
Exemplo n.º 11
0
        protected void Btn_Register_Click(object sender, EventArgs e)
        {
            Model.Users users = new Model.Users();
            users.userName = txbUserName.Text;
            users.password = txbPassword1.Text;
            users.gender   = DropDownList1.SelectedItem.Text;

            string date = DropDownListYear.SelectedItem.Text.Trim().ToString() + "/" + DropDownListMonth.SelectedItem.Text.Trim().ToString() + "/" + DropDownListDay.SelectedItem.Text.Trim().ToString();

            DateTime time = Convert.ToDateTime(date);

            users.birthDate = time;


            BLL.UsersManager users1 = new UsersManager();

            bool bo = users1.Add(users);

            if (bo == true)
            {
                string  str = "username='******'";
                DataSet ds  = users1.GetList(str);
                Session["userID"]   = ds.Tables[0].Rows[0]["UserID"].ToString();
                Session["username"] = txbUserName.Text.Trim();
                Response.Redirect("~/Users/Question.aspx");
            }
            else
            {
                Response.Write("<script language=javascript>alert('注册失败!')");
            }
        }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.User.IsInRole("Admin"))
        {
            Response.Redirect("/index.aspx");
            return;
        }
        userId = Request.QueryString["uID"];
        if (String.IsNullOrEmpty(userId) || String.IsNullOrEmpty(userId))
        {
            Response.Redirect("/index.aspx");
            return;
        }
        UsersManager um = new UsersManager();

        this.Username.Text = um.GetUserNameByID(userId);
        isAdmin            = um.IsAdmin(userId);
        if (isAdmin)
        {
            Response.Redirect("/Users/usersList.aspx");
            return;
        }
        cmdSave.Visible = !isAdmin;
        if (!IsPostBack)
        {
            loadIndicators();
        }
    }
Exemplo n.º 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //绑定用户文章列表
         //获取用户ID
         string    userId = Request.QueryString["userId"];
         DataTable dt     = new BlogManager().SelectByUser(userId);
         Repuserblogs.DataSource = dt;
         Repuserblogs.DataBind();
         //绑定用户信息
         dt = new UsersManager().SelectById(userId);
         Repuserinfo.DataSource = dt;
         Repuserinfo.DataBind();
         //绑定用户详情
         dt = new UsersManager().SelectDetailById(userId);
         Repuserdetail.DataSource = dt;
         Repuserdetail.DataBind();
         //绑定个人分类
         dt = new BlogManager().SelectPersonalCateByUser(userId);
         Reppersonalcate.DataSource = dt;
         Reppersonalcate.DataBind();
         //绑定阅读排行榜
         dt = new BlogManager().SelectTopByReadCount(userId);
         Reptopreadcount.DataSource = dt;
         Reptopreadcount.DataBind();
         //绑定评论排行榜
         dt = new BlogManager().SelectTopByCommentCount(userId);
         Reptopcommentcount.DataSource = dt;
         Reptopcommentcount.DataBind();
     }
 }
Exemplo n.º 14
0
 protected void GetLoginName()
 {
     BLL.UsersManager usersM = new UsersManager();
     Model.Users      users  = usersM.GetModel1(Session["userID"].ToString());
     LabelUser.Text = users.userName;
     // LabelUser.Text = Convert.ToString(Session["username"]);
 }
        public ActionResult Create(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                User user = new User()
                {
                    UserName = model.UserName, UserRole = _userRolesRepository.GetById(model.UserRole)
                };
                IdentityResult result = UsersManager.Create(user, model.Password);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Account"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError("", error);
                    }
                }
            }

            SelectList roles = new SelectList(_userRolesRepository.GetAll(), "Id", "Name");

            ViewBag.Roles = roles;

            return(View(model));
        }
Exemplo n.º 16
0
        public static void Main(string[] args)
        {
            var host = CreateWebHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var serviceProvider = services.GetRequiredService <IServiceProvider>();
                    var configuration   = services.GetRequiredService <IConfiguration>();

                    RolesManager.CreateRoles(serviceProvider).Wait();
                    UsersManager.CreateSuperUser(serviceProvider, configuration).Wait();

                    var context = services.GetRequiredService <ApplicationDbContext>();
                    DbInitializer.Initialize(context);
                }
                catch (Exception exception)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(exception, "An error occurred while creating roles");
                }
            }

            host.Run();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Выполняет инициализацию ядра ОС.
        /// </summary>
        public DehaxOS()
        {
            _fileSystemImage = new FileStream(FS_IMAGE_PATH, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, FS_IMAGE_BUFFER, FileOptions.RandomAccess);
            FileSystem = new DehaxFileSystem(_fileSystemImage, ROOT_USER_ID, ROOT_GROUP_ID);

            Scheduler = new DehaxScheduler();

            _usersManager = new UsersManager();
            _groupsManager = new GroupsManager();

            IsLoggedIn = false;

            if (IsFirstRun)
            {
                User rootUser = new User(ROOT_USER_NAME, ROOT_USER_PASSWORD_HASH, ROOT_USER_ID, ROOT_GROUP_ID);
                _usersManager.AddUser(rootUser);
                Group rootGroup = new Group(ROOT_GROUP_NAME, ROOT_GROUP_ID);
                rootGroup.AddUser(rootUser);
                _groupsManager.AddGroup(rootGroup);

                ROOT_USER = rootUser;
                User = rootUser;
                IsLoggedIn = true;

                Install();

                IsLoggedIn = false;
            }
            else
            {
                Initialize();
            }
        }
Exemplo n.º 18
0
        protected bool getCookies()
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authCookie != null)
            {
                FormsAuthenticationTicket authTicket =
                    FormsAuthentication.Decrypt(authCookie.Value);
                var user   = authTicket.Name;
                int userID = 0;
                int.TryParse(user, out userID);
                if (userID > 0)
                {
                    UsersManager usuarioManager = new UsersManager();
                    Users        usuario        = usuarioManager.GetUsers(userID);
                    ViewBag.RoleId   = usuario.Id_Rol;
                    ViewBag.is_admin = usuario.is_admin;
                    ViewBag.UserName = usuario.username;
                    usersIdGlobal    = ViewBag.userId = usuario.usersId;
                    userIdLogged     = userID;
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 19
0
 public AdminController()
 {
     projectsManager  = new ProjectsManager();
     usersManager     = new UsersManager();
     ideationsManager = new IdeationsManager();
     surveysManager   = new SurveysManager();
 }
Exemplo n.º 20
0
 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     _node = new MiniNode(PathName);
     _node.Start();
     _manager = new UsersManager(new NoopLogger(), _node.ExtHttpEndPoint, TimeSpan.FromSeconds(5));
 }
Exemplo n.º 21
0
        public void BadPasswordTest()
        {
            IUsersManager manager = new UsersManager(new UserDataStorageInRAMStrategy());

            manager.Register("user", "pass");
            Assert.Null(manager.Login("user", "pas"));
        }
Exemplo n.º 22
0
        protected void Btn_submit_Click(object sender, EventArgs e)
        {
            Model.Users users = new Model.Users();
            users.userName = txbUserName.Text;
            users.password = txbPassword1.Text;
            users.gender   = DropDownList1.SelectedItem.Text;

            string date = DropDownListYear.SelectedItem.Text.Trim().ToString() + "/" + DropDownListMonth.SelectedItem.Text.Trim().ToString() + "/" + DropDownListDay.SelectedItem.Text.Trim().ToString();
            //string dateString = date;
            //DateTime dt = DateTime.ParseExact(dateString, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
            //users.birthDate = dt;
            DateTime time = Convert.ToDateTime(date);

            users.birthDate = time;
            //users.birthDate = Convert.ToDateTime("1985-12-25");

            BLL.UsersManager users1 = new UsersManager();
            bool             bo     = users1.Add(users);

            if (bo == true)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                Response.Write("<script language=javascript>alert('注册失败!')");
            }
        }
Exemplo n.º 23
0
    private void CmdLogin_ServerClick(Object sender, EventArgs e)
    {
        UsersManager um     = new UsersManager();
        HttpCookie   cookie = um.doLogin(txtUserName.Value, txtUserPass.Value);

        if (cookie != null)
        {
            Response.Cookies.Add(cookie);

            // Redirect to requested URL, or homepage if no previous page
            // requested
            string returnUrl = Request.QueryString["ReturnUrl"];
            if (returnUrl == null)
            {
                returnUrl = "/";
            }

            Response.Redirect(returnUrl);
        }
        else
        {
            ErrorLabel.Text    = errorText;
            ErrorLabel.Visible = true;
        }
    }
Exemplo n.º 24
0
        public JsonResult GetUsers()
        {
            UsersManager usersManager = new UsersManager();
            var          result       = usersManager.GetUsers();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 25
0
        //Approve Employee's Application
        public IActionResult EmployeeApprove(int id)
        {
            LogRestaurant();
            ClaimsPrincipal cp                 = this.User;
            var             claims             = cp.Claims.ToList();
            var             restId             = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var             userId             = EmployeesManager.GetUserIdByEmployeeId(id);
            var             authId             = UsersManager.GetAuthIdByUserId(userId);
            var             restaurantEmployee = RestaurantsManager.RestaurantByEmployeeId(restId, id);

            restaurantEmployee.NewRequestFlag = false;
            restaurantEmployee.Status         = "Employee";
            restaurantEmployee.RequestStatus  = "Approved";
            restaurantEmployee.Active         = true;
            RestaurantsManager.UpdateRestaurantEmployee(restaurantEmployee);
            var authRestaurant = UsersManager.GetAuthenticationMatrixByIDs(restId, authId);

            if (authRestaurant == null)
            {
                var authRest = new AuthenticationMatrix
                {
                    RestaurantId     = restId,
                    AuthenticationId = authId,
                    Role             = "Employee"
                };
                UsersManager.AddOwnerToAuthetication(authRest);
            }
            else
            {
                authRestaurant.Role = "Employee";
                UsersManager.UpdateAuthenticationMatrixByIDs(authRestaurant);
            }
            return(RedirectToAction("RestaurantEmployeesShow"));
        }
Exemplo n.º 26
0
        public JsonResult UpdateUser(Users user)
        {
            UsersManager usersManager = new UsersManager();
            var          result       = usersManager.Update(user);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 27
0
        //Edit Owner's details
        public IActionResult OwnerEdit(int id)
        {
            LogRestaurant();
            ClaimsPrincipal cp              = this.User;
            var             claims          = cp.Claims.ToList();
            var             restId          = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var             restaurantOwner = RestaurantsManager.RestaurantByOwnerId(restId, id);
            var             ownerUser       = UsersManager.GetUserByUserId(restaurantOwner.Owner.UserId);
            string          fullName        = $"{ownerUser.FirstName} {ownerUser.LastName}";
            var             viewOwner       = new OwnerModelView
            {
                RestaurantId  = restaurantOwner.RestaurantId,
                OwnerId       = restaurantOwner.OwnerId,
                UserId        = ownerUser.UserId,
                OwnerFullName = fullName,
                Active        = restaurantOwner.Active,
                Status        = restaurantOwner.Status,
                StartDate     = (DateTime)restaurantOwner.StartDate,
                EndDate       = restaurantOwner.EndDate,
                RequestFlag   = restaurantOwner.Request,
                RequestStatus = restaurantOwner.RequestStatus
            };

            ViewBag.OwnerStatus = GetOwnerStatus();
            return(View(viewOwner));
        }
Exemplo n.º 28
0
        public JsonResult DeleteUser(int Id)
        {
            UsersManager usersManager = new UsersManager();

            usersManager.Delete(Id);
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 29
0
        private static void GetUsers()
        {
            var usersManager = new UsersManager();

            usersManager.setTokenAuth("XYZ");

            String[] logins =
            {
                "foobar",
                "barfoo"
            };

            var users = usersManager.getUsers(logins);

            Console.WriteLine("Found " + users.Count + " users." + Environment.NewLine);

            foreach (Hashtable user in users)
            {
                Console.WriteLine("------------------------------");
                Console.WriteLine("Login:\t\t\t" + user["login"]);
                Console.WriteLine("E-Mail:\t\t\t" + user["email"]);
                Console.WriteLine("Alias:\t\t\t" + user["alias"]);
                Console.WriteLine(String.Empty);
                Console.WriteLine("Password Hash:\t\t" + user["password"]);
                Console.WriteLine("Token Auth:\t\t" + user["token_auth"]);
                Console.WriteLine(String.Empty);
                Console.WriteLine("Date Registered:\t" + user["date_registered"]);
                Console.WriteLine("Is Superuser?:\t\t" + ((int)user["superuser_access"] == 0 ? "No" : "Yes"));
            }
        }
Exemplo n.º 30
0
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl = returnUrl ?? Url.Content("~/");

            if (ModelState.IsValid)
            {
                if (!UsersManager.CanSignIn(context, Input.Email))
                {
                    ModelState.AddModelError(string.Empty, "User either not exists or application has not been approved yet");
                    return(Page());
                }

                var result = await signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure : true);

                if (result.Succeeded)
                {
                    logger.LogInformation("User logged in.");
                    return(LocalRedirect(returnUrl));
                }
                if (result.IsLockedOut)
                {
                    logger.LogWarning("User account locked out.");
                    return(RedirectToPage("./Lockout"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Invalid login attempt.");
                    return(Page());
                }
            }

            return(Page());
        }
        public ActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new User()
                {
                    UserName = model.UserName, UserRole = _userRolesRepository.GetById(model.UserRole)
                };
                var result = UsersManager.Create(user, model.Password);

                if (result.Succeeded)
                {
                    SignInManager.SignIn(user, false, false);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError("", error);
                    }
                }
            }

            SelectList roles = new SelectList(_userRolesRepository.GetAll().Where(r => r.Id != 1), "Id", "Name");

            ViewBag.Roles = roles;

            return(View(model));
        }
Exemplo n.º 32
0
 public void GetListTest()
 {
     UsersManager target = new UsersManager(); // TODO: Initialize to an appropriate value
     IEnumerable<User> expected = null; // TODO: Initialize to an appropriate value
     IEnumerable<User> actual;
     actual = target.GetList();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 33
0
 public AccountController(
     LoginManager loginManager,
     UsersManager usersManager,
     IAuthenticationManager authenticationManager)
 {
     this.loginManager = loginManager;
     this.usersManager = usersManager;
     this.authenticationManager = authenticationManager;
 }
Exemplo n.º 34
0
 public void DeleteTest()
 {
     UsersManager target = new UsersManager(); // TODO: Initialize to an appropriate value
     User entity = null; // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.Delete(entity);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 35
0
        public UsersForm(UsersManager usersManager, GroupsManager groupsManager)
        {
            InitializeComponent();

            UsersManager = usersManager;
            GroupsManager = groupsManager;

            UsersChanged = false;
            GroupsChanged = false;
        }
Exemplo n.º 36
0
 private void UpdateServerFields(
     Server existingServer,
     AgentUpdateMessage agentUpdateMessage,
     UsersManager userManager)
 {
     existingServer.MacAddress = agentUpdateMessage.MacAddress;
     existingServer.Name = agentUpdateMessage.Name;
     existingServer.FreeSpace = agentUpdateMessage.FreeSpace;
     existingServer.UsedSpace = agentUpdateMessage.UsedSpace;
     existingServer.User = userManager.FindById(agentUpdateMessage.UserId);
 }
Exemplo n.º 37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Êý¾Ý¿â²Ù×÷

                UsersManager Manager = new UsersManager();

                //Ìí¼Ó
                //Manager.Save(new UsersInfo()
                //{
                //    UserID = 1,
                //    UserName = "******",
                //    Password = "******",
                //    IsDeleted = 0,
                //    Sort = 1,
                //    State = 0
                //});

                //ÐÞ¸Ä
                //Manager.Update(new CustomerInfo() { UserID = 1, UserName = "******", Password = "******"});
                //ɾ³ý
                //Manager.Remove(8);
                //²éѯ
                ci = Manager.Get(1);

                int TotalCount;
                IList<UsersInfo> value = Manager.Find(out TotalCount);
                RptCustomers.DataSource = value;
                RptCustomers.DataBind();


                #endregion

                #region Json Serialization

                var expected = new UsersInfo()
                {
                    UserID = 1,
                    UserName = "******",
                    Password = "******",
                    IsDeleted = 0,
                    Sort = 1,
                    State = 0
                };

                // {"id":3,"title":"test","date":"2009-12-02T05:12:00"}
                var _serialize = JsonHelper.Register<UsersJavaScriptConverter>();
                _json = _serialize.Serialize(expected);
                json = JsonConverter.Serialize<IList<UsersInfo>>(value);
                #endregion
            }
        }
 public AccountController(UsersManager usersManager, TokenManager tokenManager)
 {
     this._usersManager = usersManager;
     this._tokenManager = tokenManager;
 }
 public AccountController(UsersManager usersManager, TokenManager tokenManager, ActiveDirectoryManager activeDirectoryManager)
 {
     this._usersManager = usersManager;
     this._tokenManager = tokenManager;
     this._activeDirectoryManager = activeDirectoryManager;
 }
 public AccountController(UsersManager usersManager)
 {
     this._usersManager = usersManager;
 }
Exemplo n.º 41
0
 public void SaveOrUpdateTest()
 {
     UsersManager target = new UsersManager(); // TODO: Initialize to an appropriate value
     User entity = null; // TODO: Initialize to an appropriate value
     target.SaveOrUpdate(entity);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 42
0
 public void UsersManagerConstructorTest()
 {
     UsersManager target = new UsersManager();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
 public AdminController(UsersManager usersManager, AdminManager adminManager)
 {
     this._usersManager = usersManager;
     this._adminManager = adminManager;
 }
 public FavoritesController(ArticleManager articleManager, UsersManager usersManager)
 {
     this._articleManager = articleManager;
     this._usersManager = usersManager;
 }
Exemplo n.º 45
0
 public void GetTest1()
 {
     UsersManager target = new UsersManager(); // TODO: Initialize to an appropriate value
     long id = 0; // TODO: Initialize to an appropriate value
     bool eagerLoad = false; // TODO: Initialize to an appropriate value
     User expected = null; // TODO: Initialize to an appropriate value
     User actual;
     actual = target.Get(id, eagerLoad);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public SolutionFinderController(SolutionFinderManager _solFinderManager, ArticleManager articleManager, UsersManager usersManager)
 {
     this._solFinderManager = _solFinderManager;
     this._articleManager = articleManager;
     this._usersManager = usersManager;
 }