Пример #1
0
 protected void btn_Posljednje_Click(object sender, EventArgs e)
 {
     using (TriglavBL temp = new TriglavBL())
     {
         lbl_NaslovStranice.Text = "Najnoviji članci";
         dl_Clanci.DataSource    = temp.getClanciByDate().Take(5);
         dl_Clanci.DataBind();
         btn_Posljednje.BackColor  = Color.White;
         btn_Istaknuti.BackColor   = Color.LightGray;
         btn_Hot.BackColor         = Color.LightGray;
         btn_OveSedmice.BackColor  = Color.LightGray;
         btn_OvogMjeseca.BackColor = Color.LightGray;
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (TriglavBL temp = new TriglavBL())
            {
                temp.AgentCalculationRatings();

                Directory lc = Data.Lucene.Indexing.GetDirectoryClanci();  // ovo brisati samo indeksiranje proba
                Directory lp = Data.Lucene.Indexing.GetDirectoryPitanja(); // ovo brisati samo indeksiranje proba

                txt_TrenutnoUredjujemo.Text = "Trenutno uređujemo " + temp.getCountAllPosts(1) + " članaka!";

                if (Request.QueryString["Pretraga"] != null)
                {
                    //Pretraga Wiki preporuke term & call function
                    string term = Request.QueryString["Pretraga"];
                    string func = "searchWithClick('" + term + "');";
                    ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                    dl_Clanci.DataSource = Data.Lucene.Pretraga.searchClanci(Request.QueryString["Pretraga"]);
                    dl_Clanci.DataBind();
                    dl_Pitanja.DataSource = Data.Lucene.Pretraga.searchPitanja(Request.QueryString["Pretraga"]);
                    dl_Pitanja.DataBind();

                    lbl_TrazenaRijec.Text          = "Tražili ste pojam: " + Request.QueryString["Pretraga"];
                    lbl_BrojRezlutataPretrage.Text = "Za vas smo pronašli " + dl_Clanci.Items.Count + " rezultata ";
                    btn_Posljednje.BackColor       = Color.LightGray;
                    btn_Istaknuti.BackColor        = Color.LightGray;
                    btn_Hot.BackColor         = Color.LightGray;
                    btn_OveSedmice.BackColor  = Color.LightGray;
                    btn_OvogMjeseca.BackColor = Color.LightGray;
                }
                else if (Request.QueryString["TagID"] != null)
                {
                    //Tag Wiki preporuke term & call function
                    string term = temp.getTagByID(Convert.ToInt32(Request.QueryString["TagID"])).Naziv;
                    string func = "searchWithClick('" + term + "');";
                    ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                    dl_Clanci.DataSource = Data.Lucene.Pretraga.getClanciByTag(Convert.ToInt32(Request.QueryString["TagID"]));
                    dl_Clanci.DataBind();
                    dl_Pitanja.DataSource = Data.Lucene.Pretraga.getPitanjaByTag(Convert.ToInt32(Request.QueryString["TagID"]));
                    dl_Pitanja.DataBind();
                    lbl_TrazenaRijec.Text          = "Tražili ste poveznicu: " + temp.getTagByID(Convert.ToInt32(Request.QueryString["TagID"])).Naziv;
                    lbl_BrojRezlutataPretrage.Text = "Za vas smo pronašli " + dl_Clanci.Items.Count + " rezultata";
                    lbl_NaslovStranice.Text        = "";
                }
                else if (Request.QueryString["PodKategorijaID"] != null)
                {
                    //Pretraga Wiki preporuke term & call function
                    string term = temp.getPodKategorijaByID(Convert.ToInt32(Request.QueryString["PodKategorijaID"])).Naslov;
                    string func = "searchWithClick('" + term + "');";
                    ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                    dl_Clanci.DataSource = temp.GetClanciByPodKategorija(Convert.ToInt32(Request.QueryString["PodKategorijaID"]));
                    dl_Clanci.DataBind();
                    dl_Pitanja.DataSource = temp.GetPitanjaByPodKategorija(Convert.ToInt32(Request.QueryString["PodKategorijaID"]));
                    dl_Pitanja.DataBind();
                    lbl_TrazenaRijec.Text          = "Tražili ste članke sa podkategorijom: " + temp.getPodKategorijaByID(Convert.ToInt32(Request.QueryString["PodKategorijaID"])).Naslov;
                    lbl_BrojRezlutataPretrage.Text = "Za vas smo pronašli " + dl_Clanci.Items.Count + " rezultata";
                    lbl_NaslovStranice.Text        = "";
                    btn_Posljednje.BackColor       = Color.LightGray;
                    btn_Istaknuti.BackColor        = Color.LightGray;
                    btn_Hot.BackColor         = Color.LightGray;
                    btn_OveSedmice.BackColor  = Color.LightGray;
                    btn_OvogMjeseca.BackColor = Color.LightGray;
                }
                else if (Request.QueryString["KategorijaID"] != null)
                {
                    //Pretraga Wiki preporuke term & call function
                    string term = temp.getPodKategorijaByID(Convert.ToInt32(Request.QueryString["KategorijaID"])).Naslov;
                    string func = "searchWithClick('" + term + "');";
                    ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                    dl_Clanci.DataSource = temp.GetClanciByKategorija(Convert.ToInt32(Request.QueryString["KategorijaID"]));
                    dl_Clanci.DataBind();
                    dl_Pitanja.DataSource = temp.GetPitanjaByKategorija(Convert.ToInt32(Request.QueryString["KategorijaID"]));
                    dl_Pitanja.DataBind();
                    lbl_TrazenaRijec.Text          = "Tražili ste članke sa kategorijom: " + temp.getKategorijaByID(Convert.ToInt32(Request.QueryString["KategorijaID"])).Naslov;
                    lbl_BrojRezlutataPretrage.Text = "Za vas smo pronašli " + dl_Clanci.Items.Count + " rezultata";
                    lbl_NaslovStranice.Text        = "";
                    btn_Posljednje.BackColor       = Color.LightGray;
                    btn_Istaknuti.BackColor        = Color.LightGray;
                    btn_Hot.BackColor         = Color.LightGray;
                    btn_OveSedmice.BackColor  = Color.LightGray;
                    btn_OvogMjeseca.BackColor = Color.LightGray;
                }
                else if (Request.QueryString["KorisnikID"] != null)
                {
                    clanciKorisnikaLista = temp.getClanciByVlasnikID(Convert.ToInt32(Request.QueryString["KorisnikID"]));

                    dl_Clanci.DataSource = clanciKorisnikaLista.Take(6);
                    dl_Clanci.DataBind();

                    pitanjaKorisnikaLista = temp.getPitanjaByVlasnikID(Convert.ToInt32(Request.QueryString["KorisnikID"]));
                    pitanjaKorisnikaLista.AddRange(temp.getOdgovoriByVlasnikID(Convert.ToInt32(Request.QueryString["KorisnikID"])));

                    dl_Pitanja.DataSource = pitanjaKorisnikaLista.Take(6);
                    dl_Pitanja.DataBind();
                }
                else
                {
                    korisnik = (Data.EntityFramework.DAL.Korisnik)Session["LogiraniKorisnik"];
                    if (korisnik != null)
                    {
                        //Sistem preporuke
                        listaMojihClanaka = temp.GetPreporukaClanaka(korisnik.id);
                        listaMojihPitanja = temp.GetPreporukaPitanja(korisnik.id);

                        if (listaMojihClanaka != null || listaMojihPitanja != null)
                        {
                            //Pretraga Wiki preporuke term & call function
                            string term = "Knowledge management";
                            string func = "searchWithClick('" + term + "');";
                            ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                            dl_Clanci.DataSource = listaMojihClanaka.Take(5);
                            dl_Clanci.DataBind();
                            dl_Pitanja.DataSource = listaMojihPitanja.Take(5);
                            dl_Pitanja.DataBind();
                        }
                        else
                        {
                            //Pretraga Wiki preporuke term & call function
                            string term = "Knowledge management";
                            string func = "searchWithClick('" + term + "');";
                            ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                            listaMojihClanaka = temp.getClanciByDate();
                            listaMojihPitanja = temp.getPitanjaByDate();

                            dl_Clanci.DataSource = listaMojihClanaka.Take(5);
                            dl_Clanci.DataBind();
                            dl_Pitanja.DataSource = listaMojihPitanja.Take(5);
                            dl_Pitanja.DataBind();
                        }
                    }
                    else
                    {
                        //Pretraga Wiki preporuke term & call function
                        string term = "Knowledge management";
                        string func = "searchWithClick('" + term + "');";
                        ClientScript.RegisterStartupScript(this.GetType(), term, func, true);

                        listaMojihClanaka = temp.getClanciByDate();
                        listaMojihPitanja = temp.getPitanjaByDate();

                        dl_Clanci.DataSource = listaMojihClanaka.Take(5);
                        dl_Clanci.DataBind();
                        dl_Pitanja.DataSource = listaMojihPitanja.Take(5);
                        dl_Pitanja.DataBind();
                    }

                    lbl_NaslovStranice.Text   = "Za vas smo izabrali ";
                    btn_Posljednje.BackColor  = Color.LightGray;
                    btn_Istaknuti.BackColor   = Color.LightGray;
                    btn_Hot.BackColor         = Color.LightGray;
                    btn_OveSedmice.BackColor  = Color.LightGray;
                    btn_OvogMjeseca.BackColor = Color.LightGray;
                }

                //DATA LISTE
                rpt_Tagovi.DataSource = temp.getTagoviClanciPopularni().Take(30);
                rpt_Tagovi.DataBind();

                rpt_TagoviQA.DataSource = temp.getTagoviPitanjaPopularni().Take(30);
                rpt_TagoviQA.DataBind();

                dl_Kategorije.DataSource = temp.getKategorijeAllPopular().Take(10);
                dl_Kategorije.DataBind();

                dl_Podkategorije.DataSource = temp.getPodKategorijaAllPopular().Take(10);
                dl_Podkategorije.DataBind();
            }
        }