public static void CreateReport(IObjectSpace os, String name, Stream stream) { XafExtReportData reportdata = os.FindObject <XafExtReportData>(new BinaryOperator("FileName", name), true); if (reportdata == null) { reportdata = os.CreateObject <XafExtReportData>(); XafReport rep = new XafReport() { ReportName = name, ObjectSpace = os }; rep.LoadLayout(stream); reportdata.SaveXtraReport(rep); reportdata.FileName = name; // reportdata.Save(); } else { XafReport rep = new XafReport() { ReportName = name, ObjectSpace = os }; rep.LoadLayout(stream); reportdata.SaveXtraReport(rep); } }
private void ShowReport(string reportMode) { CriteriaOperator criteria = ((fmCRHUnpayedRequest)View.CurrentObject).GetCriteria(); // Определяем тип объектов отчёта Type dsType = typeof(fmCRHUnpayedRequestContractLine); // Получаем название файла (без расширения, которое всегда .repx) разметки отчёта string reportFileName = "fmCRHUnpayedRequestLine"; // Создаём для отчёта отдельный ObjectSpace IObjectSpace objectSpace = Application.CreateObjectSpace(); // Создаём объект, чтобы вызвать в нём метод фомирования коллекции fmCRHUnpayedRequest obj = View.CurrentObject as fmCRHUnpayedRequest; if (obj == null) { return; } // Находим сессию Session ssn = ((ObjectSpace)objectSpace).Session; string fname = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; FileInfo fi = new FileInfo(fname); string checkDir = fi.Directory.FullName + "\\Reports\\"; // http://www.devexpress.com/Support/Center/p/Q135993.aspx //XafExtReport rep = new XafExtReport(); XafReport rep = new XafReport(); rep.LoadLayout(checkDir + reportFileName + ".repx"); if (reportMode == "Short") { for (int i = 0; i < rep.Bands.Count; i++) { if (rep.Bands[i].Name == "detailBand1") { rep.Bands[i].Visible = false; } } } rep.DataSource = obj.CreateReportListSource(ssn, criteria); //rep.ShowDesignerDialog(); rep.ShowPreview(); }
private void CreateReport(string reportName) { ReportData reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = ObjectSpace.CreateObject <ReportData>(); XafReport rep = new XafReport(); rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream(String.Format("LCap.Module.Reportes.{0}.repx", reportName))); rep.ReportName = reportName; reportdata.SaveReport(rep); } }
private void CreateReport(String reportName, Type dataType) { ReportData_EF reportdata = ObjectSpace.FindObject<ReportData_EF>(new BinaryOperator("ReportName", reportName)); if(reportdata == null) { reportdata = ObjectSpace.CreateObject<ReportData_EF>(); XafReport rep = new XafReport(); rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream("EFDemo.Module.EmbeddedReports." + reportName + ".repx")); rep.ReportName = reportName; rep.DataType = dataType; if(dataType == typeof(DemoTask)) { rep.Filtering.Filter = "[AssignedTo] = ?"; } reportdata.SaveReport(rep); reportdata.IsInplaceReport = true; } }
private void CreateReport(string reportName) { ReportData reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = ObjectSpace.CreateObject <ReportData>(); XafReport rep = new XafReport(); rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream( "WinSolution3.Module.SavedReports." + reportName + ".repx")); rep.ReportName = reportName; reportdata.SaveReport(rep); reportdata.Save(); } }
private void CreateReport(string reportName) { ReportData reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = ObjectSpace.CreateObject <ReportData>(); XafReport rep = new XafReport(); rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream(this.GetType().Namespace + "." + reportName + ".repx")); rep.ReportName = reportName; reportdata.SaveReport(rep); reportdata.IsInplaceReport = true; reportdata.Save(); } }
private void CreateReport(string reportName, Type type) { UpdateStatus("CreateReport", "", string.Format("Creating reports: {0}", reportName)); UpdateStatus("CreateReport", "", string.Format("Creating reports: {0}", reportName)); var reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = ObjectSpace.CreateObject <ReportData>(); var rep = new XafReport { ObjectSpace = ObjectSpace }; rep.LoadLayout(GetResourceStream(reportName + ".repx")); rep.DataType = type; rep.ReportName = reportName; reportdata.SaveReport(rep); } }
public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); string reportName = "TestReport"; string[] resources = GetType().Assembly.GetManifestResourceNames(); string reportResourceName = Array.Find <string>(resources, IsTestReport); ReportData reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null && !string.IsNullOrEmpty(reportResourceName)) { reportdata = ObjectSpace.CreateObject <ReportData>(); XafReport rep = new XafReport(); rep.ReportName = reportName; rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream(reportResourceName)); reportdata.SaveReport(rep); reportdata.Save(); } }
private void CreateReport(String reportName, Type dataType) { ReportData reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("ReportName", reportName)); if (reportdata == null) { reportdata = ObjectSpace.CreateObject <ReportData>(); XafReport rep = new XafReport(); rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream("EFDemo.Module.EmbeddedReports." + reportName + ".repx")); rep.ReportName = reportName; rep.DataType = dataType; if (dataType == typeof(DemoTask)) { rep.Filtering.Filter = "[AssignedTo] = ?"; } reportdata.SaveReport(rep); reportdata.IsInplaceReport = true; } }
public virtual XafReport LoadXtraReport(IObjectSpace objectSpace) { XafReport result = CreateReport(); result.ObjectSpace = objectSpace; if ((Content != null) && (Content.Length > 0)) { int realLength = Content.Length; while (Content[realLength - 1] == 0) { realLength--; } MemoryStream stream = new MemoryStream(Content, 0, realLength); result.CustomDeserializeValue += new EventHandler <CustomDeserializeValueEventArgs>(result_CustomDeserializeValue); result.LoadLayout(stream); ReportDesignExtension.AssociateReportWithExtension(result, XafReport.XafReportContextName); stream.Close(); } result.ReportName = reportName; return(result); }
private void importReport(String reportName) { ReportData reportdata = Session.FindObject <ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = new ReportData(Session); } reportdata.IsInplaceReport = false; using (XafReport rep = new XafReport { ReportName = reportName, ObjectSpace = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance) }) { rep.LoadLayout(GetType().Assembly.GetManifestResourceStream(String.Format("AIR_ERP.Module.AR.Reports.{0}.repx", reportName))); reportdata.SaveXtraReport(rep); } reportdata.Save(); //XafReport rep = new XafReport(); //rep.ReportName = reportName; //rep.ObjectSpace = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance); //rep.LoadLayout(GetType().Assembly.GetManifestResourceStream("AIR_ERP.Module.AR.Reports." + reportName + ".repx")); //reportdata.SaveXtraReport(rep); //reportdata.Save(); }
private void CreateReport(string reportName) { ReportData reportdata = Session.FindObject <ReportData>( new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = new ReportData(Session); XafReport rep = new XafReport(); rep.LoadLayout(GetType().Assembly.GetManifestResourceStream( "vidoSolution.Module.EmbeddedReports." + reportName + ".repx")); rep.ReportName = reportName; reportdata.SaveXtraReport(rep); reportdata.Save(); } else { XafReport rep = new XafReport(); rep.LoadLayout(GetType().Assembly.GetManifestResourceStream( "vidoSolution.Module.EmbeddedReports." + reportName + ".repx")); reportdata.SaveXtraReport(rep); reportdata.Save(); } }
private void importReport(String reportName) { ReportData reportdata = Session.FindObject<ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = new ReportData(Session); } reportdata.IsInplaceReport = false; using (XafReport rep = new XafReport { ReportName = reportName, ObjectSpace = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance) }) { rep.LoadLayout(GetType().Assembly.GetManifestResourceStream(String.Format("AIR_ERP.Module.AR.Reports.{0}.repx", reportName))); reportdata.SaveXtraReport(rep); } reportdata.Save(); //XafReport rep = new XafReport(); //rep.ReportName = reportName; //rep.ObjectSpace = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance); //rep.LoadLayout(GetType().Assembly.GetManifestResourceStream("AIR_ERP.Module.AR.Reports." + reportName + ".repx")); //reportdata.SaveXtraReport(rep); //reportdata.Save(); }
/// <summary> /// Отчеты /// </summary> private void CreateBuiltInReport(string BuiltInIdentifier, string ReportName, bool LockedInUserDisigner = true, bool IsInplaceReport = true, bool AllowToEdit = false, bool ShowInView = true) { var ReportData = ObjectSpace.FindObject<CustomReportData>(new BinaryOperator("BuiltInIdentifier", BuiltInIdentifier)); if (ReportData == null) { string file = Path.Combine(Configuration.Config.ReportsPath, BuiltInIdentifier); if (File.Exists(file) == false) return; Stream stream = null; try { stream = File.OpenRead(file); ReportData = ObjectSpace.CreateObject<CustomReportData>(); ReportData.AllowToEdit = AllowToEdit; ReportData.ShowInView = ShowInView; ReportData.IsInplaceReport = IsInplaceReport; ReportData.BuiltInIdentifier = BuiltInIdentifier; ReportData.ReportName = ReportName; XafReport report = new XafReport() { ObjectSpace = this.ObjectSpace, LockedInUserDesigner = LockedInUserDisigner }; report.LoadLayout(stream); report.ReportName = ReportName; ReportData.SaveReport(report); } catch (Exception exception) { DevExpress.Persistent.Base.Tracing.Tracer.LogError(exception); } finally { if (stream != null) { stream.Close(); stream = null; } } } if (this.ObjectSpace.IsModified == true) this.ObjectSpace.CommitChanges(); }
private void CreateReport(string reportName, Type type) { ApplicationStatusUpdater.Notify("CreateReport", string.Format("Creating reports: {0}", reportName)); var reportdata = ObjectSpace.FindObject<ReportData>(new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = ObjectSpace.CreateObject<ReportData>(); var rep = new XafReport { ObjectSpace = ObjectSpace }; rep.LoadLayout(GetReportStream(reportName)); rep.DataType = type; rep.ReportName = reportName; reportdata.SaveReport(rep); } }
private void CreateReport(string reportName) { ReportData reportdata = ObjectSpace.FindObject<ReportData>(new BinaryOperator("Name", reportName)); if(reportdata == null) { reportdata = ObjectSpace.CreateObject<ReportData>(); XafReport rep = new XafReport(); rep.ObjectSpace = ObjectSpace; rep.LoadLayout(GetType().Assembly.GetManifestResourceStream( "MainDemo.Module.EmbeddedReports." + reportName + ".repx")); rep.ReportName = reportName; reportdata.SaveReport(rep); reportdata.IsInplaceReport = true; } }
private void CreateReport(string reportName) { ReportData reportdata = Session.FindObject<ReportData>( new BinaryOperator("Name", reportName)); if (reportdata == null) { reportdata = new ReportData(Session); XafReport rep = new XafReport(); rep.LoadLayout(GetType().Assembly.GetManifestResourceStream( "vidoSolution.Module.EmbeddedReports." + reportName + ".repx")); rep.ReportName = reportName; reportdata.SaveXtraReport(rep); reportdata.Save(); } else { XafReport rep = new XafReport(); rep.LoadLayout(GetType().Assembly.GetManifestResourceStream( "vidoSolution.Module.EmbeddedReports." + reportName + ".repx")); reportdata.SaveXtraReport(rep); reportdata.Save(); } }