Exemplo n.º 1
0
        public IHttpActionResult GetUsersList(int id)
        {
            UsersList usersList = db.UsersLists.Find(id);

            if (usersList == null)
            {
                return(NotFound());
            }

            return(Ok(usersList));
        }
Exemplo n.º 2
0
 private void RemoveUser(string username)
 {
     for (int i = 0; i < UsersList.Count; i++)
     {
         if (UsersList[i].Username.Equals(username))
         {
             UsersList.RemoveAt(i);
             break;
         }
     }
 }
Exemplo n.º 3
0
 public void Test_Event_Is_This_Month_Returns_True()
 {
     start        = new string[] { "10", "10" };
     end          = new string[] { "20", "20" };
     user         = new User("user");
     participants = new UsersList();
     appointment  = new Appointment("evento", "descripcion", DateTime.Today, start, end, user, participants);
     month        = DateTime.Now.Month;
     year         = DateTime.Now.Year;
     Assert.IsTrue(appointment.IsThisMonth(month, year));
 }
Exemplo n.º 4
0
        private void Remove()
        {
            UsersList.RemoveAt(CurrentUserSelection);
            EnableNext = (UsersList.Count > 0);

            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
            scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
        }
Exemplo n.º 5
0
        public void Test_Clear_Users_Works()
        {
            user  = new User("usuario");
            users = new UsersList();
            users.AddUser(user);
            users.ClearUsers();
            List <User> userList = new List <User> {
            };

            Assert.AreEqual(userList, users.Users);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Генератор Ид списка пользователей
        /// </summary>
        /// <returns>Новый ИД</returns>
        private int IdUserGenerator()
        {
            int id = 1;

            if (UsersList.Count != 0)
            {
                id  = UsersList.OrderBy(s => s.Id).LastOrDefault().Id;
                id += 1;
            }
            return(id);
        }
Exemplo n.º 7
0
        public void PopulationTableUsers(UsersList dataFromApi)
        {
            dataFromApi.Users.ForEach(x =>
            {
                var hash     = hashService.BuildHash(x.Role);
                x.Hash       = hash;
                var decript  = Encoding.UTF8.GetString(Convert.FromBase64String(hash));
                x.HashDecrip = decript;
            });

            userRepository.PopulationTableUsers(dataFromApi.Users);
        }
Exemplo n.º 8
0
        public IHttpActionResult PostUsersList(UsersList usersList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.UsersLists.Add(usersList);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = usersList.Id }, usersList));
        }
Exemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();
            User2DataContext DBUsers = new User2DataContext();
            List <Users>     l       = DBUsers.GetListOfUsers().ToList();

            foreach (Users u in l)
            {
                UsersList.Add(u);
            }
            DataContext = this;
        }
Exemplo n.º 10
0
 public IMemberData GetContactByName(string name)
 {
     if (UsersList.ContainsKey(name))
     {
         return(UsersList[name]);
     }
     if (GroupsList.ContainsKey(name))
     {
         return(GroupsList[name]);
     }
     return(null);
 }
Exemplo n.º 11
0
        private void BindUsers()
        {
            UsersList.Items.Clear();
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("UserId", typeof(string)));                                           // 0
            dt.Columns.Add(new DataColumn("UserName", typeof(string)));                                         // 1
            DataRow dr;

            using (IDataReader reader = SecureGroup.GetListAllUsersInGroup(int.Parse(GroupsList.SelectedValue)))
            {
                while (reader.Read())
                {
                    if ((byte)reader["Activity"] == (byte)Mediachase.IBN.Business.User.UserActivity.Active)
                    {
                        dr    = dt.NewRow();
                        dr[0] = reader["UserId"].ToString();
                        dr[1] = reader["LastName"].ToString() + " " + reader["FirstName"].ToString();
                        dt.Rows.Add(dr);
                    }
                }
            }

            if (dt.Rows.Count == 0)             // no users in group
            {
                dr    = dt.NewRow();
                dr[0] = "-1";
                dr[1] = GetGlobalResourceObject("IbnFramework.Project", "NoUsers").ToString();
                dt.Rows.Add(dr);
            }

            DataView dv = dt.DefaultView;

            UsersList.DataSource     = dv;
            UsersList.DataTextField  = "UserName";
            UsersList.DataValueField = "UserId";
            UsersList.DataBind();

            //Saved Value
            ListItem li = UsersList.Items.FindByValue(UserId);

            if (li != null)
            {
                li.Selected = true;
            }
            else
            {
                UsersList.SelectedIndex = 0;
                UserId = UsersList.SelectedValue;
            }

            BindData();
        }
Exemplo n.º 12
0
        public void Add()
        {
            User NewUser = new User();

            NewUser.FirstName    = FirstName;
            NewUser.LastName     = LastName;
            NewUser.Email        = Email;
            NewUser.Tel          = Tel;
            NewUser.Handtekening = Handtekening;
            UsersList.Add(NewUser);
            Save();
        }
Exemplo n.º 13
0
        public void Test_Participates_In_Event_Returns_True_When_Is_Participant()
        {
            start = new string[] { "10", "10" };
            end   = new string[] { "20", "20" };
            User user2 = new User("user2");

            participants = new UsersList();
            participants.AddUser(user);
            appointment = new Appointment("evento", "descripcion", DateTime.Today, start, end, user2, participants);

            Assert.IsTrue(user.ParticipatesInEvent(appointment));
        }
Exemplo n.º 14
0
        private void BindUsers(int GroupId)
        {
            UsersList.Items.Clear();
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("UserId", typeof(string)));                                           // 0
            dt.Columns.Add(new DataColumn("UserName", typeof(string)));                                         // 1
            DataRow dr;

            dr    = dt.NewRow();
            dr[0] = allUsers;
            dr[1] = LocRM.GetString("All");
            dt.Rows.Add(dr);

            if (GroupId > 0)
            {
                using (IDataReader reader = SecureGroup.GetListAllUsersInGroup(GroupId))
                {
                    while (reader.Read())
                    {
                        if ((byte)reader["Activity"] == (byte)Mediachase.IBN.Business.User.UserActivity.Active)
                        {
                            dr    = dt.NewRow();
                            dr[0] = reader["UserId"].ToString();
                            dr[1] = reader["LastName"].ToString() + " " + reader["FirstName"].ToString();
                            dt.Rows.Add(dr);
                        }
                    }
                }
            }

            DataView dv = dt.DefaultView;

            UsersList.DataSource     = dv;
            UsersList.DataTextField  = "UserName";
            UsersList.DataValueField = "UserId";
            UsersList.DataBind();

            //Saved Value
            if (_pc["MV_User"] != null)
            {
                UsersList.ClearSelection();
                try
                {
                    UsersList.SelectedValue = _pc["MV_User"];
                }
                catch
                {
                    UsersList.SelectedIndex = 0;
                    _pc["MV_User"]          = UsersList.SelectedValue;
                }
            }
        }
Exemplo n.º 15
0
        private void Remove()
        {
            using (LogBlock logblock = Log.NotTracing() ? null : new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                UsersList.RemoveAt(CurrentUserSelection);
                EnableNext = (UsersList.Count > 0);

                ScheduleViewModel scheduleViewModel = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
                scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
                scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
            }
        }
Exemplo n.º 16
0
        public static User CreateUser(string name, string userName)
        {
            Guard.Against.NullOrEmpty(name, nameof(name));
            Guard.Against.NullOrEmpty(userName, nameof(userName));

            if (UsersList.Any(c => c.UserName.ToLower() == userName.ToLower()))
            {
                return(UsersList.Single(c => c.UserName.ToLower() == userName.ToLower()));
            }

            return(new User(name, userName));
        }
Exemplo n.º 17
0
        User(string name, string userName)
        {
            Guard.Against.NullOrEmpty(name, nameof(name));
            Guard.Against.NullOrEmpty(userName, nameof(userName));

            Id        = Guid.NewGuid();
            Name      = name;
            UserName  = userName;
            CreatedAt = DateTimeOffset.UtcNow;

            UsersList.Add(this);
        }
Exemplo n.º 18
0
        public void Test_Week_View_Event_Text_Returns_Correct_String()
        {
            start        = new string[] { "10", "10" };
            end          = new string[] { "20", "20" };
            user         = new User("user");
            participants = new UsersList();
            appointment  = new Appointment("evento", "descripcion", DateTime.Today, start, end, user, participants);

            string expected = "evento - Desde 10:10";

            Assert.AreEqual(expected, appointment.WeekViewAppointmentText(10));
        }
Exemplo n.º 19
0
        public void Test_Edit_Event_Edits_Description_Correctly()
        {
            start        = new string[] { "10", "10" };
            end          = new string[] { "20", "20" };
            user         = new User("user");
            participants = new UsersList();
            appointment  = new Appointment("evento", "descripcion", DateTime.Today, start, end, user, participants);
            appointment.Edit("evento2", "descripcion2", appointment.Date, start, end);
            Appointment expected = new Appointment("evento2", "descripcion2", appointment.Date, start, end, user, participants);

            Assert.AreEqual(expected.Description, appointment.Description);
        }
Exemplo n.º 20
0
 private void SaveSelected(object obj)
 {
     if (_selectedUser.Id == Guid.Empty)
     {
         _userService.Add(_selectedUser);
         UsersList.Add(_selectedUser);
     }
     else
     {
         _userService.Update(_selectedUser);
     }
 }
Exemplo n.º 21
0
        public ActionResult Login(Login model)
        {
            if (UsersList.IsUserExist(model.UserName))
            {
                @ViewBag.Name        = model.UserName;
                TempData["UserName"] = model.UserName;

                return(RedirectToAction("Index", "Home"));
            }

            @ViewBag.ErrorMessage = "User doesn't exist. Please register.";
            return(View("Index"));
        }
Exemplo n.º 22
0
        DataGridRow GetRow(int index)
        {
            var row = (DataGridRow)UsersList.ItemContainerGenerator.ContainerFromIndex(index);

            if (row != null)
            {
                return(row);
            }
            UsersList.UpdateLayout();
            UsersList.ScrollIntoView(UsersList.Items[index]);
            row = (DataGridRow)UsersList.ItemContainerGenerator.ContainerFromIndex(index);
            return(row);
        }
Exemplo n.º 23
0
        public void WriteUser(string userName)
        {
            var user = UsersList.ReturnUser(userName);

            if (user == null)
            {
                Console.WriteLine($"Пользователь с логином {userName} в списке отсутствует");
            }
            else
            {
                Console.WriteLine($"Имя -  {user.Name }, Логин -  {user.UserName }, Пароль -  {user.Password }");
            }
        }
Exemplo n.º 24
0
        public void ResetPassword(string userName, string newUserPassword)
        {
            var user = UsersList.ReturnUser(userName);

            if (user == null)
            {
                Console.WriteLine($"Пользователь с логином {userName} в списке отсутствует");
            }
            else
            {
                SetPassword(NewPasswordChecker, user, user.Password, newUserPassword);
            }
        }
Exemplo n.º 25
0
        // Users Config Dialog

        private void AddUser(object args)
        {
            var u = new UserViewModel(new UserModel("", 0));

            var  dialog = new AddUserDialog(u);
            bool?result = dialog.ShowDialog();

            if (!((result == null) || (!result.Value)))
            {
                UsersList.Add(u);
                _model.UsersList.Add(u.GetModel());
            }
        }
Exemplo n.º 26
0
        public User CreateUser(string userName, string name, string password)
        {
            var user = new User();

            //MessageBox.Show ("Экземпляр класса User успешно создан");
            user.UserName = CheckValue(UserNameChecker, UsersList.ReturnUser(userName), "", userName, "UserName");
            //user.UserName = CheckValue(UserNameChecker, ChekReal(userName), "", userName, "UserName");
            //MessageBox.Show ("Логин успешно присвоен");
            user.Name = CheckValue(NameChecker, user, "", name, $"{user.UserName}, Name");
            SetPassword(PasswordChecker, user, "", password);
            user.AdminStatus = Admin;
            return(UsersList.AddDB(user));
        }
        public void Test_Dates_Collide_When_Dates_Collide_Resturns_True()
        {
            oldStart      = new string[] { "10", "10" };
            oldEnd        = new string[] { "20", "20" };
            user          = new User("user");
            participants  = new UsersList();
            oldEvent      = new Appointment("evento", "descripcion", DateTime.Today, oldStart, oldEnd, user, participants);
            newEventDate  = DateTime.Today;
            newEventStart = new string[] { "11", "11" };
            newEventEnd   = new string[] { "22", "22" };

            Assert.IsTrue(Utils.DatesCollide(oldEvent, newEventDate, newEventStart, newEventEnd));
        }
Exemplo n.º 28
0
        public ActionResult StatusUserEdit(UsersList data)
        {
            var result = _updateMethods.UpdateUserStatus(new UserStatus()
            {
                Username = data.Username, NewStatus = data.Status
            }).Result;

            if (!result)
            {
                ModelState.AddModelError("", "¡Error al guardar los datos!\n");
                return(RedirectToAction("StatusUsers"));
            }
            return(RedirectToAction("StatusUsers"));
        }
Exemplo n.º 29
0
        private void Add(object value)
        {
            var name = value as string;

            UsersList.Add(new UsersViewModel("", ""));
            EnableNext = (UsersList.Count > 0);

            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.SchedList.Add(new SchedUser(name, false));
            scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
            scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
        }
Exemplo n.º 30
0
        public IHttpActionResult DeleteUsersList(int id)
        {
            UsersList usersList = db.UsersLists.Find(id);

            if (usersList == null)
            {
                return(NotFound());
            }

            db.UsersLists.Remove(usersList);
            db.SaveChanges();

            return(Ok(usersList));
        }