Exemplo n.º 1
0
        private void Anadir_Click()
        {
            try
            {
                _Operation = 1;

                Password_IsEnabled      = true;
                CbUser_IsEditable       = true;
                AreasdeAcceso_IsEnabled = true;
                CbUser.Clear();
                CbUser = null;
                CbUser = new ObservableCollection <string>();

                cmdCancel_IsEnabled = true;
                cmdSave_IsEnabled   = true;
                cmdAdd_IsEnabled    = false;
            }
            catch (Exception ex)
            {
                CbUser_IsEditable       = false;
                Password_IsEnabled      = false;
                AreasdeAcceso_IsEnabled = false;
                MethodBase site = ex.TargetSite;
                MessageBox.Show(ex.Message, site.Name, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
        private void MyRefresh()
        {
            CbUser.Clear();
            _db.Clear();
            try
            {
                using (SqlExcuteCommand get = new SqlExcuteCommand()
                {
                    DBCnnStr = DBEndososCnnStr
                })
                {
                    _MyUsersTable = get.MyGetUsers();

                    foreach (DataRow r in _MyUsersTable.Rows)
                    {
                        Users mUsers = new Users();
                        mUsers.UserId        = (Guid)r["UserId"];
                        mUsers.UserName      = r["UserName"].ToString();
                        mUsers.PasswordHash  = r["PasswordHash"].ToString();
                        mUsers.SecurityStamp = r["SecurityStamp"].ToString();
                        mUsers.AreasDeAcceso = r["AreasDeAcceso"].ToString();
                        _db.Add(mUsers);
                    }
                }

                var usernames = from u in _db
                                orderby u.UserName
                                select u;


                foreach (var s in usernames)
                {
                    CbUser.Add(s.UserName);
                }

                if (CbUser.Count > 0)
                {
                    CbUser_SelectedIndex = -1;
                }
                //GetUsers(_sqlServer,_database, _userName, PasswordHash.Decrypt(_userPassword),this.CbUser);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error-MyRefresh", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }