public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, FilterEnabled filterEnabled) { var dashboard = new DevExpress.DashboardCommon.Dashboard(); try { if (!string.IsNullOrEmpty(template.Xml)) { dashboard = LoadFromXml(template); dashboard.ApplyModel(filterEnabled, template, objectSpace); } foreach (var typeWrapper in template.DashboardTypes.Select(wrapper => new { wrapper.Type, Caption = GetCaption(wrapper) })) { var wrapper = typeWrapper; var dsource = dashboard.DataSources.FirstOrDefault(source => source.Name.Equals(wrapper.Caption)); var objects = objectSpace.CreateDashboardDataSource(wrapper.Type); if (dsource != null) { dsource.Data = objects; } else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { dashboard.AddDataSource(typeWrapper.Caption, objects); } } } catch (Exception e) { dashboard.Dispose(); Tracing.Tracer.LogError(e); } return(dashboard); }
public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, FilterEnabled filterEnabled) { var dashboard = new DevExpress.DashboardCommon.Dashboard(); try { if (!string.IsNullOrEmpty(template.Xml)) { dashboard = LoadFromXml(template); dashboard.ApplyModel(filterEnabled, template, objectSpace); } foreach (var typeWrapper in template.DashboardTypes.Select(wrapper => new { wrapper.Type, Caption = GetCaption(wrapper) })) { var wrapper = typeWrapper; var dsource = dashboard.DataSources.FirstOrDefault(source => source.Name.Equals(wrapper.Caption)); var objects = objectSpace.CreateDashboardDataSource(wrapper.Type); if (dsource != null) { dsource.Data = objects; } else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) { dashboard.AddDataSource(typeWrapper.Caption, objects); } } } catch (Exception e) { dashboard.Dispose(); Tracing.Tracer.LogError(e); } return dashboard; }
private void btnTasarim_ItemClick(object sender, ItemClickEventArgs e) { //DevExpress.DashboardCommon.Dashboard dasboard = new DevExpress.DashboardCommon.Dashboard(); //var DosyaYolu = data.S_AyarKarakter(2, 1).ToList().FirstOrDefault().Deger + "dash.xml";//gv.GetRowCellValue(iRowID, "DosyaAdi").ToString() + ".xml"; //if (DosyaYolu == null) // return; //byte[] bytearry = data.S_DosyaGet(DosyaYolu).FirstOrDefault(); //if (bytearry != null) //{ // Stream RepData = Genel.ByteArrayToStream(bytearry); // dasboard.LoadFromXml(RepData); //} ////DataSet datasourcelist = Ayar.DsGetir(iSelectedReportID, 1, 1, 1, 1, 1, 1, 1, 1, 1, 99, true); //////dasboard.DataSources.Clear(); ////foreach (DataTable item in datasourcelist.Tables) ////{ //// if (dasboard.DataSources.Where(z => z.Name == item.TableName).FirstOrDefault() == null) //// { //// dasboard.AddDataSource(item.TableName, item); //// } ////} ////dasboard.DataLoading += dasboard_DataLoading; //DashboardTasarim frm = new DashboardTasarim(dasboard); //frm.Show(); #region Dashboard var DosyaYolu = data.S_AyarKarakter(2, 1).FirstOrDefault().Deger + DosyaAdi + ".xml"; byte[] bytearry = data.S_DosyaGet(DosyaYolu).FirstOrDefault(); if (bytearry != null) { Stream RepData = Genel.ByteArrayToStream(bytearry); DevExpress.DashboardCommon.Dashboard dasboard = new DevExpress.DashboardCommon.Dashboard(); dasboard.LoadFromXml(RepData); DataSet datasourcelist = Genel.DsGetir(DashboardID, true); //dasboard.DataSources.Clear(); foreach (DataTable item in datasourcelist.Tables) { if (dasboard.DataSources.Where(z => z.Name == item.TableName).FirstOrDefault() == null) { dasboard.AddDataSource(item.TableName, item); } } dasboard.DataLoading += dasboard_DataLoading; DashboardTasarim rep = new DashboardTasarim(dasboard); rep.ShowDialog(); if (rep.SaveDashboard) { MemoryStream stream = new MemoryStream(); rep.Dashboard.SaveToXml(stream); stream.Position = 0; byte[] RaporData = Genel.StreamToByteArray(stream); data.IUD_Evraklar(4, DashboardID, RaporData, null, null, null, null, null, null, null, null, true, Genel.AktifKullaniciID); } } #endregion }