Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void RemoveUser()
        {
            mCurrentSelectedUser.ParentModel = null;

            int id = Users.IndexOf(mCurrentSelectedUser);

            if (!mCurrentSelectedUser.IsNew)
            {
                if (DBDevelopClientApi.DevelopServiceHelper.Helper.RemoveUser(mCurrentSelectedUser.Name))
                {
                    Users.Remove(mCurrentSelectedUser);
                }
            }
            else
            {
                Users.Remove(mCurrentSelectedUser);
            }


            mCurrentSelectedUser = null;

            if (Users.Count > id)
            {
                CurrentSelectedUser = Users[id];
            }

            else
            {
                CurrentSelectedUser = Users[Users.Count - 1];
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public void QueryUsers()
        {
            ObservableCollection <ServerUserItemViewModel> utmp = new ObservableCollection <ServerUserItemViewModel>();
            var users = DBDevelopClientApi.DevelopServiceHelper.Helper.GetUsers();

            if (users != null)
            {
                foreach (var vv in users)
                {
                    var uu = new ServerUserItemViewModel(vv.Key)
                    {
                        ParentModel = this, Database = vv.Value.Item3, IsAdmin = vv.Value.Item1, CanNewDatabase = vv.Value.Item2
                    };
                    utmp.Add(uu);
                }
            }
            Users = utmp;

            if (mPermissionCach == null)
            {
                mPermissionCach = DBDevelopClientApi.DevelopServiceHelper.Helper.GetAllDatabase();
            }

            foreach (var vv in Users)
            {
                vv.IntDatabase(mPermissionCach);
                vv.IsChanged = false;
            }

            if (Users.Count > 0)
            {
                CurrentSelectedUser = Users[0];
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        private void AddUser()
        {
            string newUserName = GetAvailableName("user");
            var    umode       = new ServerUserItemViewModel(newUserName)
            {
                IsNew = true, IsEdit = true, ParentModel = this
            };

            umode.IntDatabase(mPermissionCach);
            Users.Add(umode);
            CurrentSelectedUser = umode;
        }