コード例 #1
0
        public List <ProductMaster> GetProductList()
        {
            List <ProductMaster> objProductList = new List <ProductMaster>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }

                DataSet dsProduct = null;
                dsProduct = GetDataSet("ERP_Get_ProductList", parameters);

                var ProductCollection = from ProductMaster in dsProduct.Tables[0].AsEnumerable()
                                        select new ProductMaster
                {
                    ProductId         = ProductMaster.Field <int>("ProductId"),
                    ProductCode       = ProductMaster.Field <String>("ProductCode"),
                    ProductName       = ProductMaster.Field <String>("ProductName"),
                    BarCode           = ProductMaster.Field <String>("BarCode"),
                    SupplierName      = ProductMaster.Field <String>("SupplierName"),
                    CategoryName      = ProductMaster.Field <String>("CategoryName"),
                    CompanyPrice      = ProductMaster.Field <decimal>("CompanyPrice"),
                    RePOorderLevel    = ProductMaster.Field <int>("RePOorderLevel"),
                    RePOorderQuantity = ProductMaster.Field <int>("RePOorderQuantity"),
                    UOM               = ProductMaster.Field <String>("UOM"),
                    ReSOorderLevel    = ProductMaster.Field <int>("ReSOorderLevel"),
                    ReSOorderQuantity = ProductMaster.Field <int>("ReSOorderQuantity")
                };
                objProductList = ProductCollection.ToList <ProductMaster>();
            }

            catch (Exception ex)
            {
                Logger.Error("ProductDAL.GetProductList(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objProductList);
        }