Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
     {
         if (Request.QueryString["id"] != null)
         {
             RepeaterPost.DataSource = db.TBPosts.Where(item => item.IDPost == Request.QueryString["id"].ToInt()).Select(item => new
             {
                 Judul = item.Judul,
                 DataSourcePostDetail = item.TBPostDetails.Select(item2 => new
                 {
                     Urutan                    = item2.Urutan,
                     ClassSingleImage          = item2.Jenis == 2 ? "row" : "hidden",
                     ClassTeks                 = item2.Jenis == 1 ? "entry-content" : "hidden",
                     ClassSlider               = item2.Jenis == 3 ? "row" : "hidden",
                     ImgaeSingleDefaultURL     = item2.Jenis == 2 ? item2.TBPostDetailImages.FirstOrDefault().DefaultURL : string.Empty,
                     Konten                    = item2.Jenis == 1 ? item2.Konten : string.Empty,
                     DataSourcePostDetailImage = item2.Jenis == 3 ? item2.TBPostDetailImages.Select(item3 => new { ImgaeSliderDefaultURL = item3.DefaultURL }) : null
                 }).OrderBy(item2 => item2.Urutan)
             });
             RepeaterPost.DataBind();
         }
         else
         {
             Response.Redirect("Default.aspx");
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     using (myWebsiteEntities db = new myWebsiteEntities())
     {
         var model = db.platforms.Find(1);
         lblSitebaslik.Text = model.platformAdi;
         lblslogan.Text     = model.slogan;
         var model1 = db.paylasimlars
                      .Join(db.kullanicilars,
                            p => p.kullaniciID,
                            k => k.id,
                            (p, k) => new
         {
             postID         = p.id,
             paylasimBaslik = p.paylasimBaslik,
             paylasimMetin  = p.paylasimMetin,
             kullaniciAD    = k.kullaniciAD,
             yazanID        = k.id,
             tarih          = p.tarih,
             begeniSayisi   = p.begeniSayisi,
             konuID         = p.konuID
         }
                            ).OrderByDescending(x => x.begeniSayisi).Take(5).ToList();
         RepeaterPost.DataSource = model1;
         RepeaterPost.DataBind();
     }
 }
        private void gönderi()
        {
            var model = db.paylasimlars
                        .Join(db.kullanicilars,
                              p => p.kullaniciID,
                              k => k.id,
                              (p, k) => new
            {
                postID          = p.id,
                paylasimBaslik  = p.paylasimBaslik,
                paylasimMetin   = p.paylasimMetin,
                kullaniciAD     = k.kullaniciAD,
                Eposta          = k.Eposta,
                kayitTarihi     = k.kayitTarihi,
                kullaniciID     = p.kullaniciID,
                tarih           = p.tarih,
                konuID          = p.konuID,
                begeniSayisi    = p.begeniSayisi,
                kullaniciSlogan = k.kullaniciSlogan,
                resimYolu       = k.resimYolu
            }
                              ).Where(x => x.kullaniciID == kid).ToList();

            RepeaterPost.DataSource = model;
            RepeaterPost.DataBind();
        }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
         {
             RepeaterPost.DataSource = db.TBPosts.Where(x => x.IDPage == 2).Select(item => new
             {
                 //ClassPost = item.Urutan == 1 ? "form-group" : "hidden",
                 IDPost               = item.IDPost,
                 Judul                = item.Judul,
                 Deskripsi            = item.Deskripsi,
                 DataSourceDetailPost = item.TBPostDetails.Select(item2 => new {
                     urutan1 = item2.Urutan == 1? item2.Konten : item2.Konten,
                     urutan2 = item2.Urutan == 2 ? item2.Nama : item2.Konten
                 })
                                        //Konten = item.Konten,
                                        //ClassImages = item.Jenis == 2 ? "form-group" : "hidden",
                                        //DataSourceImages = item.TBPostDetailImages.Select(item2 => new
                                        //{
                                        //    DefaultURL = item2.DefaultURL
                                        //})
             });
             RepeaterPost.DataBind();
         }
     }
 }
Пример #5
0
        private void PostBinding()
        {
            string json = _smartHsServiceClient.GetPostCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                json = _smartHsServiceClient.GetPostTitlesByPage(1, 5);
                RepeaterPost.DataSource = from item in json.JObjMessageToken()
                                          select new
                {
                    Title =
                        new string(
                            item["Title"].ValueOrDefault <string>().ToCharArray().Take(24)
                            .ToArray()),
                    Keyword     = item["Keyword"].ValueOrDefault <string>(),
                    Id          = item["Id"].ValueOrDefault <string>(),
                    ReleaseTime = item["ReleaseTime"].ValueOrDefault <string>(),
                    DateSpan    = item["DateSpan"].ValueOrDefault <string>(),
                };
            }
            RepeaterPost.DataBind();
            FoodPriceBinding();
            SchoolBinding();
            KindergartenBinding();
            BankBinding();
            MarketBinding();
            TripInfoBinding();
            FoodInfoBinding();
            FavorableBinding();
            EducationBinding();
            HealthBinding();
        }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                var Produk = db.TBProduks.Select(item => new
                {
                    item.IDProduk,
                    item.Nama,
                    Foto  = "/images/cover/" + item.IDProduk + ".jpg",
                    Harga = item.TBKombinasiProduks.FirstOrDefault().TBStokProduks.FirstOrDefault(item2 => item2.IDTempat == 1).HargaJual
                }).ToArray();

                RepeaterProduk.DataSource = Produk;
                RepeaterProduk.DataBind();

                //BARBAR
                //////var cariPost = db.TBPosts.Where(x => x.IDPage == 1).Select(item => new
                //////{
                //////    id = item.IDPost,
                //////    judul=item.Judul,
                //////    deskripsi=item.Deskripsi,



                //////    //picture=item.TBPostDetails.Where(item.IDPost
                //////}).ToArray();
                //////var cariPostDetail=db.TBPostDetails.Select(items=>new {
                //////    idPost=items.IDPost,
                //////}).Where(y=>y.idPost==cariPost.)
                RepeaterPost.DataSource = db.TBPostDetails.Where(x => x.TBPost.IDPage == 2).Select(item => new
                {
                    Nama             = item.Nama,
                    Konten           = item.Konten,
                    ClassImages      = item.Jenis == (int)EnumJenisPostDetail.ImageSlider ? "form-group" : "hidden",
                    DataSourceImages = item.TBPostDetailImages.Select(item2 => new
                    {
                        DefaultURL = item2.DefaultURL,
                        Judul      = item2.Judul,
                        Deskripsi  = item2.Deskripsi
                    })
                });
                RepeaterPost.DataBind();
            }
        }
    }
Пример #7
0
        private void paylasim()
        {
            var model = db.paylasimlars
                        .Join(db.kullanicilars,
                              p => p.kullaniciID,
                              k => k.id,
                              (p, k) => new
            {
                postID         = p.id,
                paylasimBaslik = p.paylasimBaslik,
                paylasimMetin  = p.paylasimMetin,
                kullaniciAD    = k.kullaniciAD,
                yazanID        = k.id,
                tarih          = p.tarih,
                konuID         = p.konuID
            }
                              ).Where(x => x.konuID == id).OrderByDescending(x => x.postID).ToList();

            RepeaterPost.DataSource = model;
            RepeaterPost.DataBind();
        }