Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            // Get the common web service instance.
            ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService farmService   = serviceLoader.GetFarm();

            //Check for Admin Login
            if (!IsPostBack)
            {
                ReportViewerUserControl1.ReportHeight = 580;
                ReportViewerUserControl1.ReportWidth  = 800;
                if (IsAgentRole)
                {
                    AgentListPanel.Visible = false;
                    //Populate Report
                    FarmService.FarmDetailsReportInfo[] details = farmService.ReportForFarmDetails(GetAgentId());

                    //ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("FarmDetailsReportInfo", details));
                    ReportViewerUserControl1.DataSource     = details;
                    ReportViewerUserControl1.DataSourceName = "FarmDetailsReportInfo";
                    ReportViewerUserControl1.ReportPath     = "Members/Reports/FarmPlotContactListReport.rdlc";
                }
                else
                {
                    AgentListPanel.Visible = true;
                    CommonService commonService = serviceLoader.GetCommon();
                    AgentListDropDownList.DataSource     = commonService.GetAgentsList();
                    AgentListDropDownList.DataValueField = "UserId";
                    AgentListDropDownList.DataTextField  = "UserName";
                    AgentListDropDownList.DataBind();
                    AgentListDropDownList.Items.Insert(0, "Select an Agent");
                }
            }
            else
            {
                if (!IsAgentRole)
                {
                    if (AgentListDropDownList.SelectedIndex > 0)
                    {
                        //Populate Report
                        FarmService.FarmDetailsReportInfo[] details = farmService.ReportForFarmDetails(GetAgentId());
                        //ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("FarmDetailsReportInfo", details));
                        //ReportViewer1.LocalReport.Refresh();

                        ReportViewerUserControl1.DataSource     = details;
                        ReportViewerUserControl1.DataSourceName = "FarmDetailsReportInfo";
                        ReportViewerUserControl1.ReportPath     = "Members/Reports/FarmPlotContactListReport.rdlc";
                    }
                }
            }
        }
        catch (Exception exception)
        {
            log.Error("UNKNOWN ERROR WHILE LOADING FARM PLOT REPORT:", exception);
            ErrorLiteral.Text = "UNKNOWN ERROR: Contact Administrator";
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get the common web service instance.
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        FarmService.FarmService             farmService = serviceLoader.GetFarm();
        FarmService.FarmDetailsReportInfo[] details     = farmService.ReportForFarmDetails(100001);

        ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("FarmDetailsReportInfo", details));
    }