示例#1
0
    protected void btnFilter_Click(object sender, EventArgs e)
    {
        string   emirate        = ddlEmirates.SelectedValue;
        int?     organizationId = null;
        DateTime?dateFrom       = null;
        DateTime?dateTo         = null;

        if (int.TryParse(ddlOrganizations.SelectedValue, out int parsedOrgId))
        {
            organizationId = parsedOrgId;
        }

        if (DateTime.TryParse(txtDateFrom.Text, out DateTime parsedDateFrom))
        {
            dateFrom = parsedDateFrom;
        }

        if (DateTime.TryParse(txtDateTo.Text, out DateTime parsedDateTo))
        {
            dateTo = parsedDateTo;
        }

        DataTable opportunities = Opportunity.GetAllFiltered(emirate, organizationId, dateFrom, dateTo);

        ListOpportunities(opportunities);
    }