public void LoadReport() { try { DateTime?dtFrom = dtpFromDate.Value.ToDateorNull(); DateTime?dtTill = dtpToDate.Value.ToDateorNull(); if (dtFrom != null && dtpFromTime.Value != null && dtpFromTime.Value.Value != null) { dtFrom = (dtFrom.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime(); } int driverId = ddlAllDriver.SelectedValue.ToInt(); int SubCompanyId = ddlSubCompany.SelectedValue.ToInt(); int Rating; if (ddlRating.Text == "") { Rating = 0; } else { Rating = ddlRating.Text.ToInt(); } if (dtTill != null && dtptilltime.Value != null && dtptilltime.Value.Value != null) { dtTill = (dtTill.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime(); } string Error = string.Empty; if (dtFrom == null) { Error = "Required: From Date"; } if (dtTill == null) { if (string.IsNullOrEmpty(Error)) { Error = "Required: To Date"; } else { Error += Environment.NewLine + "Required: To Date"; } } if (!string.IsNullOrEmpty(Error)) { ENUtils.ShowMessage(Error); return; } this.reportViewer1.LocalReport.EnableExternalImages = true; using (TaxiDataContext db = new TaxiDataContext()) { var list2 = db.stp_CustomerFeedback(dtFrom, dtTill, SubCompanyId, driverId, Rating).ToList();; this.stp_CustomerFeedbackResultBindingSource.DataSource = list2; } Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[3]; string heading = string.Empty; heading = "Date Range: " + string.Format("{0:yyyy-MM-dd HH:mm}", dtFrom) + " to " + string.Format("{0:yyyy-MM-dd HH:mm}", dtTill); //heading = "From: "+string.Format("{0:dd/MM/yyyy}", dtFrom) + " To: " + string.Format("{0:dd/MM/yyyy}", dtTill); // string EndDate = string.Format("{0:dd/MM/yyyy}", DateTime.Now); //string To = string.Format("{0:dd/MM/yyyy}", dtTill); // string Earning = "Driver Earnings - "+list.Count().ToStr()+" found"; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeading", AppVars.objSubCompany.CompanyName); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", AppVars.objSubCompany.Address); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameterPeriod", heading); //List<ClsLogo> objLogo = new List<ClsLogo>(); //objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); //ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); //this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); IsReportLoaded = true; } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }