// POS Page public static void GetItemAll(CsItemlist itable) { // string kQuery = string.Format(@"SELECT itemID AS NO,itemCategory AS CATEGORY,itemName AS NAME, //itemPPrice AS PurchasePrice,itemRPrice AS RetailPrice, //itemQty AS Quantity,itemImage AS URL from tblItem order by itemID;"); string kQuery = string.Format(@"SELECT itemID AS NO,itemCategory AS CATEGORY,itemName AS NAME, PurchasePrice='$'+CONVERT(VARCHAR,itemPPrice),RetailPrice='$'+CONVERT(VARCHAR,itemRPrice), itemQty AS Quantity,itemImage AS URL from tblItem ORDER BY itemRegisterDate DESC;"); cmdString = new SqlCommand(kQuery, cntString); try { cntString.Open(); SqlDataAdapter da = new SqlDataAdapter(cmdString); DataSet ds = new DataSet(); da.Fill(ds); itable.itemList = ds.Tables[0]; } finally { cntString.Close(); } }
public void ItemListView() { CsItemlist itemlist = new CsItemlist(itemTable); try { ConnectionClass.GetItemList(itemlist); itemListBoard.DataSource = itemlist.itemList; itemListBoard.DataBind(); } catch { testlabel.Text = "Error Occured, Please try reloading page. Sorry for inconvenience"; } finally { } }
void ItemViewByCat(string catName) { PagedDataSource pgd = new PagedDataSource(); if (catName == "All") { try { CsItemlist pos = new CsItemlist(itemTable); ConnectionClass.GetItemAll(pos); pgd.DataSource = pos.itemList.DefaultView; } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('Sorry, Error Occured during the process, Please select again, ');</script>"); } } else { try { //PagedDataSource pgd = new PagedDataSource(); CsFilteredItemList flist = new CsFilteredItemList(catName, knote, itemTable); ConnectionClass.GetItemByCat(flist); pgd.DataSource = flist.fiTable.DefaultView; } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('error');</script>"); } //finally } pgd.CurrentPageIndex = CurrentPageIndex; pgd.AllowPaging = true; pgd.PageSize = 8; itemLists.DataSource = pgd; itemLists.DataBind(); BtnPrevious.Enabled = !(pgd.IsLastPage); BtnNext.Enabled = !(pgd.IsFirstPage); }
//020 item page public static void GetItemList(CsItemlist itemtable) { string kQuery = string.Format(@"SELECT itemID AS NO,itemCategory AS CATEGORY,itemName AS NAME, PurchasePrice='$'+CONVERT(VARCHAR,itemPPrice),RetailPrice='$'+CONVERT(VARCHAR,itemRPrice), itemQty AS Quantity, convert(varchar, itemRegisterDate,106) AS 'REGISTER DATE' from tblItem order by itemRegisterDate DESC;"); cmdString = new SqlCommand(kQuery, cntString); try { cntString.Open(); SqlDataAdapter da = new SqlDataAdapter(cmdString); DataSet ds = new DataSet(); da.Fill(ds); itemtable.itemList = ds.Tables[0]; } finally { cntString.Close(); } }