Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["uporabnik"] == null || Session["stanje"] == null)
            {
                Response.Redirect("index.aspx");
            }
            else if ((int)Session["stanje"] != 1)
            {
                Response.Redirect("index.aspx");
            }

            int ids = Baza.DobiStranko((int)Session["uporabnik"]);
            Dictionary <string, int> dictionary = new Dictionary <string, int>();

            dictionary = Baza.DobiNarocila(ids);
            foreach (KeyValuePair <string, int> entry in dictionary)
            {
                //this.DropDownList2.Items.Insert(0, new ListItem(entry.Key, entry.Value.ToString()));
                TableRow tRow = new TableRow();
                this.Table1.Rows.Add(tRow);
                TableCell tCell1 = new TableCell();
                TableCell tCell2 = new TableCell();
                tCell1.Text = entry.Key;
                Button bt = new Button();
                bt.Text   = "Briši";
                bt.ID     = entry.Value.ToString();
                bt.Click += OnClick;
                tRow.Cells.Add(tCell1);
                tCell2.Controls.Add(bt);
                tRow.Cells.Add(tCell2);
            }
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (this.TextBox1.Text.Length != 0)
     {
         int    znamka    = Int32.Parse(this.DropDownList3.SelectedValue);
         int    model     = Int32.Parse(this.DropDownList2.SelectedValue);
         int    idStranke = Baza.DobiStranko((int)Session["Uporabnik"]);
         string uspeh     = Baza.VnesiVozilo(znamka, model, Int32.Parse(this.TextBox1.Text), idStranke);
         this.peter.InnerHtml = uspeh;
         //Response.Redirect("index.aspx");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["stanje"] == null)
            {
                Response.Redirect("index.aspx");
            }
            else if ((int)Session["stanje"] != 1)
            {
                Response.Redirect("index.aspx");
            }
            if (!IsPostBack)
            {
                Dictionary <string, int> dictionary = new Dictionary <string, int>();
                dictionary = Baza.DobiPoslovalnice();
                foreach (KeyValuePair <string, int> entry in dictionary)
                {
                    this.DropDownList2.Items.Insert(0, new ListItem(entry.Key, entry.Value.ToString()));
                }
                dictionary = new Dictionary <string, int>();
                int stranka = Baza.DobiStranko((int)Session["uporabnik"]);
                dictionary = Baza.DobiVozila(stranka);
                foreach (KeyValuePair <string, int> entry in dictionary)
                {
                    this.DropDownList1.Items.Insert(0, new ListItem(entry.Key, entry.Value.ToString()));
                }
                for (int i = 2100; i > 2017; i--)
                {
                    this.DropDownList5.Items.Insert(0, new ListItem(i.ToString(), i.ToString()));
                }
                this.DropDownList8.Items.Insert(0, new ListItem("December", "12"));
                this.DropDownList8.Items.Insert(0, new ListItem("November", "11"));
                this.DropDownList8.Items.Insert(0, new ListItem("Oktober", "10"));
                this.DropDownList8.Items.Insert(0, new ListItem("Setember", "9"));
                this.DropDownList8.Items.Insert(0, new ListItem("August", "8"));
                this.DropDownList8.Items.Insert(0, new ListItem("Julij", "7"));
                this.DropDownList8.Items.Insert(0, new ListItem("Junij", "6"));
                this.DropDownList8.Items.Insert(0, new ListItem("Maj", "5"));
                this.DropDownList8.Items.Insert(0, new ListItem("April", "4"));
                this.DropDownList8.Items.Insert(0, new ListItem("Marec", "3"));
                this.DropDownList8.Items.Insert(0, new ListItem("Februar", "2"));
                this.DropDownList8.Items.Insert(0, new ListItem("Januar", "1"));

                for (int i = 23; i >= 0; i--)
                {
                    this.DropDownList6.Items.Insert(0, new ListItem(i.ToString(), i.ToString()));
                }
                for (int i = 59; i >= 0; i--)
                {
                    this.DropDownList7.Items.Insert(0, new ListItem(i.ToString(), i.ToString()));
                }
            }
            int j;

            if (this.DropDownList8.SelectedValue.Equals("1") || this.DropDownList8.SelectedValue.Equals("3") || this.DropDownList8.SelectedValue.Equals("5") || this.DropDownList8.SelectedValue.Equals("7") || this.DropDownList8.SelectedValue.Equals("8") || this.DropDownList8.SelectedValue.Equals("10") || this.DropDownList8.SelectedValue.Equals("12"))
            {
                j = 31;
            }
            else if (this.DropDownList8.SelectedValue.Equals("2"))
            {
                j = 28;
            }
            else
            {
                j = 30;
            }
            this.DropDownList3.Items.Clear();
            for (int i = 1; i < j + 1; i++)
            {
                this.DropDownList3.Items.Insert(0, new ListItem(i.ToString(), i.ToString()));
            }
        }