private void DgEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SelectUser = dgEmployee.SelectedItem as UserExtend;
            if (SelectUser != null)
            {
                this.LoadBuffer();
            }

            this.BtnEnabled();
        }
예제 #2
0
        public override void Remove(object curObj)
        {
            UserExtend userEx = curObj as UserExtend;

            foreach (User user in db.Users)
            {
                if (userEx.Login == user.Login)
                {
                    db.Users.Remove(user);
                    break;
                }
            }
            db.SaveChanges();
        }
        private void CreateUserExetend(User user)
        {
            UserExtend userEx = new UserExtend()
            {
                FirstName = user.FirstName,
                LastName  = user.LastName,
                Login     = user.Login,
                Password  = user.Password,
                Position  = user.Position.Name
            };

            listUsers.Add(userEx);
            SelectUser = userEx;
        }
        private void UpdateRecord()
        {
            UserExtend userEx = new UserExtend()
            {
                FirstName = userBuff.FirstName,
                LastName  = userBuff.LastName,
                Login     = userBuff.Login,
                Password  = userBuff.Password,
                Position  = userBuff.PositionName
            };

            foreach (var item in listUsers)
            {
                if (item.Login == userEx.Login)
                {
                    listUsers.Remove(item);
                    listUsers.Add(userEx);
                    break;
                }
            }
            SelectUser = userEx;
        }