Esempio n. 1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        // First check to see if at least one food items has been added:
        if (SelectedFoodsGridView.Rows.Count >= 1)
        {
            // Read through the rows in the gridview and update the value
            //data.changeFoodQuantityFromSession(e.RowIndex, e.NewValues["Quantity"].ToString());
            foreach (GridViewRow gvr in SelectedFoodsGridView.Rows)
            {
                if (gvr.RowType == DataControlRowType.DataRow)
                {
                    da.changeFoodQuantityFromSession(gvr.RowIndex, ((TextBox)gvr.FindControl("tbFoodQuantity")).Text);
                }
            }


            // load/update the review gridview
            ReviewGridView.DataBind();

            MultiView1.ActiveViewIndex = 3;
            setActiveViewIndex(MultiView1.ActiveViewIndex);
        }
        else
        {
            lblMinOneFoodRequired.Visible = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string        connStr = ConfigurationManager.ConnectionStrings["Social_website_main"].ToString();
        SqlConnection conn    = new SqlConnection(connStr);
        SqlCommand    cmd     = new SqlCommand("GetConference", conn);

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add(new SqlParameter("@id", 3));
        SqlCommand cmd2 = new SqlCommand("select  Distinct (content) as reviews,member_email from Conference_Reviews where conference_id=3", conn);
        SqlCommand cmd3 = new SqlCommand("sp_View_Conference", conn);

        cmd3.Parameters.Add(new SqlParameter("@name", "GUC"));
        cmd3.CommandType = CommandType.StoredProcedure;
        conn.Open();
        SqlDataReader rdr2 = cmd2.ExecuteReader();

        ReviewGridView.DataSource = rdr2;
        ReviewGridView.DataBind();
        conn.Close();
        conn.Open();
        SqlDataReader rdr3 = cmd3.ExecuteReader();

        GridView1.DataSource = rdr3;
        GridView1.DataBind();
        conn.Close();
        conn.Open();
        SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

        if (rdr.HasRows)
        {
            while (rdr.Read())
            {
                string ConferenceName = rdr.GetString(rdr.GetOrdinal("name"));


                DateTime startdate = rdr.GetDateTime(rdr.GetOrdinal("start_date"));
                String   venue     = rdr.GetString(rdr.GetOrdinal("venue"));
                string   date      = "" + startdate;

                lblConferenceName.InnerText = ConferenceName;
                lblDate.InnerText           = date;
                lblLocation.InnerText       = venue;
            }
        }
    }
Esempio n. 3
0
    protected void Button5_Click(object sender, EventArgs e)
    {
        lblMinOneFoodRequired.Visible = false;
        FoodSearchBox.Text            = "";
        ListBox1.SelectedIndex        = -1;

        foreach (GridViewRow gvr in SelectedFoodsGridView.Rows)
        {
            if (gvr.RowType == DataControlRowType.DataRow)
            {
                da.changeFoodQuantityFromSession(gvr.RowIndex, ((TextBox)gvr.FindControl("tbFoodQuantity")).Text);
            }
        }
        // load/update the review gridview
        ReviewGridView.DataBind();
        MultiView1.ActiveViewIndex = 2;
        setActiveViewIndex(MultiView1.ActiveViewIndex);

        //doSearchLoad();
    }
Esempio n. 4
0
        protected void SearchReview_Click(object sender, EventArgs e)
        {
            string        s   = WebConfigurationManager.ConnectionStrings["WingtipToys"].ConnectionString;
            SqlConnection con = new SqlConnection(s);
            SqlCommand    cmd;
            StringBuilder sqlString = new StringBuilder("SELECT * FROM comment c");
            int           additions = 0;

            if (SearchItemDropDownList.SelectedValue != "All")
            {
                if (additions == 0)
                {
                    sqlString.Append(" WHERE c.comment_product_id = @productid");
                }
                else
                {
                    sqlString.Append(" AND c.comment_product_id = @productid");
                }
                additions++;
            }
            if (FNameDropDownList.SelectedValue != "All")
            {
                if (additions == 0)
                {
                    sqlString.Append(" WHERE c.first_name = @firstname");
                }
                else
                {
                    sqlString.Append(" AND c.first_name = @firstname");
                }
                additions++;
            }
            if (LNameDropDownList.SelectedValue != "All")
            {
                if (additions == 0)
                {
                    sqlString.Append(" WHERE c.last_name = @lastname");
                }
                else
                {
                    sqlString.Append(" AND c.last_name = @lastname");
                }
                additions++;
            }
            cmd = new SqlCommand(sqlString.ToString(), con);
            try
            {
                int id = GetProductID(SearchItemDropDownList.SelectedValue);
                cmd.Parameters.AddWithValue("@productid", id);
                Debug.WriteLine($"IT IS REPLACING PRODUCT ID with {id}");
            }
            catch
            {
            }
            try
            {
                cmd.Parameters.AddWithValue("@firstname", FNameDropDownList.SelectedValue);
            }
            catch
            {
            }
            try
            {
                cmd.Parameters.AddWithValue("@lastname", LNameDropDownList.SelectedValue);
            }
            catch
            {
            }
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            ReviewGridView.DataSource = dr;
            ReviewGridView.DataBind();
            if (!dr.HasRows)
            {
                NoReivewLabel.Text = "No reviews are available that match that query";
            }
            else
            {
                NoReivewLabel.Text = "";
            }
            dr.Close();
            con.Close();
            //RefreshListboxes();


            /*
             * if (FNameDropDownList.SelectedValue != "All" && LNameDropDownList.SelectedValue != "All" && ProductDropDownList.SelectedValue != "All")
             * {
             *  sqlString = "SELECT * FROM comment c WHERE comment_product_id = @productid AND first_name = @firstname AND last_name = @lastname";
             *  cmd = new SqlCommand(sqlString, con);
             *  cmd.Parameters.AddWithValue("@productid", GetProductID(ProductDropDownList.SelectedValue));
             *  cmd.Parameters.AddWithValue("@firstname", FNameDropDownList.SelectedValue);
             *  cmd.Parameters.AddWithValue("@lastname", LNameDropDownList.SelectedValue);
             *
             * }
             * else if(FNameDropDownList.SelectedValue != "All")
             * {
             *  sqlString = "SELECT * FROM comment c WHERE comment_product_id = @productid AND first_name = @firstname";
             *  cmd = new SqlCommand(sqlString, con);
             *  cmd.Parameters.AddWithValue("@productid", GetProductID(ProductDropDownList.SelectedValue));
             *  cmd.Parameters.AddWithValue("@firstname", FNameDropDownList.SelectedValue);
             * }
             * else if(LNameDropDownList.SelectedValue != "All")
             * {
             *  sqlString = "SELECT * FROM comment c WHERE comment_product_id = @productid AND last_name = @lastname";
             *  cmd = new SqlCommand(sqlString, con);
             *  cmd.Parameters.AddWithValue("@productid", GetProductID(ProductDropDownList.SelectedValue));
             *  cmd.Parameters.AddWithValue("@lastname", LNameDropDownList.SelectedValue);
             * }
             * else
             * {
             *  sqlString = "SELECT * FROM comment c WHERE comment_product_id = @productid";
             *  cmd = new SqlCommand(sqlString, con);
             *  cmd.Parameters.AddWithValue("@productid", GetProductID(ProductDropDownList.SelectedValue));
             *
             * }
             * con.Open();
             * SqlDataReader dr = cmd.ExecuteReader();
             * ReviewGridView.DataSource = dr;
             * ReviewGridView.DataBind();
             * dr.Close();
             * con.Close();
             *
             */
        }