示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccess.Db db = new DataAccess.Db();

            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("items.aspx");
            }
            else
            {
                if (Session["user"] == null)
                {
                    finder.Text = "Unregistered user";
                }
                else
                {
                    finder.Text = Session["user"].ToString();
                }
                id = Convert.ToInt32(Request.QueryString["id"]);
                SqlCommand     command = db.executecommand("select *  from [comment] where book='" + id + "'");
                DataTable      dt      = new DataTable();
                SqlDataAdapter da      = new SqlDataAdapter(command);
                da.Fill(dt);
                r1.DataSource = dt;
                r1.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            db            = new DataAccess.Db();
            SqlConnection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\course\course\App_Data\Library.mdf;Integrated Security=True");
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("items.aspx");
            }
            else
            {
                id = Convert.ToInt32(Request.QueryString["id"].ToString());

                string         sql = "select * from product where Id='" + id + "'";
                SqlCommand     cmd = db.executecommand(sql);
                DataTable      dt  = new DataTable();
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                d1.DataSource = dt;
                d1.DataBind();
            }

            course.Business_Layer.productBU productBU = new Business_Layer.productBU();
            Business_Layer.product          p         = productBU.GetProductbyID(id.ToString());
            Rating.Text = p.rate.ToString();
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new DataAccess.Db();

            SqlCommand command;

            if (Request.QueryString["category"] == null)
            {
                command = db.executecommand("select * from product where product_added=1");
            }
            else
            {
                command = db.executecommand("select * from product where product_added=1 and product_category='" + Request.QueryString["category"].ToString() + "'");
            }
            if (Request.QueryString["category"] == null && Request.QueryString["search"] != null)
            {
                command = db.executecommand("select * from product where product_added=1 and product_name like('%" + Request.QueryString["search"].ToString() + "%')");
            }


            /*if (Request.QueryString["search"] != null)
             * {
             *  command.CommandText="select * from product where product_name"
             * }*/
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(command);

            da.Fill(dt);
            d1.DataSource = dt;
            d1.DataBind();
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new DataAccess.Db();
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("items.aspx");
            }
            else
            {
                id = Convert.ToInt32(Request.QueryString["id"].ToString());

                string         sql = "select * from [product] where product.Id='" + id.ToString() + "'";
                SqlCommand     cmd = db.executecommand(sql);
                DataTable      dt  = new DataTable();
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                d1.DataSource = dt;
                d1.DataBind();
                sql = "select * from cart where cart.product='" + id.ToString() + "' and cart.email='" + Session["user"] + "'";
                cmd = db.executecommand(sql);
                dt  = new DataTable();
                da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                d2.DataSource = dt;
                d2.DataBind();
            }
        }
示例#5
0
        protected void b2_Click(object sender, EventArgs e)
        {
            DataAccess.Db data = new DataAccess.Db();
            string        sql  = "UPDATE product SET product_added=2 where Id='" + id.ToString() + "'";

            data.executecommand(sql);
            Response.Redirect("BooksRequests.aspx");
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new DataAccess.Db();
            SqlCommand     com       = db.executecommand("select * from category");
            DataTable      dataTable = new DataTable();
            SqlDataAdapter da        = new SqlDataAdapter(com);

            da.Fill(dataTable);
            dd.DataSource = dataTable;
            dd.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     db = new DataAccess.Db();
     if (Session["user"] != null)
     {
         SqlCommand     command = db.executecommand("select *  from  [product] where product_developer='" + Session["user"] + "'");
         DataTable      dt      = new DataTable();
         SqlDataAdapter da      = new SqlDataAdapter(command);
         da.Fill(dt);
         d1.DataSource = dt;
         d1.DataBind();
     }
     else
     {
         Response.Redirect("login.aspx");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new DataAccess.Db();

            SqlCommand command;

            command = db.executecommand("SELECT * FROM product WHERE product_added=0");



            /*if (Request.QueryString["search"] != null)
             * {
             *  command.CommandText="select * from product where product_name"
             * }*/
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(command);

            da.Fill(dt);
            d1.DataSource = dt;
            d1.DataBind();
        }
示例#9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlCommand t = db.executecommand("select * from registration where email='" + TextBox1.Text + "'AND password='******'AND status IS NULL");

            db.OpenConnection();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(t);

            da.Fill(dt);
            tot = Convert.ToInt32(dt.Rows.Count.ToString());
            db.connection.Close();

            if (tot > 0)
            {
                Session["user"] = TextBox1.Text;
                Response.Redirect("items.aspx");
            }

            else
            {
                Label1.Text = "invalid email or password";
            }
            DataAccess.Db data = new DataAccess.Db();

            SqlCommand sql = data.executecommand("select status from registration where email='" +
                                                 TextBox1.Text + "'AND password='******'");

            data.connection.Open();
            object result = sql.ExecuteScalar();
            string res    = Convert.ToString(result);

            res = res.Trim();
            if (res != null)
            {
                Label1.Text = "Error. " + res; data.connection.Close();
            }
        }
示例#10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     db = new DataAccess.Db();
 }