Example #1
0
        /// <summary>
        /// <para>Description:
        /// This Method will get Classes of Course by CourseID and Rebind Class DropDown</para>
        /// <para>Created By: M.Ishaq </para>
        /// <para>Created Date: 2/26/2019 </para>
        private void ClassesGetByCourseID()
        {
            try
            {
                if (DdlCourseCategory.SelectedIndex > 0 && TxtFromYear.Text.Length > 0 && TxtToYear.Text.Length > 0)
                {
                    DateTime Fromyear  = UtilityFunctions.MapValue <DateTime>(TxtFromYear.Text, typeof(DateTime));
                    DateTime Toyear    = UtilityFunctions.MapValue <DateTime>(TxtToYear.Text, typeof(DateTime));
                    long     CompanyId = Convert.ToInt64(HttpContext.Current.Session["CompanyID"]);

                    CurrentCourseCategoryID  = UtilityFunctions.MapValue <long>(DdlCourseCategory.SelectedValue, typeof(long));
                    ClassReportStartDateFrom = Fromyear; // new DateTime(Fromyear, UtilityFunctions.MapValue<int>(TxtFromYear, typeof(int)), 1);
                    ClassReportStartDateTo   = Toyear;   // new DateTime(Toyear, UtilityFunctions.MapValue<int>(TxtFromYear, typeof(int)), 1);
                    ShowFutureClasses        = false;
                    DataTable dt = _PersonBAL.ClassFutureReport(CurrentCourseCategoryID, ClassReportStartDateFrom, ClassReportStartDateTo, ShowFutureClasses, ClassTypeID, CompanyId);
                    ReportViewer1.ProcessingMode         = ProcessingMode.Local;
                    ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/Tran_ClassReport.rdlc");
                    //  DataSet ds = GetTrainerDetailsForReports;
                    ReportDataSource datasource = new ReportDataSource("DS_ClassReportByCourseCategoryID", dt);
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(datasource);
                    ReportViewer1.LocalReport.Refresh();
                }
                else
                {
                    //BindDropDowns();
                    //   UCReport.ClearReport();
                }
            }
            catch (Exception Ex)
            {
            }
        }
Example #2
0
        //protected void JpegPng(object sender, EventArgs e)
        //{
        //    ReportViewerRSFReports.ProcessingMode = ProcessingMode.Local;
        //    ReportViewerRSFReports.LocalReport.ReportPath = Server.MapPath(@"../../../Report/Tran_ClassReport.rdlc");
        //    string reportType = "Image";
        //    string outputFormat = (sender as Button).Text.ToLower();
        //    byte[] renderedBytes;
        //    if (outputFormat == "jpg")
        //    {
        //        renderedBytes = ReportViewerRSFReports.LocalReport.Render(reportType, "<DeviceInfo><OutputFormat>JPG</OutputFormat></DeviceInfo>");
        //    }
        //    else
        //    {
        //        renderedBytes = ReportViewerRSFReports.LocalReport.Render(reportType, "<DeviceInfo><OutputFormat>PNG</OutputFormat></DeviceInfo>");
        //    }

        //    Response.Buffer = true;
        //    Response.Clear();
        //    Response.ContentType = "image/jpeg";
        //    Response.AddHeader("content-disposition", "attachment; filename=" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "." + outputFormat);
        //    Response.BinaryWrite(renderedBytes);
        //    Response.Flush();
        //}
        private void RenderReportModels(ReportData reportData, string courseid, string classid, string startDate)
        {
            reportDataG = reportData;
            long CompanyId = Convert.ToInt64(HttpContext.Current.Session["CompanyID"]);

            int      ClassID    = Convert.ToInt32(classid);
            long     CourseID   = Convert.ToInt64(courseid);
            DateTime Toyear     = new DateTime(2099, 12, 31);
            DateTime startdatet = DateTime.ParseExact(startDate, "dd/MM/yyyy",
                                                      CultureInfo.InvariantCulture);
            bool ShowFutureClasses = true;

            // Reset report properties.
            ReportViewerRSFReports.Height   = Unit.Parse("100%");
            ReportViewerRSFReports.Width    = Unit.Parse("100%");
            ReportViewerRSFReports.CssClass = "table";
            var rptPath = Server.MapPath(@"../../../Report/" + reportData.ReportName + ".rdlc");

            this.ReportViewerRSFReports.LocalReport.ReportPath = rptPath;
            //DataTable dt = _PersonBAL.GetClassDetailReportData(Convert.ToInt64(classid), Convert.ToInt64(courseid));
            DataTable dt = _PersonBAL.ClassFutureReport(CourseID, startdatet, Toyear, ShowFutureClasses, ClassID, CompanyId);

            ReportViewerRSFReports.ProcessingMode = ProcessingMode.Local;
            ReportViewerRSFReports.LocalReport.DataSources.Clear();
            ReportViewerRSFReports.LocalReport.EnableExternalImages = true;
            List <OrganizationModel> logoPath  = _PersonBAL.GetOrganizationLogo(Convert.ToInt64(HttpContext.Current.Session["CompanyID"]));
            ReportParameter          paramLogo = new ReportParameter();

            paramLogo.Name = "Path";
            string imagePath = new Uri(Server.MapPath(@"~/" + logoPath.FirstOrDefault().Logo)).AbsoluteUri;

            paramLogo.Values.Add(imagePath);
            ReportViewerRSFReports.LocalReport.SetParameters(paramLogo);
            ReportViewerRSFReports.LocalReport.DataSources.Add(new ReportDataSource("DS_ClassReportByCourseCategoryID", dt));
            ReportViewerRSFReports.LocalReport.Refresh();
            //ReportViewerRSFReports.RefreshReport();
            //// Clear out any previous datasources.
            //this.ReportViewerRSFReports.LocalReport.DataSources.Clear();

            //// Set report mode for local processing.
            //ReportViewerRSFReports.ProcessingMode = ProcessingMode.Remote;

            //// Validate report source.
            //var rptPath = Server.MapPath(@"../../../Report/" + reportData.ReportName + ".rdlc");

            ////@"E:\RSFERP_SourceCode\RASolarERP\RASolarERP\Reports\Report\" + reportData.ReportName + ".rdlc";
            ////Server.MapPath(@"./Report/ClosingInventory.rdlc");

            //if (!File.Exists(rptPath))
            //    return;

            //// Set report path.
            //this.ReportViewerRSFReports.LocalReport.ReportPath = rptPath;

            //// Set report parameters.
            //var rpPms = ReportViewerRSFReports.LocalReport.GetParameters();
            //foreach (var rpm in rpPms)
            //{
            //    var p = reportData.ReportParameters.SingleOrDefault(o => o.ParameterName.ToLower() == rpm.Name.ToLower());
            //    if (p != null)
            //    {
            //        ReportParameter rp = new ReportParameter(rpm.Name, p.Value);
            //        ReportViewerRSFReports.LocalReport.SetParameters(rp);
            //    }
            //}

            //////Set data paramater for report SP execution
            ////objClosingInventory = dal.ClosingInventoryReport(this.ReportDataObj.DataParameters[0].Value);

            ////// Load the dataSource.
            //// ReportViewerRSFReports.LocalReport.DataSources.Clear();
            ////var dsmems = ReportViewerRSFReports.LocalReport.GetDataSourceNames();
            //// ReportViewerRSFReports.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", objClosingInventory));
            //// ReportViewerRSFReports.RefreshReport();
            //// Refresh the ReportViewer.
            //DataTable dt = _CourseBAL.GetCourseReportData(ClassID, CourseID);
            //ReportViewerRSFReports.ProcessingMode = ProcessingMode.Local;
            ////ReportViewerRSFReports.LocalReport.ReportPath = Server.MapPath("~/Report/Tran_ViewCourseAttendanceReport.rdlc");
            ////  DataSet ds = GetTrainerDetailsForReports;
            //ReportViewerRSFReports.LocalReport.DataSources.Clear();
            ////ReportViewerRSFReports.Reset();
            //ReportDataSource datasource = new ReportDataSource("VewCourseAttendanceReportDataSet", dt);
            //ReportViewerRSFReports.LocalReport.DataSources.Add(datasource);


            //this.ReportViewerRSFReports.LocalReport.Refresh();
        }