Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        EventHandler ins = new EventHandler(this.insertBtn_Click);
        EventHandler del = new EventHandler(this.brisiBtn_Click);

        Dictionary <String, String> pomosna = (Dictionary <String, String>)Session["Korisnik"];

        if (pomosna != null)
        {
            if (pomosna["Vid"].Trim() != "Korisnik")
            {
                Response.Redirect("Default.aspx");
            }
            else
            {
                defaultDiv.Visible = false;
                if (Request.QueryString["Mod"] != null && Request.QueryString["A"] != null)
                {
                    nar = new NarackaClass(this, this.vnesiUP, this.podatociUP, this.narackaListaUP, ins, del);
                    if (Request.QueryString["mod"].ToString() == "1" && Request.QueryString["A"].ToString() == "1")
                    {
                        vnesiUP.ContentTemplateContainer.Controls.Add(nar.vratiNapraviNaracka());
                        this.Session.Remove("BarajNar");
                        this.Session.Remove("Vnes");
                    }
                    else if (Request.QueryString["mod"].ToString() == "1" && Request.QueryString["A"].ToString() == "2")
                    {
                        vnesiUP.ContentTemplateContainer.Controls.Add(nar.vratiBarajProizvod());
                        if (Session["Vnes"] != null)
                        {
                            String[]     vnes = (String[])Session["Vnes"];
                            TextBox      pom  = (TextBox)vnesiUP.FindControl("imeTextBox");
                            DropDownList pom1 = (DropDownList)vnesiUP.FindControl("grupaProizvodiLista");
                            pom.Text           = vnes[0].ToString();
                            pom1.SelectedIndex = Convert.ToInt16(vnes[1].ToString());
                        }

                        nar.nacrtajTabela();
                        nar.nacrtajTabelaLista();
                        this.Session.Remove("BarajNar");
                    }
                    else if (Request.QueryString["mod"].ToString() == "2" && Request.QueryString["A"].ToString() == "1")
                    {
                        this.Session.Remove("Vnes");
                        vnesiUP.ContentTemplateContainer.Controls.Add(nar.vratiBarajNaracka());
                        nar.nacartajTabelaNarackiNapraveni();
                    }
                    else if (Request.QueryString["mod"].ToString() == "2" && Request.QueryString["A"].ToString() == "2")
                    {
                        this.Session.Remove("BarajNar");
                        nar.nacrtajListaProizvodiIzvestaj();
                    }
                    else if (Request.QueryString["mod"].ToString() == "2" && Request.QueryString["A"].ToString() == "3")
                    {
                        this.Session.Remove("BarajNar");
                        nar.nacrtajTabelaPopust();
                    }
                }
                else
                {
                    this.Session.Remove("BarajNar");
                    this.Session.Remove("Vnes");
                    NarackaClass pom = new NarackaClass();
                    pom.iscitiStaticni();
                    defaultDiv.Visible = true;
                }
            }
        }

        this.reklamiNarackiDiv.Controls.Clear();
        this.nacrtajReklami();
    }
    protected void Page_Load(object sender, EventArgs e)
    {

        EventHandler ins = new EventHandler(this.insertBtn_Click);
        EventHandler del = new EventHandler(this.brisiBtn_Click);

            Dictionary<String, String> pomosna = (Dictionary<String, String>)Session["Korisnik"];
            if (pomosna != null)
            {
                if (pomosna["Vid"].Trim() != "Korisnik")
                {
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    defaultDiv.Visible = false;
                    if (Request.QueryString["Mod"] != null && Request.QueryString["A"] != null)
                    {

                        nar = new NarackaClass(this, this.vnesiUP, this.podatociUP, this.narackaListaUP,ins,del);
                        if (Request.QueryString["mod"].ToString() == "1" && Request.QueryString["A"].ToString() == "1")
                        {
                            vnesiUP.ContentTemplateContainer.Controls.Add(nar.vratiNapraviNaracka());
                            this.Session.Remove("BarajNar");
                            this.Session.Remove("Vnes");
                        }
                        else if (Request.QueryString["mod"].ToString() == "1" && Request.QueryString["A"].ToString() == "2")
                        {

                            vnesiUP.ContentTemplateContainer.Controls.Add(nar.vratiBarajProizvod());
                            if (Session["Vnes"] != null)
                            {
                                String[] vnes = (String[])Session["Vnes"];
                                TextBox pom = (TextBox)vnesiUP.FindControl("imeTextBox");
                                DropDownList pom1 = (DropDownList)vnesiUP.FindControl("grupaProizvodiLista");
                                pom.Text = vnes[0].ToString();
                                pom1.SelectedIndex = Convert.ToInt16(vnes[1].ToString());
                            }

                            nar.nacrtajTabela();
                            nar.nacrtajTabelaLista();
                            this.Session.Remove("BarajNar");

                        }
                        else if (Request.QueryString["mod"].ToString() == "2" && Request.QueryString["A"].ToString() == "1")
                        {
                            this.Session.Remove("Vnes");
                            vnesiUP.ContentTemplateContainer.Controls.Add(nar.vratiBarajNaracka());
                            nar.nacartajTabelaNarackiNapraveni();
                        }
                        else if (Request.QueryString["mod"].ToString() == "2" && Request.QueryString["A"].ToString() == "2")
                        {
                            this.Session.Remove("BarajNar");
                            nar.nacrtajListaProizvodiIzvestaj();
                        }
                        else if (Request.QueryString["mod"].ToString() == "2" && Request.QueryString["A"].ToString() == "3")
                        {
                            this.Session.Remove("BarajNar");
                            nar.nacrtajTabelaPopust();                            
                        }
                    }
                    else
                    {
                        this.Session.Remove("BarajNar");
                        this.Session.Remove("Vnes");
                        NarackaClass pom = new NarackaClass();
                        pom.iscitiStaticni();
                        defaultDiv.Visible = true;

                    }
                }
            }           

                this.reklamiNarackiDiv.Controls.Clear();
                this.nacrtajReklami();      
    }