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);
            }
        }
Example #2
0
 /*
   Funcion: Insertar Accounts nuevos a la base
   Param: id,login,firstName,lastName,userGroupId,block
   Return: status
   */
 public String insertAccount(AccountInsertView account)
 {
     return context.InsertUpdateDeleteMSQL("EXEC insertAccount @UserAccountId='" + account.Id + "', @UserAccountLogin='******', @UserAccountFirstName='" + account.FirstName + "', @UserAccountLastName='" + account.LastName + "', @UserGroupId="+
         account.UserGroupId + ", @UserAccountBlock=" + account.Block + ";");
 }
 /*Funcion: inserta una nueva cuenta
   Param: accountInsertView
   Return: status
   */
 public CUDView insertAccount(AccountInsertView account)
 {
     AccountDao Dao = new AccountDao();
     String state = Dao.insertAccount(account);
     return CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state);
 }