Beispiel #1
0
        public ProductType GetProductType(int id)
        {
            ProductType productType = null;

            try
            {
                Database  dataBase = DatabaseFactory.CreateDatabase();
                DbCommand command  = dataBase.GetStoredProcCommand(storedProcedureName);
                dataBase.AddInParameter(command, "@pOperation", DbType.Int32, 3);
                dataBase.AddInParameter(command, "@pId", DbType.Int32, id);
                DataSet dsAllProductTypes = dataBase.ExecuteDataSet(command);
                if (dsAllProductTypes != null && dsAllProductTypes.Tables.Count > 0)
                {
                    productType = DAOUtilities
                                  .FillEntities <ProductType>(dsAllProductTypes.Tables[0])
                                  .FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                //Crear Excepcion
            }

            return(productType);
        }
Beispiel #2
0
        public Color GetColor(int id)
        {
            Color color = null;

            try
            {
                Database  dataBase = DatabaseFactory.CreateDatabase();
                DbCommand command  = dataBase.GetStoredProcCommand(storedProcedureName);
                dataBase.AddInParameter(command, "@pOperation", DbType.Int32, 3);
                dataBase.AddInParameter(command, "@pId", DbType.Int32, id);
                DataSet dsColor = dataBase.ExecuteDataSet(command);
                if (dsColor != null && dsColor.Tables.Count > 0)
                {
                    color = DAOUtilities
                            .FillEntities <Color>(dsColor.Tables[0])
                            .FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                //Crear Excepcion
            }

            return(color);
        }
Beispiel #3
0
        public List <ProductType> GetAllProductTypes()
        {
            List <ProductType> listAllProductTypes = null;

            try
            {
                Database  dataBase = DatabaseFactory.CreateDatabase();
                DbCommand command  = dataBase.GetStoredProcCommand(storedProcedureName);
                dataBase.AddInParameter(command, "@pOperation", DbType.Int32, 2);
                DataSet dsAllProductTypes = dataBase.ExecuteDataSet(command);
                if (dsAllProductTypes != null && dsAllProductTypes.Tables.Count > 0)
                {
                    listAllProductTypes = DAOUtilities.FillEntities <ProductType>(dsAllProductTypes.Tables[0]);
                }
            }
            catch (Exception ex)
            {
                //Crear Excepcion
            }
            return(listAllProductTypes);
        }
        public Category GetCategory(int id)
        {
            Category category = null;

            try
            {
                Database  database = DatabaseFactory.CreateDatabase();
                DbCommand command  = database.GetStoredProcCommand(storedProcedureName);
                database.AddInParameter(command, "@pOperation", DbType.Int32, 3);
                database.AddInParameter(command, "@pId", DbType.Int32, id);
                DataSet dsAllCategories = database.ExecuteDataSet(command);
                if (dsAllCategories != null && dsAllCategories.Tables.Count > 0)
                {
                    category = DAOUtilities.FillEntities <Category>(dsAllCategories.Tables[0])
                               .FirstOrDefault();
                }
            }
            catch (Exception exc)
            {
                //Crear Exception
            }
            return(category);
        }
Beispiel #5
0
        public Brand GetBrand(int id)
        {
            Brand brand = null;

            try
            {
                Database  database = DatabaseFactory.CreateDatabase();
                DbCommand command  = database.GetStoredProcCommand(storedProcedureName);
                database.AddInParameter(command, "@pOperation", DbType.Int32, 3);
                database.AddInParameter(command, "@pId", DbType.Int32, id);
                DataSet dsAllBrands = database.ExecuteDataSet(command);
                if (dsAllBrands != null && dsAllBrands.Tables.Count > 0)
                {
                    brand = DAOUtilities.FillEntities <Brand>(dsAllBrands.Tables[0])
                            .FirstOrDefault();
                }
            }
            catch (Exception)
            {
                //Crear Exception
            }
            return(brand);
        }
        public StockSize GetStockSize(int id)
        {
            StockSize stockSize = null;

            try
            {
                Database  database = DatabaseFactory.CreateDatabase();
                DbCommand command  = database.GetStoredProcCommand(storedProcedureName);
                database.AddInParameter(command, "@pOperation", DbType.Int32, 3);
                database.AddInParameter(command, "@pId", DbType.Int32, id);
                DataSet dsStockSize = database.ExecuteDataSet(command);
                if (dsStockSize != null && dsStockSize.Tables.Count > 0)
                {
                    stockSize = DAOUtilities.FillEntities <StockSize>(dsStockSize.Tables[0])
                                .FirstOrDefault();
                }
            }
            catch (Exception)
            {
                //Crear Exception
            }
            return(stockSize);
        }