Exemplo n.º 1
0
    private void BindNeeders()
    {
        GrdAdoptionPersonsList.DataSource = null;
        GrdAdoptionPersonsList.DataBind();

        PnlFilter.BindControls(FilterDictionary, _TableName);
        DListStatusType_SelectedIndexChanged(null, null);
        FilterDictionary = new Dictionary <string, object>()
        {
            { "Ap.ID", TxtID.Text },
            { "CONCAT(Soyad,' ',Ad,' ',Ata)(LIKE)", TxtFullname.Text },
            { "IsWebPreview", DListIsWebPreview.SelectedValue },
            { "IsBrotherSister", DListIsBrotherSister.SelectedValue },
            { "AdoptionPersonsStatusID", int.Parse(AdoptionPersonsStatusID) }
        };

        if (DListStatusType.SelectedIndex == 0)
        {
            FilterDictionary.Add("AdoptionPersonsStatusID(NOTIN)", 90);
        }

        int PageNum;
        int RowNumber = 16;

        if (!int.TryParse(Config._GetQueryString("pn"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult AdoptionPersonsResult = DALC_Adoption.GetAdoptionPersons(FilterDictionary, PageNum, RowNumber);

        if (AdoptionPersonsResult.Count == -1)
        {
            return;
        }

        if (AdoptionPersonsResult.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.Redirect(string.Format("/adoptionadminn/tools/?p=adoptionpersons&pn={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", AdoptionPersonsResult.Count.ToString());

        int Total_Count = AdoptionPersonsResult.Count % RowNumber > 0 ? (AdoptionPersonsResult.Count / RowNumber) + 1 : AdoptionPersonsResult.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = AdoptionPersonsResult.Count > RowNumber;

        GrdAdoptionPersonsList.DataSource = AdoptionPersonsResult.Dt;
        GrdAdoptionPersonsList.DataBind();
    }
Exemplo n.º 2
0
    private void BindData()
    {
        RptChilds.DataSource = null;
        RptChilds.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);

        FilterDictionary = new Dictionary <string, object>()
        {
            { "Gender", DListGender.SelectedValue },
            { "GozColorsID", int.Parse(DListEyeColor.SelectedValue) },
            { "SachColorsID", int.Parse(DListHairColor.SelectedValue) },
            { "FLOOR(DATEDIFF(DAY , DogumTarixi ,GETDATE()) / 365.25)(BETWEEN)", DListAgeRange.SelectedValue }
        };

        if (DListBrotherSister.SelectedIndex != 0)
        {
            FilterDictionary.Add("IsBrotherSister", Convert.ToByte(DListBrotherSister.SelectedValue));
        }

        if (TxtFullname.Text.Length > 0)
        {
            FilterDictionary.Add("CONCAT(Soyad,' ',Ad,' ',Ata)(LIKE)", TxtFullname.Text);
        }

        int PageNum;
        int RowNumber = 3;

        if (!int.TryParse(Config._GetQueryString("pn"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult AdoptionPersonsResult = DALC_Adoption.GetAdoptionPersons(FilterDictionary, PageNum, RowNumber);

        if (AdoptionPersonsResult.Count == -1 || AdoptionPersonsResult.Dt == null)
        {
            Config.RedirectError();
            return;
        }

        if (AdoptionPersonsResult.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.Redirect(string.Format("/e-services/adoption/?p=adoptionsite&pn={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Tapılıb: {0} anket", AdoptionPersonsResult.Count.ToString());

        int Total_Count = AdoptionPersonsResult.Count % RowNumber > 0 ? (AdoptionPersonsResult.Count / RowNumber) + 1 : AdoptionPersonsResult.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = AdoptionPersonsResult.Count > RowNumber;

        RptChilds.DataSource = AdoptionPersonsResult.Dt;
        RptChilds.DataBind();

        CheckControls();
    }