private void updateAuxiliar()
        {
            if (HttpContext.Current.Session["UserId"] != null)
            {
                if (UserGroupText.SelectedItem != null)
                {
                    if (FirstNameText.Text != "" & LastNameText.Text != "" & UserGroupText.SelectedItem.Value != "")
                    {
                        AccountService accountService = new AccountService();
                        AccoutUpdateView updateAccount = new AccoutUpdateView();

                        updateAccount.Active = true;//ok
                        updateAccount.Block = BlockedText.Items[0].Selected;//ok
                        updateAccount.LastName = LastNameText.Text;//ok
                        updateAccount.Name = FirstNameText.Text;//ok
                        updateAccount.Login = UserNameText.Text;//key
                        updateAccount.UserGroupId = Int32.Parse(UserGroupText.SelectedItem.Value);

                        CUDView crud = accountService.updateAccount(updateAccount);

                        if (crud.update == false)
                        {
                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Account')", true);
                        }
                        else
                        {
                            clearFields();
                            fillAccountTable();
                        }

                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                    }
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }
            }
        }
        private void saveAuxiliar()
        {
            if (UserGroupText.SelectedItem != null)
            {
                if (FirstNameText.Text != "" & LastNameText.Text != "" & UserGroupText.SelectedItem.Value != "" & UserIdText.Text != "" & UserNameText.Text != "")
                {
                    AccountService accountService = new AccountService();
                    AccountInsertView insertAccount = new AccountInsertView();

                    insertAccount.Block = BlockedText.Items[0].Selected;//ok
                    insertAccount.FirstName = FirstNameText.Text;
                    insertAccount.Id = UserIdText.Text;
                    insertAccount.LastName = LastNameText.Text;
                    insertAccount.Login = UserNameText.Text;
                    insertAccount.UserGroupId = Int32.Parse(UserGroupText.SelectedItem.Value);

                    CUDView crud = accountService.insertAccount(insertAccount);

                    if (crud.insert == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Account')", true);
                    }
                    else
                    {
                        clearFields();
                        fillAccountTable();
                    }

                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
            }
        }
        private void fillUserGroupText()
        {
            AccountService accountService = new AccountService();
            List<UserGroupView> groupData = accountService.getUserGroup();

            UserGroupText.DataSource = groupData;
            UserGroupText.DataBind();

            ListItem l = new ListItem("", "", true);
            l.Selected = true;
            UserGroupText.Items.Insert(0, l);
        }
 private void fillAccountTable()
 {
     AccountService accountService = new AccountService();
     List<AccountView> accountData = accountService.getAccounts();
     GridView3.DataSource = accountData;
     GridView3.PageIndex = 0;
     GridView3.DataBind();
 }
        protected void userDelete_Click(object sender, ImageClickEventArgs e)
        {
            string confirmValue = Request.Form["confirm_value"];
            if (confirmValue == "Yes")
            {
                if (HttpContext.Current.Session["UserId"] != null)
                {

                    AccountService accountService = new AccountService();
                    AccountView delete = new AccountView();
                    delete.Login = UserNameText.Text;//key

                    CUDView crud = accountService.deleteAccount(delete);

                    if (crud.delete == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not delete the Account')", true);
                    }
                    else
                    {
                        clearFields();
                        fillAccountTable();
                    }

                }
            }
        }
 protected void searchButton_Click(object sender, ImageClickEventArgs e)
 {
     AccountService accountService = new AccountService();
     List<AccountView> accountData = accountService.searchAccount(searchText.Text);
     GridView3.DataSource = accountData;
     GridView3.DataBind();
 }