<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import model.Bill;
import model.GroupMember;

/**
 *
 * @author c0687174
 */
@Named
@ApplicationScoped
public class BillController implements Serializable {

    private List<Bill> billList;
    private Bill currentBill;

    public BillController() {
        currentBill = new Bill();
        refreshFromDB();
    }

    public List<Bill> getBillList() {
        return billList;
    }

    public void setBillList(List<Bill> billList) {
        this.billList = billList;
    }

    public Bill getCurrentBill() {
        return currentBill;
    }

    public void setCurrentBill(Bill currentBill) {
        this.currentBill = currentBill;
    }

    public void addBill() {
        billList.add(currentBill);
        currentBill = new Bill();
    }

    public boolean deleteBillWithBillId(int billid) {
        boolean deleted = false;
        for (Bill b : billList) {<commit_msg>Added new function for handing redirection after Add Bill<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import model.Bill;

/**
 *
 * @author c0687174
 */
@Named
@ApplicationScoped
public class BillController implements Serializable {

    private List<Bill> billList;
    private Bill currentBill;

    public BillController() {
        currentBill = new Bill();
        refreshFromDB();
    }

    public List<Bill> getBillList() {
        return billList;
    }

    public void setBillList(List<Bill> billList) {
        this.billList = billList;
    }

    public Bill getCurrentBill() {
        return currentBill;
    }

    public void setCurrentBill(Bill currentBill) {
        this.currentBill = currentBill;
    }

    public void addBill() {
        billList.add(currentBill);
        currentBill = new Bill();
    }
    
    public String submitNewBill(){
        addBill();
        return "groupHome?faces-redirect=true";
    }

    public boolean deleteBillWithBillId(int billid) {
        boolean deleted = false;
        for (Bill b : billList) {
{'fraction_non_alphanumeric': 0.09008718114304165, 'fraction_numerical': 0.004520503713270907, 'mean_word_length': 3.261348005502063, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3860801', 'n_tokens_mistral': 879, 'n_tokens_neox': 851, 'n_words': 248}