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); } } }
/* Funcion: Actualiza Accounts de la base Param: id,login,firstName,lastName,userGroupId,block,Active Return: status */ public String updateAccount(AccoutUpdateView account) { return context.InsertUpdateDeleteMSQL("EXEC updateAccount @UserAccountLogin='******', @UserAccountFirstName='"+account.Name +"', @UserAccountLastName='"+account.LastName+"', @UserGroupId="+account.UserGroupId+", @UserAccountBlock="+ account.Block+", @UserAccountActive="+account.Active+""); }
/*Funcion: actualiza una cuenta Param: accountUpdateView Return: status */ public CUDView updateAccount(AccoutUpdateView account) { AccountDao Dao = new AccountDao(); String state = Dao.updateAccount(account); return CUDVerifyLogic.verifierInsertDeleteUpdate("update", state); }