Ejemplo n.º 1
0
        public ProdCatagorys GetsByString(string sString)
        {
            ProdCatagorys oProdCatagorys = new ProdCatagorys();

            try
            {
                SqlCommand cmd = new SqlCommand("SP_ProdCatagory_GetsByString", _conn);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@catId", SqlDbType.VarChar)).Value = sString;
                if (_conn.State == ConnectionState.Open)
                {
                }
                else
                {
                    cmd.Connection.Open();
                }
                IDataReader reader = cmd.ExecuteReader();

                oProdCatagorys = CreateObjects(reader);
                reader.Close();
                cmd.Dispose();
                cmd.Connection.Close();
            }
            catch (Exception e)
            {
                throw new ServiceException(e.Message, e);
            }
            return(oProdCatagorys);
        }
Ejemplo n.º 2
0
        public ProdCatagorys Gets()
        {
            ProdCatagorys oProdCatagorys = new ProdCatagorys();

            try
            {
                SqlCommand cmd = new SqlCommand("SP_ProdCatagory_Gets", _conn);

                cmd.CommandType = CommandType.StoredProcedure;
                if (_conn.State == ConnectionState.Open)
                {
                }
                else
                {
                    cmd.Connection.Open();
                }
                IDataReader reader = cmd.ExecuteReader();

                oProdCatagorys = CreateObjects(reader);
                reader.Close();
                cmd.Dispose();
                cmd.Connection.Close();
            }
            catch (Exception e)
            {
                throw new ServiceException(e.Message, e);
            }
            return(oProdCatagorys);
        }
Ejemplo n.º 3
0
        private ProdCatagorys CreateObjects(IDataReader oReader)
        {
            ProdCatagorys oProdCatagorys = new ProdCatagorys();
            NullHandler   oHandler       = new NullHandler(oReader);

            while (oReader.Read())
            {
                ProdCatagory oItem = CreateObject(oHandler);
                oProdCatagorys.Add(oItem);
            }
            return(oProdCatagorys);
        }