Beispiel #1
0
        public Supplier GetLListByStockID(string connString, int stockID)
        {
            try
            {
                string query = "select Id, Name, Address,Company, Contact from Supplier where Id=(select Sup_id from _Stokc where stock_id=" + stockID + " )";

                SqlConnection conn = DBHelper.GetConnection(connString);

                conn.Open();
                BusinessObjects.Supplier pObj   = new BusinessObjects.Supplier();
                SqlDataReader            reader = DBHelper.ReadData(query, conn);
                while (reader.Read())
                {
                    pObj.Id      = Convert.ToInt32(reader[0].ToString());
                    pObj.Name    = reader[1].ToString();
                    pObj.Address = reader[2].ToString();
                    pObj.Company = reader[3].ToString();
                    pObj.Contact = reader[4].ToString();
                }
                conn.Close();


                return(pObj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public List <BusinessObjects.Supplier> GetLList(string connString)
        {
            try
            {
                List <BusinessObjects.Supplier> ProductList = new List <BusinessObjects.Supplier>();
                string query = "select Id, Name, Address,Company, Contact from Supplier";

                SqlConnection conn = DBHelper.GetConnection(connString);

                conn.Open();

                SqlDataReader reader = DBHelper.ReadData(query, conn);
                while (reader.Read())
                {
                    BusinessObjects.Supplier pObj = new BusinessObjects.Supplier();
                    pObj.Id      = Convert.ToInt32(reader[0].ToString());
                    pObj.Name    = reader[1].ToString();
                    pObj.Address = reader[2].ToString();
                    pObj.Company = reader[3].ToString();
                    pObj.Contact = reader[4].ToString();
                    ProductList.Add(pObj);
                }
                conn.Close();


                return(ProductList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }