Example #1
0
        public DataTable SearchProductCode(string searchText)
        {
            if (myCategoryID == 11 || myCategoryID == 12)
            {
                TblProduct product = new TblProduct();

                if (searchText.Length > 0)
                {
                    searchText = "%" + searchText + "%";

                    string cmdText = "Select A.*, C.strDescription as BrandDesc, D.strDescription as ColorDesc, " +
                        " E.strDescription as SizeDesc, F.strDescription as StyleDesc,R.nQty from tblProduct A " +
                        " Inner Join tblProductBranch B On A.strProductCode = B.strProductCode " +
                        " left outer join tblBrand C on A.strBrandCode = C.strBrandCode "+
                        " left outer join tblColor D on A.strColorCode = D.strColorCode "+
                        " left outer join tblSize E on A.strSizeCode = E.strSizeCode "+
                        " left outer join tblStyle F on A.strStyleCode = F.strStyleCode "+
                        " left outer join tblSCStockRecon R on (A.strProductCode = R.strProductCode AND B.strBranchCode=R.strBranchCode) " +
                        " where nCategoryID = @nCategoryID AND " +
                        " A.dtValidStart <= @today and A.dtValidEnd >= @today AND " +
                        " B.strBranchCode = @strBranchCode AND A.nStatus = 1 AND " +
                        " (A.strProductCode like @Param or A.strDescription like @Param or " +
                        "  F.strStyleCode like @Param or F.strDescription like @Param) ";

                    DataTable table = product.LoadData(cmdText, new string[] {"@nCategoryID", "@today", "@strBranchCode", "@Param" },
                        new object[] {myCategoryID, DateTime.Today.Date, myStrBranchCode, searchText});
                    return table;
                }
                else
                {
                    string cmdText = "Select A.* from tblProduct A, tblProductBranch B where nCategoryID = @nCategoryID AND " +
                        " A.dtValidStart <= @today and A.dtValidEnd >= @today AND A.strProductCode = B.strProductCode AND " +
                        " B.strBranchCode = @strBranchCode AND A.nStatus = 1";

                    DataTable table = product.LoadData(cmdText, new string[] {"@nCategoryID", "@today", "@strBranchCode"}, new object[] {myCategoryID, DateTime.Today.Date, myStrBranchCode});

                    return table;
                }
            }
            else if (myCategoryID == 38)
            {
                TblProduct product = new TblProduct();
                if (searchText.Length > 0)
                {
                    searchText = "%" + searchText + "%";
                    string cmdText = "Select * from tblCashVoucher where strbranchcode=@strBranchCode and fsell=1 and nstatusid=0 and nTerminalID=@nTerminalID and " +
                    " (strSN like @Param or strDescription like @Param ) ";

                    DataTable table = product.LoadData(cmdText, new string[] { "@strBranchCode", "@Param" }, new object[] { myStrBranchCode, myPOS.NTerminalID, searchText });

                    return table;
                }
                else
                {
                    string cmdText = "Select * from tblCashVoucher where strbranchcode=@strBranchCode and fsell=1 and nstatusid=0 and nTerminalID=@nTerminalID";

                    DataTable table = product.LoadData(cmdText, new string[] { "@strBranchCode" }, new object[] { myStrBranchCode, myPOS.NTerminalID });

                    return table;
                }
            }
            else
            {
                return null;
            }
        }
Example #2
0
        public DataTable SearchOneProductCode(string strProductCode)
        {
            if (myCategoryID == 11 || myCategoryID == 12)
            {
                TblProduct product = new TblProduct();

                string cmdText = "Select A.* from tblProduct A, tblProductBranch B where nCategoryID = @nCategoryID AND " +
                    " A.dtValidStart <= @today and A.dtValidEnd >= @today AND A.strProductCode = B.strProductCode AND " +
                    " B.strBranchCode = @strBranchCode AND A.nStatus = 1 AND A.strProductCode = @strProductCode";

                DataTable table = product.LoadData(cmdText, new string[] {"@nCategoryID", "@today", "@strBranchCode", "@strProductCode"},
                    new object[] {myCategoryID, DateTime.Today.Date, myStrBranchCode, strProductCode});

                return table;
            }
            else return null;
        }