コード例 #1
0
        private void UrunleriGetir()
        {
            var db      = new NorthEntities();
            var urunler = db.Products
                          .OrderBy(p => p.ProductName)
                          .Select(x => new ProductViewModel
            {
                ProductID   = x.ProductID,
                ProductName = x.ProductName,
            }).ToList();

            lstUrunler.DataSource = urunler;
        }
コード例 #2
0
        private void NakliyecileriGetir()
        {
            var db           = new NorthEntities();
            var nakliyeciler = db.Shippers
                               .OrderBy(x => x.CompanyName)
                               .Select(x => new ShipperViewModel()
            {
                ShipperID   = x.ShipperID,
                CompanyName = x.CompanyName,
            }).ToList();

            cbNakliye.DataSource = nakliyeciler;
        }
コード例 #3
0
        private void CalisanlariGetir()
        {
            var db         = new NorthEntities();
            var calisanlar = db.Employees
                             .OrderBy(x => x.FirstName)
                             .Select(x => new EmployeeViewModel()
            {
                EmployeeID = x.EmployeeID,
                FirstName  = x.FirstName,
                LastName   = x.LastName
            }).ToList();

            cbCalisan.DataSource = calisanlar;
        }
コード例 #4
0
        private void MusterileriGetir()
        {
            var db         = new NorthEntities();
            var musteriler = db.Customers
                             .OrderBy(x => x.ContactName)
                             .Select(x => new CustomerViewModel()
            {
                CustomerID  = x.CustomerID,
                CompanyName = x.CompanyName,
                ContactName = x.ContactName
            }).ToList();

            cbMusteri.DataSource = musteriler;
        }
コード例 #5
0
        private void txtArama_KeyUp(object sender, KeyEventArgs e)
        {
            var db  = new NorthEntities();
            var ara = txtArama.Text.ToLower();

            aramalar = new List <ProductViewModel>();

            db.Products.Where(x => x.ProductName.ToLower().Contains(ara)).ToList().ForEach(x =>
                                                                                           aramalar.Add(new ProductViewModel()
            {
                ProductName = x.ProductName,
                ProductID   = x.ProductID
            }));
            lstUrunler.DataSource = aramalar.ToList();
        }