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 { } }
public static void SearchInvoiceByNum(CsSearchInvoice list) { string iQuery = string.Format(@" SELECT O.ORDERNO AS ORDERNO, O.ORDERCUSTOMERNO AS CUSTOMERNO, CONVERT(VARCHAR(11),CONVERT(DATE,O.ORDERDATE)) AS ORDERDATE, (C.FNAME + ' ' + C.LNAME) AS NAME, SUM(OI.ORDERITEMQTY) AS QTY, FORMAT(SUM(OI.ORDERITEMUPRICE * OI.ORDERITEMQTY),'C','EN-US') AS NET, FORMAT(SUM(OI.ORDERITEMUPRICE * OI.ORDERITEMQTY + OI.ORDERITEMTAX),'C','EN-US') AS GROSS FROM TBLORDER O JOIN TBLORDERITEM OI ON O.ORDERNO = OI.ORDERID JOIN TBLCUSTOMER C ON O.ORDERCUSTOMERNO = C.CUSTOMERID WHERE O.ORDERNO=('{0}') GROUP BY O.ORDERNO,O.ORDERCUSTOMERNO,(C.FNAME + ' ' + C.LNAME),O.ORDERDATE;", list.Keyword2); cmdString = new SqlCommand(iQuery, cntString); try { cntString.Open(); SqlDataAdapter da = new SqlDataAdapter(cmdString); DataSet ds = new DataSet(); da.Fill(ds); list.Invoicelist = ds.Tables[0]; } catch { } finally { cntString.Close(); } }