Пример #1
0
    protected void Drp_shop_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (Drp_shop.SelectedValue.ToString() != "0")
        {
            AFLAC_New_Add_List report = new AFLAC_New_Add_List();
            string             search = Drp_shop.SelectedItem.Text;
            if (Drp_shop.SelectedValue.ToString() != "")
            {
                Telerik.Reporting.Filter filter1 = new Telerik.Reporting.Filter();

                filter1.Operator   = Telerik.Reporting.FilterOperator.Equal;
                filter1.Expression = "=Fields.Shop";
                filter1.Value      = search;
                report.Filters.Add(filter1);
            }
            ReportViewer1.Visible = true;
            ReportViewer1.Report  = report;
        }
    }
        private void SetReportParameters(Report resultReport)
        {
            foreach (var relColumn in ParentToChildSubReportDTO.SubsColumnsDTO)
            {
                //if (parentRelationship.MastertTypeEnum == Enum_MasterRelationshipType.FromForeignToPrimary)
                //    if (relColumn.FirstSideColumnID == null)
                //        continue;

                ReportParameter parameter = new ReportParameter();
                parameter.Name = relColumn.ParentEntityListViewColumnRelativeName;
                parameter.Type = ConvertParameterType(relColumn.ParentEntityListViewColumnType);
                resultReport.ReportParameters.Add(parameter);
                //اگر الیاس داشته باشند چه؟ باید از پرنت الیاسها هم در نظر گرفته شود
                var filter = new Telerik.Reporting.Filter();
                filter.Expression = string.Format("= Fields.{0}", relColumn.ChildEntityListViewColumnRelativeName);
                filter.Operator   = Telerik.Reporting.FilterOperator.Equal;
                filter.Value      = string.Format("= Parameters.{0}.Value", relColumn.ParentEntityListViewColumnRelativeName);
                resultReport.Filters.Add(filter);
            }
        }
Пример #3
0
        private InstanceReportSource GenerateReport()
        {
            var typeName   = "Orchestrator.Reports.rptDriverTime, Orchestrator.Reports";
            var reportType = Type.GetType(typeName);
            var report     = (IReportDocument)Activator.CreateInstance(reportType);

            report.ReportParameters.ElementAt(0).Value = dteStartDate.SelectedDate.Value.Date;
            report.ReportParameters.ElementAt(1).Value = dteEndDate.SelectedDate.Value.Date;
            report.ReportParameters.ElementAt(2).Value = cboDriver.SelectedValue;

            if (!rbDefault.Checked && txtHoursGreaterThan.Value.HasValue)
            {
                var seconds = (int)txtHoursGreaterThan.Value * 3600;

                if (rbDrive.Checked)
                {
                    Telerik.Reporting.Filter driveFilter = new Telerik.Reporting.Filter();
                    driveFilter.Expression = "=Sum(Fields.DriveDuration)";
                    driveFilter.Operator   = Telerik.Reporting.FilterOperator.GreaterThan;
                    driveFilter.Value      = "=" + seconds.ToString();
                    report.Reports.ElementAt(0).Groups.ElementAt(1).Filters.Add(driveFilter);
                }

                if (rbSpreadOver.Checked)
                {
                    Telerik.Reporting.Filter spreadOverFilter = new Telerik.Reporting.Filter();
                    spreadOverFilter.Expression = "=Sum(Fields.AvailabilityDuration) + Sum(Fields.WorkDuration) + Sum(Fields.DriveDuration)";
                    spreadOverFilter.Operator   = Telerik.Reporting.FilterOperator.GreaterThan;
                    spreadOverFilter.Value      = "=" + seconds.ToString();
                    report.Reports.ElementAt(0).Groups.ElementAt(1).Filters.Add(spreadOverFilter);
                }
            }

            return(new InstanceReportSource {
                ReportDocument = report
            });
        }