// to add total to invoice table
        protected void Button3_Click(object sender, EventArgs e)
        {
            using (DatabaseEntities db = new DatabaseEntities())
            {
                var result = from i in db.invoice_line_item
                             group i by new
                {
                    i.inv_hed_id
                } into g

                    select new
                {
                    g.Key.inv_hed_id,
                    totalcost = (double)g.Sum(x => x.ser_cost)
                };

                foreach (var r in result)
                {
                    foreach (var s in db.invoices)
                    {
                        if (r.inv_hed_id == s.inv_hed_id)
                        {
                            s.total_cost = r.totalcost;
                        }
                    }
                }

                db.SaveChanges();
            }

            var invoices = db.invoices.ToList();

            InvoiceList.DataSource = invoices;
            InvoiceList.DataBind();
        }
        // WHOLE LIST
        public void InvoiceListView()
        {
            CsInvoice list = new CsInvoice(InvoiceTable);

            try
            {
                ConnectionClass.DisplayInvoice(list);
                InvoiceList.DataSource = list.InvoiceList;
                InvoiceList.DataBind();
            }
            catch
            {
                TEST.Text = "Error Occured, Please try reloading page. Sorry for inconvenience";
            }

            finally
            {
            }
        }
        public void FilterInvoiceByNumber()
        {
            KeyWordNum = keywordbox.Text;
            CsSearchInvoice filist = new CsSearchInvoice(KeyWordName, KeyWordNum, InvoiceTable);

            try
            {
                ConnectionClass.SearchInvoiceByNum(filist);
                InvoiceList.DataSource = filist.Invoicelist;
                InvoiceList.DataBind();
            }
            catch
            {
                TEST.Text = "Error Occured, Please try reloading page. Sorry for inconvenience";
            }

            finally
            {
            }
        }