Ejemplo n.º 1
0
 public UserListViewModel()
 {
     this.BtnAddCommand        = new RelayCommand(this.BtnAdd_Click, null);
     this.BtnChangeLockCommand = new RelayCommand(this.BtnChangeLock_Click, null);
     this.BtnEditCommand       = new RelayCommand(this.BtnEdit_Click, null);
     this.BtnFindCommand       = new RelayCommand(this.BtnFind_Click, null);
     this.BtnRefreshCommand    = new RelayCommand(this.BtnRefresh_Click, null);
     this._currentUser         = new AasUserADO();
 }
Ejemplo n.º 2
0
        public void BtnChangeLock_Click(object parameters)
        {
            try
            {
                if (parameters != null && parameters is AasUserADO)
                {
                    WaitingManager.Show();
                    bool        success     = false;
                    CommonParam commonParam = new CommonParam();
                    AasUserADO  data        = parameters as AasUserADO;
                    if (data.IsActive == Constant.IS_TRUE)
                    {
                        User rs = new BackendAdapter(commonParam).Post <User>(AasUser.LOCK, ApiConsumerStore.AasConsumer, commonParam, data, null);
                        if (rs != null)
                        {
                            data.IsActive = rs.IsActive;
                            success       = true;
                        }
                    }
                    else
                    {
                        User rs = new BackendAdapter(commonParam).Post <User>(AasUser.UNLOCK, ApiConsumerStore.AasConsumer, commonParam, data, null);
                        if (rs != null)
                        {
                            data.IsActive = rs.IsActive;
                            success       = true;
                        }
                    }

                    WaitingManager.Close();
                    if (success)
                    {
                        MessageManager.ShowAlert(commonParam, success);
                        CloseWindow = true;
                    }
                    else
                    {
                        MessageManager.Show(commonParam, success);
                    }
                }
            }
            catch (Exception ex)
            {
                WaitingManager.Close();
                LogSystem.Error(ex);
            }
        }