コード例 #1
0
        private List <DCRProductDetailsModel> GetUserProducts(string searchWord, string prodBringType)
        {
            // Execute the Query and returns the DataSet.
            string  companyCode = _objcurrentInfo.GetCompanyCode();
            string  userCode    = _objcurrentInfo.GetUserCode();
            DataSet dsProducts  = _objSPData.GetSelectedProducts(companyCode, userCode, prodBringType, searchWord);
            List <DCRProductDetailsModel> lstProducts = new List <DCRProductDetailsModel>();

            if (dsProducts != null && dsProducts.Tables != null && dsProducts.Tables.Count > 0)
            {
                DataTable dtProducts = dsProducts.Tables[0];
                // Convert the DataTable to list.
                lstProducts = (from Products in dtProducts.AsEnumerable()
                               select new DCRProductDetailsModel
                {
                    label = Products["Product_Name"].ToString() + "(" + Products["Stock"].ToString() + ")",
                    value = Products["Product_Code"].ToString(),
                    Product_Code = Products["Product_Code"].ToString().Split('_')[0]
                }).ToList <DCRProductDetailsModel>();
            }

            return(lstProducts);
        }