示例#1
0
        public void Initialize(UserSession session, AppInfo appSettings)
        {
            _session     = session;
            _appSettings = appSettings;

            this.treeAccounts.Nodes.Clear();
            AccountManager am       = new AccountManager(this._appSettings.ActiveDbConnectionKey, _session.AuthToken);
            User           u        = JsonConvert.DeserializeObject <User>(_session.UserData);
            List <Account> accounts = am.GetUsersAccounts(u.UUID);

            LoadTreeViewDelegate delLoadTree = new LoadTreeViewDelegate(this.LoadTreeView);

            delLoadTree(accounts);
            treeAccounts.SelectedNode = this.treeAccounts.Nodes[0];
            _currentNode           = treeAccounts.SelectedNode;
            _currentNode.BackColor = Color.LightSteelBlue;

            _nodeControl = new ctlNode(_appSettings.ActiveDbConnectionKey, _session.AuthToken);

            pnlNodeView.Controls.Add(_nodeControl);
            _nodeControl.Show(accounts[0]);

            _userControl = new ctlUser(_appSettings.ActiveDbConnectionKey, _session.AuthToken);
            tabMembers.Controls.Add(_userControl);

            //todo add controls for location, inventory, products
            _locationControl = new ctlLocation(_appSettings.ActiveDbConnectionKey, _session.AuthToken);
            tabLocations.Controls.Add(_locationControl);

            ShowDetail();
        }
        private void btnPesquisar_Click(object sender, EventArgs e)
        {
            mdlUser _user = new mdlUser();

            if (cbFiltro.Text == "Nome")
            {
                _user.Nome = txtFiltro.Text;
            }
            else if (cbFiltro.Text == "RG")
            {
                _user.RG = txtFiltro.Text;
            }
            else if (cbFiltro.Text == "CPF")
            {
                _user.CPF = txtFiltro.Text;
            }

            /*_user.CPF = txtFiltro.Text;
             * _user.Nome = txtFiltro.Text;
             * _user.RG = txtFiltro.Text;*/

            ctlUser _ctlUser = new ctlUser();

            dgUser.DataSource = _ctlUser.PesquisarUsuario(_user);
        }