Ejemplo n.º 1
0
        public override List <Category> Search(string search)
        {
            SqlProvider provider = new SqlProvider("Pr_CategorySearch", true);

            provider.AddParameter("@CategoryName", search);
            SqlDataReader reader = provider.ExecuteReader();

            List <Category> categoryList = new List <Category>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Category category = new Category()
                    {
                        CategoryID   = Convert.ToInt32(reader["CategoryID"]),
                        CategoryName = reader["CategoryName"].ToString(),
                        Description  = reader["Description"].ToString()
                    };
                    categoryList.Add(category);
                }
            }
            reader.Close();
            return(categoryList);
        }
Ejemplo n.º 2
0
        public override List <Product> Search(string search)
        {
            SqlProvider provider = new SqlProvider("Pr_ProductSearch", true);

            provider.AddParameter("@ProductName", search);
            SqlDataReader reader = provider.ExecuteReader();

            List <Product> productList = new List <Product>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Product product = new Product()
                    {
                        ProductID    = Convert.ToInt32(reader["ProductID"].ToString()),
                        ProductName  = reader["ProductName"].ToString(),
                        CategoryID   = Convert.ToInt32(reader["CategoryID"].ToString()),
                        UnitPrice    = Convert.ToDecimal(reader["UnitPrice"].ToString()),
                        UnitsInStock = Convert.ToInt32(reader["UnitsInStock"].ToString())
                    };
                    productList.Add(product);
                }
            }
            reader.Close();
            return(productList);
        }
Ejemplo n.º 3
0
        public static List <MODEL.AdetSecimleri> Uretim_AdetSecimAlternatifleri(int stokid, string alanadi = "ADET")
        {
            /*_sqlProvider = new SqlProvider(
             * " SELECT ARTETIKETDETAY.*, STOK.BIRIM " +
             * " FROM ARTETIKETDETAY INNER JOIN STOK ON ARTETIKETDETAY.STOKID = STOK.STOKID " +
             * " WHERE ARTETIKETDETAY.STOKID = @STOKID "
             * );
             * _sqlProvider.AddParameter("STOKID", stokid);*/



            var dt = new DataTable();

            dt.Load(_sqlProvider.ExecuteReader());

            List <MODEL.AdetSecimleri> list = new List <MODEL.AdetSecimleri>();

            if (dt.Rows.Count > 0)
            {
                for (int i = 1; i < 10; i++)
                {
                    if (dt.Rows[0][alanadi + i.ToString()].ToString() != "")
                    {
                        if (dt.Rows[0][alanadi + i.ToString()].ToString() != "0")
                        {
                            MODEL.AdetSecimleri a = new MODEL.AdetSecimleri();
                            a.Aciklama = (((dt.Rows[0]["BIRIM"].ToString().ToUpper() == "LT") && (alanadi == "ADET")) ? "Kap" : "Tepsi") + " No " + i.ToString();
                            a.Adet     = Convert.ToInt32(dt.Rows[0][alanadi + i.ToString()].ToString());
                            a.Tur      = ((dt.Rows[0]["BIRIM"].ToString().ToUpper() == "LT") && (alanadi == "ADET")) ? "LT" : alanadi;
                            list.Add(a);
                        }
                    }
                }
            }

            return(list);
        }