示例#1
0
        private void CreateUser()
        {
            var formUser = new FormUser(_rewardsBL.GetList());

            if (formUser.ShowDialog(this) == DialogResult.OK)
            {
                _usersBL.Add(new User(_DefaultValueId,
                                      formUser.FirstName,
                                      formUser.LastName,
                                      formUser.DateBirthday,
                                      formUser.Rewards));
            }
        }
示例#2
0
        private void EditUser()
        {
            if (dgvUsers.SelectedCells.Count > 0)
            {
                User user = (User)dgvUsers.SelectedCells[0].OwningRow.DataBoundItem;

                var formUser = new FormUser(user, _rewardsBL.GetList());

                if (formUser.ShowDialog(this) == DialogResult.OK)
                {
                    user.FirstName    = formUser.FirstName;
                    user.LastName     = formUser.LastName;
                    user.DateBirthday = formUser.DateBirthday;
                    user.Rewards      = formUser.Rewards;

                    _usersBL.Update(user);
                }
            }
        }