Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            float   c = Convert.ToInt64(TextBox3.Text);
            product p = new product();

            p.pro_name  = TextBox1.Text;
            p.pro_date  = TextBox2.Text;
            p.pro_price = c;
            //p.pro_img = img_upload(FileUpload1, Session["admin_id"].ToString());
            p.pro_img        = img_upload(FileUpload1);
            p.pro_catid_fk   = Convert.ToInt32(DropDownList1.SelectedValue.ToString());
            p.pro_adminid_fk = Convert.ToInt32(Session["admin_id"].ToString());
            insert i = new insert();

            ViewState["ad_id"] = i.insert_tblproduct(p);
            if (ViewState["ad_id"].ToString() == "-1")
            {
                Label2.Text = "TRY AGAIN ....";
            }
            else
            {
                Label2.Text         = "The add was successfully posted!";
                LinkButton3.Visible = true;
                TextBox1.Text       = " ";
                TextBox3.Text       = " ";
                //Response.Redirect("~/View/Admin/adminpannel.aspx");
            }
        }
Beispiel #2
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Session["admin_id"] = "1";

                product p = new product();
                p.pro_name        = TextBox1.Text;
                p.pro_date        = TextBox2.Text;
                p.pro_price       = Convert.ToDecimal(TextBox3.Text);
                p.pro_img         = img_upload(FileUpload3, Session["admin_id"].ToString());
                p.pro_adminid_fk  = Convert.ToInt32(Session["admin_id"].ToString());
                p.pro_subcatid_fk = Convert.ToInt32(DropDownList2.SelectedValue.ToString());

                insert i = new insert();
                string k = i.insert_tblproduct(p);
                if (k == "-1")
                {
                    Label2.Text = "TRY AGAIN ....";
                }
                else
                {
                    if (DropDownList1.SelectedIndex == 1 && DropDownList2.SelectedIndex == 1)
                    {
                        HyperLink1.NavigateUrl = "~/Womens/WomensShoes.aspx";
                    }
                    else if (DropDownList1.SelectedIndex == 1 && DropDownList2.SelectedIndex == 2)
                    {
                        HyperLink1.NavigateUrl = "~/Womens/WomensCoats.aspx";
                    }
                    else if (DropDownList1.SelectedIndex == 1 && DropDownList2.SelectedIndex == 3)
                    {
                        HyperLink1.NavigateUrl = "~/Womens/WomensTop.aspx";
                    }

                    else if (DropDownList1.SelectedIndex == 2 && DropDownList2.SelectedIndex == 1)
                    {
                        HyperLink1.NavigateUrl = "~/Mens/MensJeans.aspx";
                    }
                    else if (DropDownList1.SelectedIndex == 2 && DropDownList2.SelectedIndex == 2)
                    {
                        HyperLink1.NavigateUrl = "~/Mens/MensJackets.aspx";
                    }
                    else
                    {
                        Label2.Text = "Add not available for view";
                    }

                    Label2.Text = "Ad successfully posted!";

                    HyperLink1.Visible = true;
                    HyperLink1.Text    = " View Add Online";

                    TextBox1.Text = "";

                    TextBox3.Text = "";
                    DropDownList1.SelectedIndex = 0;
                    drop2Changed();
                    DropDownList2.Enabled       = false;
                    DropDownList2.SelectedIndex = 0;



                    //Response.Redirect("~/AdminAccount/AdminPannel.aspx");
                }
            }
        }