Beispiel #1
0
    /// <summary>
    /// basing on clicked pagination links, run stored procedure and returns profiles which met conditions
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void FillSzukane(object sender, CommandEventArgs e)
    {
        DataClassesDataContext db = new DataClassesDataContext(Usr.ConnectionString);
        string     userid         = Session["userid"].ToString();
        int        gender         = int.Parse(DropDownList1.SelectedValue);
        int        dateDown       = int.Parse(DropDownList2.SelectedValue);
        int        dateUp         = int.Parse(DropDownList3.SelectedValue);
        List <int> wojewodztwa_id = new List <int>();

        foreach (ListItem li in cblWojewodztwa.Items)
        {
            if (li.Selected && (int.Parse(li.Value) == 17))
            {
                for (int ii = 1; ii < 17; ii++)
                {
                    wojewodztwa_id.Add(ii);
                }
                break;
            }
            else
            {
                if (li.Selected)
                {
                    wojewodztwa_id.Add(int.Parse(li.Value));
                }
            }
        }

        CheckBoxList checkedListBox1 = (CheckBoxList)pnlCustomers.FindControl("cblCustomerList");
        List <int>   sporty_id       = new List <int>();

        foreach (ListItem li in checkedListBox1.Items)
        {
            if (li.Selected)
            {
                sporty_id.Add(int.Parse(li.Value));
            }
        }
        int wygladId = 0;

        if (DDLWyglad.SelectedValue != "")
        {
            wygladId = int.Parse(DDLWyglad.SelectedValue);
        }


        int toSkip = (int.Parse(e.CommandArgument.ToString()) - 1) * mssgPerPage;
        int toTake = mssgPerPage;

        var szukajResults = Usr.FillSzukane(userid, dateDown, dateUp, gender, wojewodztwa_id, toSkip, toTake, sporty_id, wygladId);

        ListView1.DataSource = szukajResults.ToList();
        ListView1.DataBind();
        BuildPaginationLinks(e.CommandArgument.ToString());
    }