Beispiel #1
0
 private void MainWindowViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName.Equals("FilterText"))
     {
         UserListView.Refresh();
     }
 }
 private void LogOutBtn_Click(object sender, EventArgs e)
 {
     LogedInUserLabel.Text            = "---";
     HelperClass.Instance.LogedInUser = null;
     TogleBtns();
     UserListView.Clear();
 }
Beispiel #3
0
 protected void Update_Command(object sender, ListViewUpdateEventArgs e)
 {
     MessageUserControl.TryRun(() =>
     {
         MessageUserControl.Visible = true;
         UserProfile user           = new UserProfile();
         Utility utility            = new Utility();
         user.FirstName             = (UserListViewEdit.EditItem.FindControl("FirstNameLabel") as TextBox).Text;
         user.LastName          = (UserListViewEdit.EditItem.FindControl("LastNameLabel") as TextBox).Text;
         user.SiteId            = int.Parse((UserListViewEdit.EditItem.FindControl("SiteDropDownList") as DropDownList).SelectedValue);
         user.RequestedPassword = (UserListViewEdit.EditItem.FindControl("RequestedPasswordLabel") as TextBox).Text;
         user.UserName          = (UserListViewEdit.EditItem.FindControl("UserNameLabel") as Label).Text;
         user.Active            = (disabledCheckBox.Checked);
         utility.checkValidString(user.RequestedPassword);
         utility.checkValidString(user.FirstName);
         utility.checkValidString(user.LastName);
         // check to see if the user being edited is the webmaster
         if ((UserListViewEdit.EditItem.FindControl("UserNameLabel") as Label).Text != "Webmaster")
         {
             // change the role of non webmasters
             var roleList = new List <string>();
             roleList.Add((UserListViewEdit.EditItem.FindControl("RoleMembershipsDropDown") as DropDownList).SelectedValue);
             user.RoleMemberships = roleList;
         }
         user.Active        = (UserListViewEdit.EditItem.FindControl("disabledCheckBox") as CheckBox).Checked;
         UserManager sysmgr = new UserManager();
         sysmgr.UpdateUser(user);
         UserListViewEdit.EditIndex  = -1;
         List <UserProfile> info     = sysmgr.ListUser_BySearchParams(username, site, role, status);
         UserListViewEdit.DataSource = info;
         UserListViewEdit.DataBind();
         UserListView.DataBind();
     }, "Success", "Successfully updated users");
 }
Beispiel #4
0
        protected override void InitializeView(ViewType viewType, MyProcess process)
        {
            switch (viewType)
            {
            case ViewType.Main:
                if (ViewsDictionary.ContainsKey(viewType))
                {
                    ViewsDictionary[viewType] = new UserListView();
                }
                else
                {
                    ViewsDictionary.Add(viewType, new UserListView());
                }
                break;

            case ViewType.SeeInfo:
                if (ViewsDictionary.ContainsKey(viewType))
                {
                    ViewsDictionary[viewType] = new FormView(process);
                }
                else
                {
                    ViewsDictionary.Add(viewType, new FormView(process));
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(viewType), viewType, null);
            }
        }
Beispiel #5
0
 protected void BtnSearch_Click(object sender, EventArgs e)
 {
     MessageUserControl.TryRun(() =>
     {
         MessageUserControl.Visible = true;
         Utility utility            = new Utility();
         utility.checkValidString(txtSearchMaster.Text);
         LookupUsers();
         SiteController sitemgr = new SiteController();
         UserManager usermgr    = new UserManager();
         if (User.IsInRole(SecurityRoles.AdminEdits))
         {
             // if the user is an AdminEdit do not show him users with the superuser role and do not show him the admin site
             SiteAddDropDownList.DataSourceID = null;
             List <Site> info = new List <Site>();
             info.Add(sitemgr.Site_FindById(usermgr.GetUserSiteId(User.Identity.Name)));
             SiteAddDropDownList.DataSource = info;
             UserListView.DataSourceID      = "";
             UserListView.DataSource        = usermgr.ListUser_BySearchParams("", new List <int>(new int[] { sitemgr.Site_FindById(usermgr.GetUserSiteId(User.Identity.Name)).SiteId }), new List <string>(), 3);
             SiteCheckBoxList.Enabled       = false;
             SiteCheckBoxList.Visible       = false;
             SiteScrollDiv.Visible          = false;
         }
         UserListView.DataBind();
         MessageUserControl.Visible = false;
     });
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            var list = userBal.Admin_GetAllUsers();

            UserListView.DataSource = list;
            UserListView.DataBind();
        }
        /// <summary>
        /// Creates the user ListView.
        /// </summary>
        /// <param name="userCollection">The user collection.</param>
        /// <param name="selectedEmail">The selected email.</param>
        /// <param name="selectedName">Name of the selected.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">userCollection</exception>
        public IUserListView CreateUserListView(IList <IUserDetail> userCollection, string selectedEmail,
                                                string selectedName, string message)
        {
            if (userCollection == null)
            {
                throw new ArgumentNullException(nameof(userCollection));
            }


            //filter with Email
            var filteredList = userCollection.Where(x =>
                                                    x.Email.Contains(string.IsNullOrEmpty(selectedEmail)
                    ? x.Email
                    : selectedEmail)).ToList();

            //Filter by Name

            filteredList = filteredList.Where(x =>
                                              (x.FirstName + " " + x.LastName).Contains(string.IsNullOrEmpty(selectedName)
                    ? (x.FirstName + " " + x.LastName)
                    : selectedName)).ToList();

            var returnView = new UserListView
            {
                UserCollection    = filteredList,
                SelectedEmail     = selectedEmail,
                SelectedName      = selectedName,
                ProcessingMessage = message ?? ""
            };

            return(returnView);
        }
        protected void DeleteLinkButton_Click(object sender, EventArgs e)
        {
            LinkButton       lb    = (LinkButton)sender;
            ListViewDataItem lvdi  = (ListViewDataItem)lb.NamingContainer;
            ListView         lv    = (ListView)lvdi.NamingContainer;
            String           email = lv.DataKeys[lvdi.DataItemIndex].Values["email"].ToString();

            try
            {
                String SQLString = "DELETE FROM users WHERE email =  @email";
                System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
                using (SqlConnection connection = new SqlConnection(config.ConnectionStrings.ConnectionStrings["MarshFormsConnectionString"].ConnectionString))
                {
                    SqlCommand command = new SqlCommand(SQLString, connection);
                    command.Parameters.AddWithValue("@email", String.IsNullOrEmpty(email) ? (object)DBNull.Value : email);
                    command.Connection.Open();
                    command.ExecuteNonQuery();
                }
                UserListView.DataBind();
            }
            catch (Exception ex)
            {
                MessageLabel.Text = ex.Message.ToString();
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        IOAuthCredentials creds = new SessionStateCredentials();

        creds.ConsumerKey    = ConfigurationManager.AppSettings["twitterConsumerKey"];
        creds.ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"];
        creds.AccessToken    = ConfigurationManager.AppSettings["twitterAccessToken"];
        creds.OAuthToken     = ConfigurationManager.AppSettings["twitterOauthToken"];
        //Auth Object With Credentials
        var auth = new WebAuthorizer
        {
            Credentials = creds
        };
        var twitterCtx = new TwitterContext(auth);

        var users =
            (from user in twitterCtx.Status
             where user.Type == StatusType.User &&
             user.ScreenName == "JoeMayo" &&
             user.Count == 200
             select user)
            .ToList();

        UserListView.DataSource = users;
        UserListView.DataBind();
    }
Beispiel #10
0
 public UsersManagementModule(IRegionManager regionManager, IModuleManager moduleManager, IEventAggregator eventAggregator)
     : base(regionManager, moduleManager, eventAggregator)
 {
     m_UsersButton   = new ApplicationMenuButtonView(this);
     m_RibbonTabItem = new UsersRibbonTabItemView(this);
     m_EditUser      = new EditUserView(this);
     m_UserList      = new UserListView();
 }
Beispiel #11
0
        private void OpenUserListCommandExecute()
        {
            var dialog = new UserListView {
                ReloadParent = LoadData
            };

            dialog.ShowDialog();
        }
        public async Task <ActionResult> GetUserList()
        {
            UserListView model = new UserListView();

            User[] users = (await _userRepository.GetUsersAsync(1, 100, 0, SortDirection.Ascending, string.Empty)).ToArray();
            model.ListUser = users;

            return(PartialView("GetUser", model));
        }
Beispiel #13
0
        private void UpdateList()
        {
            ///<summary>
            /// Update the content of the form listing all the known users with the relative images.
            /// At the end of the method, the form is shown.
            ///</summary>

            if (this.InvokeRequired)
            {
                /* The current thread is not the owner of the form so the owner
                 * is asked to call the method to perform the modification
                 */
                UpdateListCallback callback = new UpdateListCallback(UpdateList);
                UserListView.Invoke(callback);
            }
            else
            {
                ImageList imgl = new ImageList();
                Image     img;
                imgl.ImageSize  = new Size(150, 150);                           // The size of the pictures of the user.
                imgl.ColorDepth = ColorDepth.Depth32Bit;                        // The quality of the images. 32bit is the maximum.
                UserListView.Clear();                                           // Clear out the current list of user. It may contains users that are now disconnected.
                lock (Program.users) {
                    #region AddImages
                    foreach (User u in Program.users.Values)
                    {
                        img = Image.FromFile(u.imagePath ?? Program.defaultImagePath);
                        imgl.Images.Add(u.ip, img);
                    }
                    UserListView.LargeImageList = imgl;
                    #endregion
                    #region Add names

                    /* Each image in the image list has an index. Since the list of user is scanned
                     * in the same order, each i-th name in the for will correspond the the i-th image
                     * scanned before, so to get the right index of the current name and image is
                     * enough to use a counter (the local variable "i")
                     */
                    var i = 0;
                    foreach (User u in Program.users.Values)
                    {
                        UserListView.Items.Add(u.ip, u.publicName, i++);

                        /* The image key can be retrived when the item is selected.
                         * By storing the ip of the corresponding user, it will be possible to get all
                         * the information regarding him since the user are stored in a dictionary
                         * where the key is the ip address.
                         */
                        UserListView.Items[i - 1].ImageKey = u.ip;
                    }
                    #endregion
                }
            }
            /* The confirm button has to be enabled only if at least one item is selected */
            Confirm.Enabled = false;
        }
        public IUserListView CreateUsersListView(IList <IUserRegistration> userListView, string message)
        {
            var returnView = new UserListView
            {
                UserRegistrationList = userListView,
                ProcessingMessage    = message
            };

            return(returnView);
        }
Beispiel #15
0
        private void PreviousNavCommandHandler()
        {
            UserListView.MoveCurrentToPrevious();

            if (UserListView.IsCurrentBeforeFirst == true)
            {
                UserListView.MoveCurrentToFirst();
            }

            SelectedUser = (UserModel)UserListView.CurrentItem;
        }
Beispiel #16
0
        private void NextNavCommandHandler()
        {
            UserListView.MoveCurrentToNext();

            if (UserListView.IsCurrentAfterLast == true)
            {
                UserListView.MoveCurrentToLast();
            }

            SelectedUser = (UserModel)UserListView.CurrentItem;
        }
Beispiel #17
0
        /// <summary>
        /// 初始化用户列表
        /// </summary>
        private void RefreshUserList()
        {
            UserListView.BeginUpdate();

            UserListView.Items.Clear();
            foreach (var user in _chatRoom.Users.Values)
            {
                AddUser(user);
            }

            UserListView.EndUpdate();
        }
Beispiel #18
0
        private void FollowingButton_Clicked(object sender, EventArgs e)
        {
            var listview = new UserListView
            {
                Fetchable = new AccountFetch.Followings(App.Tail, issuer, binding)
            };

            App.Navigation.PushAsync(new ContentPage()
            {
                Style = (Style)Application.Current.Resources["backgroundStyle"], Content = listview, Title = binding.NickName + "님의 팔로잉"
            });
        }
Beispiel #19
0
        /// <summary>
        /// Sort the list based on the given property
        /// </summary>
        /// <param name="obj"></param>
        private void SortList(string obj)
        {
            string propertyToSort = null;

            if (obj != null)
            {
                propertyToSort = SetUpSorting(obj);

                UserListView.SortDescriptions.Add(new SortDescription(propertyToSort, sortDirection)); //set the sorting to the view

                UserListView.Refresh();                                                                // force refresh to ensure gui update
            }
        }
Beispiel #20
0
 public ActionResult Index(UserListView model)
 {
     try
     {
         var entity = _unitOfWork.UserRepository.Get();
         model.Items = Mapper.Map <List <UserView> >(entity);
         return(View(model));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #21
0
 public MessagesViewModel(INavigation navigation, string userName)
 {
     this.userName = userName;
     client        = new Client(userName);
     sendCommand   = new Command(() => Send(), () => !string.IsNullOrEmpty(message));
     showUsers     = new Command(() => {
         var userList            = new UserListView();
         userList.BindingContext = this;
         navigation.PushAsync(userList);
     }
                                 );
     messages = new ObservableCollection <DIRCMessage>();
 }
        /// <summary>
        /// Creates the user registration view.
        /// </summary>
        /// <returns></returns>
        public IUserListView CreateUserRegistrationView(IList <IUserRegistration> userList, string Email, string FirstName)
        {
            //filter with desciprtion
            var filteredList = userList.Where(x => x.FirstName.Contains(string.IsNullOrEmpty(FirstName) ? x.FirstName : FirstName)).ToList();

            filteredList = userList.Where(x => x.Email.Contains(string.IsNullOrEmpty(Email) ? x.Email :Email)).ToList();


            var view = new UserListView
            {
                UserRegistrationList = filteredList
            };

            return(view);
        }
Beispiel #23
0
        private void userListToolStripButtonClicked(object sender, EventArgs e)
        {
            UserListView userListView = new UserListView(userModel, issueModel, projectModel, projectMemberModel);
            Form         form         = FindForm("UserListView");

            if (form == null)
            {
                userListView.ShowDialog();
            }

            /*            userListView.Visible = true;
             *          userListView.Owner = null;
             *          //if (this.Owner != null)
             *              this.Close();*/
        }
        protected void Delete_Command(object sender, CommandEventArgs e)
        {
            int Id     = int.Parse((string)e.CommandArgument);
            var result = userBal.DeleteAccount(Id);

            if (result.IsSuccess == true)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "Scripts", "<script>alert('" + result.Message + "');</script>");

                var list = userBal.Admin_GetAllUsers();

                UserListView.DataSource = list;
                UserListView.DataBind();
            }
        }
Beispiel #25
0
 //리스트뷰 초기화
 private void initListView()
 {
     editGroupBox.Visible = false;
     UserListView.Clear();
     UserListView.Columns.Clear();
     UserListView.View = View.Details;
     // Add columns
     UserListView.Columns.Add("아이디", 100, HorizontalAlignment.Left);
     UserListView.Columns.Add("이름", 100, HorizontalAlignment.Left);
     UserListView.Columns.Add("이메일", 200, HorizontalAlignment.Left);
     UserListView.Columns.Add("전화번호", 100, HorizontalAlignment.Left);
     UserListView.Columns.Add("챗봇연동키", 100, HorizontalAlignment.Left);
     UserListView.Columns.Add("사용자구분", 100, HorizontalAlignment.Left);
     UserListView.Columns.Add("등록자", 100, HorizontalAlignment.Left);
     UserListView.Columns.Add("등록일시", 200, HorizontalAlignment.Left);
     UserListView.Columns.Add("수정일시", 200, HorizontalAlignment.Left);
 }
Beispiel #26
0
 public void Clear()
 {
     if (UserListView.InvokeRequired)
     {
         UserListView.Invoke(new MethodInvoker(delegate
         {
             _usersList.Clear();
             CountLabel.Text = "Count: 0";
             UserListView.Items.Clear();
         }));
     }
     else
     {
         CountLabel.Text = "Count: 0";
         UserListView.Items.Clear();
     }
 }
 private void LoadUsers()
 {
     UserListView.Clear();
     UserListView.Columns.Add("Belépési Pont");
     UserListView.Columns.Add("Felhasználónév");
     UserListView.Columns.Add("Hashelt Jelszó");
     foreach (User u in HelperClass.Instance.Users)
     {
         ListViewItem item = new ListViewItem();
         item.Text = u.EntriPoint.ToString();
         item.SubItems.Add(u.UserName);
         item.SubItems.Add(u.PasswordHash);
         UserListView.Items.Add(item);
     }
     UserListView.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize);
     UserListView.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.HeaderSize);
     UserListView.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent);
 }
Beispiel #28
0
        public void DisplayOnTheScreenUserList(List <InstagramUser> usersList)
        {
            Clear();

            _usersList = usersList.GetRange(0, usersList.Count).OrderByDescending(u => u.NumberLikes).ToList();

            var likesPosted = _usersList.FindAll(_ => _.LikeSet).Count;

            if (UserListView.InvokeRequired)
            {
                UserListView.Invoke(new MethodInvoker(delegate
                {
                    CountLabel.Text       = "Count: " + _usersList.Count.ToString();
                    LikesPostedLabel.Text = "Likes posted: " + likesPosted.ToString();
                }));
            }
            else
            {
                CountLabel.Text       = "Count: " + _usersList.Count.ToString();
                LikesPostedLabel.Text = "Likes posted: " + likesPosted.ToString();
            }

            foreach (var instagramUser in _usersList)
            {
                if (UserListView.InvokeRequired)
                {
                    UserListView.Invoke(new MethodInvoker(delegate
                    {
                        UserListView.Items.Add(new ListViewItem(new string[]
                        {
                            instagramUser.UserName, instagramUser.NumberLikes.ToString(), instagramUser.LikeSet.ToString()
                        }));
                    }));
                }
                else
                {
                    UserListView.Items.Add(new ListViewItem(new string[]
                    {
                        instagramUser.UserName, instagramUser.NumberLikes.ToString(), instagramUser.LikeSet.ToString()
                    }));
                }
            }
        }
        private void PopulateList()
        {
            UserListView.BeginUpdate();
            UserListView.Items.Clear();

            int SelectedItemIndex = -1;

            string[] Filter = FilterTextBox.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            for (int Idx = 0; Idx < Users.Count; Idx++)
            {
                PerforceUserRecord User = Users[Idx];
                if (IncludeInFilter(User, Filter))
                {
                    ListViewItem Item = new ListViewItem(User.Name);
                    Item.SubItems.Add(new ListViewItem.ListViewSubItem(Item, User.FullName));
                    Item.SubItems.Add(new ListViewItem.ListViewSubItem(Item, User.Email));
                    Item.Tag = (int)Idx;
                    UserListView.Items.Add(Item);

                    if (SelectedItemIndex == -1 && Idx >= SelectedUserIndex)
                    {
                        SelectedItemIndex = UserListView.Items.Count - 1;
                        Item.Selected     = true;
                    }
                }
            }

            if (SelectedItemIndex == -1 && UserListView.Items.Count > 0)
            {
                SelectedItemIndex = UserListView.Items.Count - 1;
                UserListView.Items[SelectedItemIndex].Selected = true;
            }

            if (SelectedItemIndex != -1)
            {
                UserListView.EnsureVisible(SelectedItemIndex);
            }

            UserListView.EndUpdate();

            UpdateOkButton();
        }
Beispiel #30
0
        public ActionResult UserList(string successMessage, string errorMessage)
        {
            // Get Error message if exists.
            if (!string.IsNullOrEmpty(errorMessage))
            {
                ViewBag.ErrorMessage = errorMessage;
            }

            // Get Success message if exists.
            if (!string.IsNullOrEmpty(successMessage))
            {
                ViewBag.SuccessMessage = successMessage;
            }

            var roles = RoleManager.GetRolesByOwner();
            var users = UserManager.GetUsersByOwner().ToList()
                        .Select(x => new UserViewModel()
            {
                ID             = x.Id,
                Email          = x.Email,
                IsAccountOwner = x.IsAccountOwner,
                RolesList      = (from ur in x.Roles
                                  join r in roles on ur.RoleId equals r.Id
                                  select new SelectListItem()
                {
                    Value = r.Id, Text = r.Description
                }).ToList()
            });


            var userList = new UserListView()
            {
                Items = users
            };

            userList.CanAdd    = UserManager.CanPerform(Constants.Operation.User_Create);
            userList.CanEdit   = UserManager.CanPerform(Constants.Operation.User_Edit);
            userList.CanDelete = UserManager.CanPerform(Constants.Operation.User_Delete);

            return(View(userList));
        }