Beispiel #1
0
        protected void ddlZanr_SelectedIndexChanged(object sender, EventArgs e)
        {
            string vrednost = ddlZanr.SelectedValue;

            OpKnjigaSelect knjsort = new OpKnjigaSelect();

            if (vrednost != "0")
            {
                knjsort.Kriterijum      = new KriterijumKnjiga();
                knjsort.Kriterijum.Zanr = vrednost;
            }



            OperacijaRezultat objsort = OperationManager.Singleton.izvrsiOperaciju(knjsort);

            DbItem[]   itemsort = objsort.DbItems;
            KnjigaDb[] knj      = itemsort.Cast <KnjigaDb>().ToArray();
            if (knj.Count() == 0)
            {
                this.DataPager1.SetPageProperties(0, DataPager1.PageSize, false);

                BookList.DataSource = knj;
                BookList.DataBind();
                noBooks.Visible = true;
            }
            else
            {
                noBooks.Visible = false;
                this.DataPager1.SetPageProperties(0, DataPager1.PageSize, false);

                BookList.DataSource = knj;
                BookList.DataBind();
            }
        }
Beispiel #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string         text   = tbSearch.Text;
            OpKnjigaSelect knjiga = new OpKnjigaSelect();

            knjiga.Kriterijum = new KriterijumKnjiga();
            knjiga.Kriterijum.Knjiga_pretraga = text;
            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(knjiga);


            if ((obj == null) || (!obj.Status))
            {
                return;
            }

            else
            {
                if (obj.DbItems.Count() == 0)
                {
                    noBooks.Visible = true;
                }
                else
                {
                    noBooks.Visible = false;
                }
                this.DataPager1.SetPageProperties(0, DataPager1.PageSize, false);
                BookList.DataSource = obj.DbItems;
                BookList.DataBind();
                ddlZanr.SelectedValue = "0";
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((string)Session["osvezena"] != null)
            {
                jePrazna.Text = (String)Session["osvezena"];
                Session.Remove("osvezena");
            }
            if ((string)Session["uloga"] != "reg")
            {
                Response.Redirect("~/Front/books.aspx");
            }

            KorpaSelect sel = new KorpaSelect();

            sel.Korpa = new DbKorpa();
            sel.Korpa.Id_korisnika = Convert.ToInt32(Session["id_korisnik"]);
            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(sel);

            if (obj.Status)
            {
                if (obj.DbItems.Count() == 0)
                {
                    jePrazna.Text = " je prazna!";
                }
                else
                {
                    korpaGrid.DataSource = obj.DbItems;
                    korpaGrid.DataBind();
                }
            }
        }
Beispiel #4
0
        protected void confirmUpdate_Click(object sender, EventArgs e)
        {
            string username = TextBox1.Text;
            string password = TextBox2.Text;
            int    id       = Int32.Parse(TextBox3.Text);

            OpAdminUpdate op = new OpAdminUpdate();

            op.Admin = new AdminDb {
                ID = id, Username = username, Password = password
            };
            OperacijaRezultat rezultat = OperationManager.Singleton.izvrsiOperaciju(op);

            if ((rezultat == null) || (!rezultat.Status))
            {
                return;
            }
            else
            {
                DbItem[]  items  = rezultat.DbItems;
                AdminDb[] admins = items.Cast <AdminDb>().ToArray();

                GridView1.DataSource = admins;
                GridView1.DataBind();
            }
        }
Beispiel #5
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            string username = tbUsername.Text;

            string password = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text, "MD5");

            string email = tbEmail.Text;

            int uloga = 2;

            KorisnikInsert ins = new KorisnikInsert();

            ins.User          = new UserDb();
            ins.User.Username = username;
            ins.User.Password = password;
            ins.User.Email    = email;
            ins.User.Id_uloga = 2;

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(ins);

            if (obj.Status)
            {
                Session["registered"] = "Uspesno ste se registrovali. Ulogujte se!";
                Response.Redirect("login.aspx");
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["idUser"] == null)
            {
                return;
            }
            else
            {
                string json;
                using (var reader = new StreamReader(Request.InputStream))
                {
                    json = reader.ReadToEnd();
                }
                int imgid = Convert.ToInt32(json.Split('=')[1]);

                OperacijaRezultat res = OperationManager.Singleton.izvrsiOperaciju(new OpImageDeleteOnly()
                {
                    Kriterijum = new KriterijumImage()
                    {
                        IdImage = imgid
                    }
                });
                if (res.Status)
                {
                    Response.Write("Success");
                }
                else
                {
                    Response.Write("Error");
                }
            }
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MeniSelect meni = new MeniSelect();

            meni.Kriterijum = new MeniKriterijum();
            if (Session["uloga"] == null)
            {
                meni.Kriterijum.Uloga = "nereg";
            }
            else
            {
                meni.Kriterijum.Uloga = (string)Session["uloga"];
            }

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(meni);


            if ((obj == null) || (!obj.Status))
            {
                return;
            }
            else
            {
                DbItem[] items = obj.DbItems;
                MeniDb[] menus = items.Cast <MeniDb>().ToArray();


                MenuList.DataSource = menus;
                MenuList.DataBind();
            }
        }
Beispiel #8
0
        protected void deliting_Click(object sender, EventArgs e)
        {
            Button remove    = (Button)sender;
            int    projectId = Convert.ToInt32(remove.CommandArgument);

            OperacijaRezultat res = OperationManager.Singleton.izvrsiOperaciju(new OpProjectDeleteOnly()
            {
                Project = new ProjectDb()
                {
                    IdProject = projectId
                }
            });

            if (res.Status)
            {
                this.LabelDelete.Text      = "Project deleted.";
                this.LabelDelete.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                this.LabelDelete.Text      = "Something went wrong!";
                this.LabelDelete.ForeColor = System.Drawing.Color.Red;
            }
            this.GridView1.DataBind();
        }
Beispiel #9
0
        protected void contactsRespondBtn(object sender, EventArgs e)
        {
            respondPanel.Visible = true;
            Button        taster  = (Button)sender;
            KontaktSelect kontakt = new KontaktSelect();

            kontakt.kontaktkriterjum            = new KontaktKriterijum();
            kontakt.kontaktkriterjum.id_kontakt = Convert.ToInt32(taster.CommandArgument);


            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(kontakt);

            if ((obj == null) || (!obj.Status))
            {
                return;
            }
            else
            {
                DbItem[]    items = obj.DbItems;
                KontaktDb[] niz   = items.Cast <KontaktDb>().ToArray();
                emailPrenos.Text = niz[0].Email;
                imePrenos.Text   = niz[0].Ime;
                tbKome.Text      = emailPrenos.Text;
                tbKome.Enabled   = false;
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null || Session["password"] == null)
            {
                Response.Redirect("~/login.aspx");
            }
            else
            {
                Label1.Text    = "ADMINS";
                Panel1.Visible = false;
                Panel2.Visible = false;

                OpAdminSelect     op       = new OpAdminSelect();
                OperacijaRezultat rezultat = OperationManager.Singleton.izvrsiOperaciju(op);

                if ((rezultat == null) || (!rezultat.Status))
                {
                    return;
                }
                else
                {
                    DbItem[]  items  = rezultat.DbItems;
                    AdminDb[] admins = items.Cast <AdminDb>().ToArray();

                    GridView1.DataSource = admins;
                    GridView1.DataBind();
                }
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((string)Session["uloga"] != "adm")
            {
                Response.Redirect("~/Front/books.aspx");
            }

            ifEmpty.Text         = "Nothing to do here :(";
            ifEmpty.Visible      = false;
            respondPanel.Visible = false;
            KontaktSelect     kontakt = new KontaktSelect();
            OperacijaRezultat obj     = OperationManager.Singleton.izvrsiOperaciju(kontakt);


            if ((obj == null) || (!obj.Status))
            {
                ifEmpty.Visible = true; ifEmpty.Text = obj.Poruka;
            }
            DbItem[]    items    = obj.DbItems;
            KontaktDb[] kontakts = items.Cast <KontaktDb>().ToArray();
            if (kontakts.Count() > 0)
            {
                ifEmpty.Visible = false;
            }

            contactsGrid.DataSource = kontakts;
            contactsGrid.DataBind();
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string json;

            using (var reader = new StreamReader(Request.InputStream))
            {
                json = reader.ReadToEnd();
            }
            string[] items = json.Split('&');
            int      id    = Convert.ToInt32(items[0].Split('=')[1]);
            int      qid   = Convert.ToInt32(items[1].Split('=')[1]);

            OperacijaRezultat res = OperationManager.Singleton.izvrsiOperaciju(new OpPollVoteInsert()
            {
                Vote = new PollVoteDb()
                {
                    IdAnswer = id, IpAddress = Request.UserHostAddress, IdQuestion = qid
                }
            });

            if (res.Status)
            {
                Response.Write("Success");
            }
            else
            {
                Response.Write("Error");
            }
        }
Beispiel #13
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Logovanje log = new Logovanje();

            log.Login          = new LoginOperation();
            log.Login.Username = tbUsername.Text;
            log.Login.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text, "MD5");

            OperacijaRezultat op = OperationManager.Singleton.izvrsiOperaciju(log);

            DbItem[] items = op.DbItems;
            UserDb[] niz   = items.Cast <UserDb>().ToArray();

            if (niz.Length != 0 && niz[0].Id_uloga == 1)
            {
                Session["uloga"]       = "adm";
                Session["username"]    = niz[0].Username;
                Session["id_korisnik"] = niz[0].Id_korisnik;
                Response.Redirect("~/admin.aspx");
            }
            else if (niz.Length != 0 && niz[0].Id_uloga == 2)
            {
                Session["uloga"]       = "reg";
                Session["username"]    = niz[0].Username;
                Session["id_korisnik"] = niz[0].Id_korisnik;
                Response.Redirect("~/Front/books.aspx");
            }
            else
            {
                feedLabel.Text = "Really?";
            }
        }
Beispiel #14
0
        protected void confirmInsert_Click(object sender, EventArgs e)
        {
            string username = TextBox4.Text;
            string password = TextBox5.Text;

            OpAdminInsert op = new OpAdminInsert();

            op.Admin = new AdminDb {
                Username = username, Password = password
            };
            OperacijaRezultat rezultat = OperationManager.Singleton.izvrsiOperaciju(op);

            if ((rezultat == null) || (!rezultat.Status))
            {
                return;
            }
            else
            {
                DbItem[]  items  = rezultat.DbItems;
                AdminDb[] admins = items.Cast <AdminDb>().ToArray();

                GridView1.DataSource = admins;
                GridView1.DataBind();
            }
        }
Beispiel #15
0
        protected override void DoAfterPageLoad()
        {
            OperacijaRezultat res = OperationManager.Singleton.izvrsiOperaciju(new OpFullProject()
            {
                Kriterijum = new KriterijumFullProject()
                {
                    IdProject = ProjectId
                }
            });

            if (res.Status && res.HaveItems)
            {
                bool          candelete = false;
                FullProjectDb full      = res.DbItems.Cast <FullProjectDb>().ToArray()[0];
                this.singleprojectTitle.InnerText = full.Project.Title;
                full.Project.MainImageLink        = ResolveClientUrl(full.Project.MainImageLink);

                if (Session["idUser"] != null)
                {
                    if (full.Project.IdUser == (int)Session["idUser"])
                    {
                        this.PanelAddImage.Visible = true;
                        candelete = true;
                    }
                }

                foreach (ImageDb img in full.Images)
                {
                    img.BigPictureUrl   = ResolveClientUrl(img.BigPictureUrl);//.Substring(1)
                    img.SmallPictureUrl = ResolveClientUrl(img.SmallPictureUrl);
                }
                this.PanelSingleProject.Controls.Add(ProjectsPresentation.MakeSingleProject(full, candelete));
            }
        }
Beispiel #16
0
        protected void btnIzmeni_Click(object sender, EventArgs e)
        {
            Panel2.Visible = true;
            Button         taster = (Button)sender;
            OpKnjigaSelect knj    = new OpKnjigaSelect();

            knj.Kriterijum           = new KriterijumKnjiga();
            knj.Knjiga               = new KnjigaDb {
            };
            knj.Kriterijum.Id_knjiga = Convert.ToInt32(taster.CommandArgument);


            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(knj);

            DbItem[]   items = obj.DbItems;
            KnjigaDb[] niz   = items.Cast <KnjigaDb>().ToArray();


            updNaziv.Text  = niz[0].Naziv;
            updOpis.Text   = niz[0].Opis;
            updCena.Text   = niz[0].Cena.ToString();
            updGodina.Text = niz[0].Godina;

            updAutor.SelectedValue = niz[0].Id_autor.ToString();
            updZanr.SelectedValue  = niz[0].Id_zanr.ToString();
            hiddenUpdate.Text      = niz[0].Id_knjiga.ToString();
        }
Beispiel #17
0
        protected void bookDeleteBtn(object sender, EventArgs e)
        {
            Button taster = (Button)sender;
            int    id     = Convert.ToInt32(taster.CommandArgument);

            OpKnjigaDelete delknjiga = new OpKnjigaDelete();

            delknjiga.Id_knjiga = id;

            OperacijaRezultat delobj = OperationManager.Singleton.izvrsiOperaciju(delknjiga);

            OpKnjigaSelect    knjiga = new OpKnjigaSelect();
            OperacijaRezultat obj    = OperationManager.Singleton.izvrsiOperaciju(knjiga);


            if ((obj == null) || (!obj.Status))
            {
                return;
            }
            else
            {
                DbItem[]   items  = obj.DbItems;
                KnjigaDb[] knjige = items.Cast <KnjigaDb>().ToArray();
                if (knjige.Count() == 0)
                {
                    ifEmpty.Visible = true;
                }


                bookGrid.DataSource = knjige;
                bookGrid.DataBind();
            }
        }
Beispiel #18
0
        protected void dodajUser_Click(object sender, EventArgs e)
        {
            string         username = tbUsername.Text;
            string         password = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text, "MD5");
            string         email    = tbEmail.Text;
            int            id_uloga = Convert.ToInt32(odabirUloge.SelectedItem.Value);
            KorisnikInsert ins      = new KorisnikInsert();

            ins.User          = new UserDb {
            };
            ins.User.Id_uloga = id_uloga;
            ins.User.Username = username;
            ins.User.Password = password;
            ins.User.Email    = email;


            OperacijaRezultat rezultat = OperationManager.Singleton.izvrsiOperaciju(ins);

            if ((rezultat == null) || (!rezultat.Status))
            {
                return;
            }
            else
            {
                DbItem[] items = rezultat.DbItems;
                UserDb[] users = items.Cast <UserDb>().ToArray();
                if (users.Count() > 0)
                {
                    ifEmpty.Visible = false;
                }

                userGrid.DataSource = users;
                userGrid.DataBind();
            }
        }
Beispiel #19
0
        protected void menuDeleteBtn(object sender, EventArgs e)
        {
            Button taster = (Button)sender;
            int    id     = Convert.ToInt32(taster.CommandArgument);

            MeniDelete meni = new MeniDelete();

            meni.Kriterijum = new MeniKriterijum();
            meni.Id_meni    = id;

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(meni);

            MeniSelect mn = new MeniSelect();

            mn.Kriterijum = new MeniKriterijum();
            OperacijaRezultat obj2 = OperationManager.Singleton.izvrsiOperaciju(mn);

            DbItem[] items = obj2.DbItems;
            MeniDb[] menu  = items.Cast <MeniDb>().ToArray();
            if (menu.Count() == 0)
            {
                ifEmpty.Visible = true;
            }
            menuGrid.DataSource = menu;
            menuGrid.DataBind();
        }
Beispiel #20
0
        protected void dodajMeni_Click(object sender, EventArgs e)
        {
            string     naslov = naslovBtn.Text;
            string     url    = urlBtn.Text;
            MeniInsert op     = new MeniInsert();

            op.Meni        = new MeniDb {
            };
            op.Kriterijum  = new MeniKriterijum();
            op.Meni.Naslov = naslov;
            op.Meni.Url    = url;
            OperacijaRezultat rezultat = OperationManager.Singleton.izvrsiOperaciju(op);

            DbItem[] items = rezultat.DbItems;
            MeniDb[] menus = items.Cast <MeniDb>().ToArray();
            if (menus.Count() > 0)
            {
                ifEmpty.Visible = false;
            }

            menuGrid.DataSource = menus;
            menuGrid.DataBind();
            foreach (ListItem item in this.chbList.Items)
            {
                if (item.Selected)
                {
                    MeniUlogaInsert mn = new MeniUlogaInsert();
                    mn.MeniKriterijum       = new MeniKriterijum();
                    mn.MeniKriterijum.Uloga = item.Value;

                    OperacijaRezultat rez = OperationManager.Singleton.izvrsiOperaciju(mn);
                }
            }
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((string)Session["uloga"] != "adm")
            {
                Response.Redirect("~/Front/books.aspx");
            }
            ifEmpty.Text        = "Nothing to do here :(";
            ifEmpty.Visible     = false;
            insertPanel.Visible = false;
            MeniSelect meni = new MeniSelect();

            meni.Kriterijum = new MeniKriterijum();
            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(meni);


            if ((obj == null) || (!obj.Status))
            {
                ifEmpty.Visible = true; ifEmpty.Text = obj.Poruka;
            }
            DbItem[] items = obj.DbItems;
            MeniDb[] menus = items.Cast <MeniDb>().ToArray();
            if (menus.Count() > 0)
            {
                ifEmpty.Visible = false;
            }

            menuGrid.DataSource = menus;
            menuGrid.DataBind();
        }
Beispiel #22
0
        protected void userDeleteBtn(object sender, EventArgs e)
        {
            Button taster = (Button)sender;
            int    id     = Convert.ToInt32(taster.CommandArgument);

            KorisnikDelete delusr = new KorisnikDelete();

            delusr.Id_korisnik = id;

            OperacijaRezultat delobj = OperationManager.Singleton.izvrsiOperaciju(delusr);

            KorisnikSelect    usrsel = new KorisnikSelect();
            OperacijaRezultat obj    = OperationManager.Singleton.izvrsiOperaciju(usrsel);


            if ((obj == null) || (!obj.Status))
            {
                return;
            }
            else
            {
                DbItem[] items = obj.DbItems;
                UserDb[] users = items.Cast <UserDb>().ToArray();
                if (users.Count() == 0)
                {
                    ifEmpty.Visible = true;
                }


                userGrid.DataSource = users;
                userGrid.DataBind();
            }
        }
Beispiel #23
0
        protected void btnDodajAutora_Click(object sender, EventArgs e)
        {
            string ime     = tbDodajIme.Text;
            string prezime = tbDodajPrezime.Text;
            string bio     = tbDodajBiografiju.Text;

            AutorInsert ins = new AutorInsert();

            ins.Autor            = new AutorDb {
            };
            ins.Autor.Ime        = ime;
            ins.Autor.Prezime    = prezime;
            ins.Autor.Biografija = bio;

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(ins);

            if ((obj == null) || (!obj.Status))
            {
                infoLabel2.Text = obj.Poruka;
            }
            else
            {
                loadData();
            }
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.DoBeforePageLoad();

            if (this.ThisPageName == null)
            {
                this.ThisPageName = "Default.aspx";
            }

            LiteralControl userLinks = MenuMethods.MakeUserLinks(SessionMethodes.RoleId(Session["idRole"]));

            this.Master.FindControl("cphUserForm").Controls.Add(userLinks);

            OperacijaRezultat rezult    = OpMenuSelect.SelectMenuByRole(SessionMethodes.RoleId(Session["idRole"]));
            LiteralControl    menuLinks = MenuMethods.MakeMenuLinks(rezult.DbItems.Cast <MenuDb>().ToArray(), this.ThisPageName);

            this.Master.FindControl("cphMenu").Controls.Add(menuLinks);

            if (!Page.IsPostBack)
            {
                this.DoWithoutPostBack();
            }

            this.DoAfterPageLoad();
        }
Beispiel #25
0
        protected void updKnjigu_Click(object sender, EventArgs e)
        {
            OpKnjigaUpdate knj = new OpKnjigaUpdate();

            knj.Knjiga           = new KnjigaDb {
            };
            knj.Knjiga.Id_knjiga = Convert.ToInt32(hiddenUpdate.Text);
            knj.Knjiga.Naziv     = updNaziv.Text;
            knj.Knjiga.Opis      = updOpis.Text;
            knj.Knjiga.Cena      = Convert.ToInt32(updCena.Text);
            knj.Knjiga.Godina    = updGodina.Text;
            if (FileUpload2.HasFile)
            {
                string sl          = FileUpload2.FileName;
                Bitmap originalBMP = new Bitmap(FileUpload1.FileContent);
                int    origWidth   = originalBMP.Width;
                int    origHeight  = originalBMP.Height;
                int    sngRatio    = origWidth / origHeight;
                int    newHeight   = 100;
                int    newWidth    = newHeight * sngRatio;
                // Create a new bitmap which will hold the previous resized bitmap
                Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight);
                // Create a graphic based on the new bitmap
                Graphics oGraphics = Graphics.FromImage(newBMP);

                // Set the properties for the new graphic file
                oGraphics.SmoothingMode = SmoothingMode.AntiAlias; oGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                // Draw the new graphic based on the resized bitmap
                oGraphics.DrawImage(originalBMP, 0, 0, newWidth, newHeight);

                // Save the new graphic file to the server
                newBMP.Save(Server.MapPath(".") + "//slike//male//" + sl);

                // Once finished with the bitmap objects, we deallocate them.
                originalBMP.Dispose();
                newBMP.Dispose();
                oGraphics.Dispose();
                FileUpload2.PostedFile.SaveAs(Server.MapPath(".") + "//slike//" + sl);
                string path = "~//slike//" + sl.ToString();
                knj.Knjiga.Slika     = "slike/" + sl;
                knj.Knjiga.SlikaMala = "slike/male" + sl;
            }
            knj.Knjiga.Id_zanr  = Convert.ToInt32(updZanr.SelectedItem.Value);
            knj.Knjiga.Id_autor = Convert.ToInt32(updAutor.SelectedItem.Value);

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(knj);

            DbItem[]   items  = obj.DbItems;
            KnjigaDb[] knjige = items.Cast <KnjigaDb>().ToArray();
            if (knjige.Count() > 0)
            {
                ifEmpty.Visible = false;
            }

            bookGrid.DataSource = knjige;
            bookGrid.DataBind();
        }
Beispiel #26
0
        public static string ajaxOceni(string ocena, string id)
        {
            InsertOcena ocn = new InsertOcena();

            ocn.Dbocena             = new DbOcena();
            ocn.Dbocena.Ocena       = Convert.ToDouble(ocena);
            ocn.Dbocena.Id_knjiga   = Convert.ToInt32(id);
            ocn.Dbocena.Id_korisnik = Convert.ToInt32(HttpContext.Current.Session["id_korisnik"]);

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(ocn);

            return("Success");
        }
Beispiel #27
0
        protected void autorObrisiBtn_Click(object sender, EventArgs e)
        {
            Button taster = (Button)sender;
            int    id     = Convert.ToInt32(taster.CommandArgument);

            AutorDelete del = new AutorDelete();

            del.Id_autor = id;

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(del);

            loadData();
        }
Beispiel #28
0
        protected void BookList_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item == null)
            {
                return;
            }

            Button btnRate = (Button)e.Item.FindControl("btnRate");
            Button btnAdd  = (Button)e.Item.FindControl("btnAdd");
            Panel  alr     = (Panel)e.Item.FindControl("alreadyPanel");

            if (Session["uloga"] == null || (String)Session["uloga"] == "adm")
            {
                btnRate.Visible = false;
                btnAdd.Visible  = false;
            }



            int Id_korisnik = Convert.ToInt32(HttpContext.Current.Session["id_korisnik"]);
            int Id_knjiga   = Convert.ToInt32(btnRate.CommandArgument);

            OcenaSelect ocena = new OcenaSelect();

            ocena.ocenaKriterijum             = new OcenaKriterijum();
            ocena.ocenaKriterijum.Id_knjiga   = Id_knjiga;
            ocena.ocenaKriterijum.Id_korisnik = Id_korisnik;

            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(ocena);

            DbItem[] items = obj.DbItems;

            if (items.Count() == 0)
            {
            }
            else
            {
                btnRate.CssClass = "btn btn-warning";
                btnRate.Enabled  = false;
                btnRate.Text     = "Glasali ste!";
            }


            if (Session["uloga"] == null || (String)Session["uloga"] == "adm")
            {
                btnRate.Visible = false;
            }
        }
Beispiel #29
0
        protected void dodajRespond_Click(object sender, EventArgs e)
        {
            string poruka = tbPoruka.Text;
            string email  = emailPrenos.Text;
            string ime    = imePrenos.Text;

            var    fromAddress = new MailAddress("*****@*****.**", "Books Shop");
            var    toAddress   = new MailAddress(email, ime);
            string subject     = "Admin Response";
            string body        = poruka;

            var smtp = new SmtpClient
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential("*****@*****.**", "lozinka_ovde")
            };

            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }
            message.Visible = true;



            KontaktSelect     op       = new KontaktSelect();
            OperacijaRezultat rezultat = OperationManager.Singleton.izvrsiOperaciju(op);

            DbItem[]    items = rezultat.DbItems;
            KontaktDb[] menus = items.Cast <KontaktDb>().ToArray();
            if (menus.Count() > 0)
            {
                ifEmpty.Visible = false;
            }

            contactsGrid.DataSource = menus;
            contactsGrid.DataBind();
        }
Beispiel #30
0
        protected void prikaziBooksPanel(object sender, EventArgs e)
        {
            insertPanel.Visible = true;

            OpKnjigaSelect    knjiga = new OpKnjigaSelect();
            OperacijaRezultat obj    = OperationManager.Singleton.izvrsiOperaciju(knjiga);



            if ((obj == null) || (!obj.Status))
            {
                return;
            }
            else
            {
                DbItem[]   items = obj.DbItems;
                KnjigaDb[] menus = items.Cast <KnjigaDb>().ToArray();
            }
        }