static bool ResolveNamesConflict(IDashboardDataSource dataSourceCopy, DataSourceCollection toDataSources, IDictionary <string, string> dataSourceNamesMap) { // Provide your data source component names confilict resolution logic here string newName = NamesGenerator.GenerateName(dataSourceCopy.ComponentName, 1, toDataSources.Select(ds => ds.ComponentName)); dataSourceNamesMap.Add(dataSourceCopy.ComponentName, newName); dataSourceCopy.ComponentName = newName; return(true); }
public DataSchema(CubeConfig config, DataSourceCollection datasources, IMemberStorage <T, Dimension <T> > dimstorage, IMemberStorage <T, Measure <T> > messtorage, IMemberStorage <T, Metric <T> > metstorage) : this(dimstorage, messtorage, metstorage) { _datasources = datasources; this.Config = config.MetaData; this.Initialize(); }
public static void MergeDataSources(DataSourceCollection fromDataSources, DashboardMerger dashboardMerger) { DataSourceCollection toDataSources = dashboardMerger.TargetDashboard.DataSources; foreach (IDashboardDataSource dataSource in fromDataSources) { AddDataSourceCopy(dataSource, dashboardMerger, (dataSourceCopy) => { toDataSources.Add(dataSourceCopy); }); } }
private DataSource PrepareDataSource(string aFileName) { DataSourceAnalyser analyser = HeapReconstructorDataSourceAnalyserDialog.Analyse(aFileName); DataSourceCollection sources = analyser.DataSources; DataSource source = sources[iInputs.ThreadName]; if (source == null) { throw new HAUIException("Thread was not found in source data", HAUIException.KErrCommandLineAnalysisThreadNameInvalid); } // return(source); }
private void SeedAnalysisFiltersAfterDataSourceScan(DataSourceCollection aSources, ComboBox aCombo) { // Thread filtering - seed with detected threads aCombo.BeginUpdate(); aCombo.Items.Clear(); foreach (DataSource source in aSources) { bool allowSource = true; bool containsErrors = CheckSourceForErrors(source, out allowSource); if (!containsErrors || allowSource) { aCombo.Items.Add(source); } } // Make sure something is selected if (aCombo.Items.Count > 0) { iErrorProvider.SetError(aCombo, string.Empty); int selectedThreadIndex = 0; // If the user has picked a thread previously, try to select the same one // again this time. string lastSelectedThread = iSettings["Wizard", aCombo.Name]; if (lastSelectedThread.Length > 0) { int index = aSources.IndexOf(lastSelectedThread); if (index >= 0) { selectedThreadIndex = index; } } // Now pick the thread... aCombo.SelectedIndex = selectedThreadIndex; } else { iErrorProvider.SetError(aCombo, "No thread's were detected. Is the log corrupt?"); } aCombo.Enabled = (aCombo.Items.Count > 1); aCombo.EndUpdate(); }
static void AddDataSourceCopy(IDashboardDataSource dataSource, DashboardMerger dashboardMerger, Action <IDashboardDataSource> addDataSourceDelegate) { DataSourceCollection toDataSources = dashboardMerger.TargetDashboard.DataSources; IDictionary <string, string> dataSourceNamesMap = dashboardMerger.DataSourceNamesMap; IDashboardDataSource dataSourceCopy = CreateDataSourceCopy(dataSource); if (dataSourceCopy != null) { if (toDataSources.Any(d => d.ComponentName == dataSourceCopy.ComponentName)) { if (ResolveNamesConflict(dataSourceCopy, toDataSources, dataSourceNamesMap)) { addDataSourceDelegate(dataSourceCopy); } } else { addDataSourceDelegate(dataSourceCopy); } } }
public DataSourceCollection GetAvailableDataSource(DataSourceProvideArgs args) { DataSourceCollection collection = new DataSourceCollection(); if (args == null || args.WindowEntity == null) { Debug.Assert(false, "args.WindowEntity 为空"); return(collection); } WindowEntity window = args.WindowEntity; foreach (var item in window.GetFormElement()) { if (item.DataSourceUseable) { UIElementDataSoure dataSource = new UIElementDataSoure(item); collection.Add(dataSource); } } return(collection); }
public void LoadDashboard(DashboardImage _dashboardImage, DashboardViewer dashboardViewer1) { using (var ctx = new ReportContext()) { string path = LoadToChache(_dashboardImage); Dashboard ds = new Dashboard(); ds.LoadFromXml(path); DataSourceCollection dsCollection = ds.DataSources; var appConf = new AppConfigIts(ctx.NameOrConnectionString); foreach (DashboardSqlDataSource dsSql in dsCollection) { ReportUtil.SetParamDataSource(dsSql, appConf); } dashboardViewer1.Dashboard = ds; dashboardViewer1.ReloadData(); } }
static void AddItemCopy(DashboardItem originalItem, DashboardMerger dashboardMerger, Action <DashboardItem> addItemDelegate) { DashboardItemCollection toItems = dashboardMerger.OriginalDashboard.Items; IDictionary <string, string> dataSourceNamesMap = dashboardMerger.DataSourceNamesMap; DataSourceCollection existingDataSources = dashboardMerger.OriginalDashboard.DataSources; DashboardItem dashboardItemCopy = originalItem.CreateCopy(); bool shouldAddItem = false; if (toItems.Any(item => item.ComponentName == originalItem.ComponentName)) { if (ResolveDashboardItemNameConflict(dashboardItemCopy, originalItem.ComponentName, toItems, dashboardMerger.DashboardItemNamesMap)) { shouldAddItem = true; } } else { dashboardItemCopy.ComponentName = originalItem.ComponentName; shouldAddItem = true; } if (shouldAddItem) { DataDashboardItem dataDashboardItem = dashboardItemCopy as DataDashboardItem; if (dataDashboardItem != null && dataDashboardItem.DataSource != null) { string newDataSourceName = String.Empty; if (!dataSourceNamesMap.TryGetValue(dataDashboardItem.DataSource.ComponentName, out newDataSourceName)) { newDataSourceName = dataDashboardItem.DataSource.ComponentName; } dataDashboardItem.DataSource = existingDataSources[newDataSourceName]; } addItemDelegate(dashboardItemCopy); } }
/// <summary> /// 将除Link以外的信息保存至变量scModel中,包括ServiceInfo,和DataSource /// 初始化LinkID TextBox,将要显示的ID存于隐藏label中 /// scModel 存入ViewState /// Enable Link 环节 /// Disable ServiceInfo和DataSource 环节 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void b_SaveName_Click(object sender, EventArgs e) { ServiceInfo si = new ServiceInfo(); si.ServiceName = tb_ServiceName.Text.Trim(); si.ServiceID = lb_BID.Text.Trim(); si.ServiceType = ddl_SCType.SelectedValue; //上游业务ID si.SourceID = tb_SourceID.Text.Trim(); //所属业务群 string servicegroup = ""; string sort = ""; for (int i = 0; i < chkblServiceGroup.Items.Count; i++) { if (chkblServiceGroup.Items[i].Selected) { sort = i.ToString(); if (i < 10) { sort = "0" + sort; } servicegroup = servicegroup + sort + ","; } } if (servicegroup.Length > 0) { servicegroup = servicegroup.Substring(0, servicegroup.LastIndexOf(',')); } si.ServiceGroup = servicegroup; scModel.ServiceInfo = si; //采集类数据源 if (ddl_Data_Type.SelectedValue == "0") { scModel.DataSourceType = ddl_Data_Type.SelectedValue; DataSourceCollection dsc = new DataSourceCollection(); //dsc.DataSourceType = ddl_Data_Type.SelectedValue; //采集,则存0 dsc.CollectionDescription = tb_DataSourceDescription.Text.Trim(); dsc.StartTimeValue = tb_Des_1.Text.Trim(); dsc.PeriodValue = tb_Des_2.Text.Trim(); dsc.StartTimeDescription = s_StartTime_Tip; //"hh:mm:ss"; dsc.PeriodDescription = s_PeriodTime_Tip; // "second,0s means just once"; scModel.DataSource = dsc; } //监控类数据源 else if (ddl_Data_Type.SelectedValue == "1") { scModel.DataSourceType = ddl_Data_Type.SelectedValue; DataSourceNotify dsn = new DataSourceNotify(); //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1 dsn.NotifyDescription = tb_DataSourceDescription.Text.Trim(); dsn.PathsValue = tb_Des_1.Text.Trim(); dsn.FilesValue = tb_Des_2.Text.Trim(); dsn.PathDescription = s_FileDir_Tip; //"要监控的文件目录"; dsn.FilesDescription = s_File_Tip; // "需要的数据源文件,可用${yyyyMMddHH}时间通配符"; //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示; dsn.GetPathFileMateFromString(dsn.PathsValue, dsn.FilesValue, dsn.PathDescription, dsn.FilesDescription); //20160308 syy //上游业务ID和所属业务群 scModel.DataSource = dsn; } //外部类数据源 else if (ddl_Data_Type.SelectedValue == "2") { scModel.DataSourceType = ddl_Data_Type.SelectedValue; DataSourceOuter dso = new DataSourceOuter(); //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1 dso.OuterDescription = tb_DataSourceDescription.Text.Trim(); dso.OuterPathValue = tb_Des_1.Text.Trim(); dso.OuterFileValue = tb_Des_2.Text.Trim(); dso.OuterPathDes = s_FileDir_Tip; //"要监控的文件目录"; dso.OuterFileDes = s_File_Tip; // "需要的数据源文件,可用${yyyyMMddHH}时间通配符"; //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示; //dso.GetPathFileMateFromString(dso.PathsValue, dso.FilesValue, dso.PathDescription, dso.FilesDescription); //20160308 syy scModel.DataSource = dso; } ViewState["scModel"] = scModel; // scModel 存入ViewState //初始化LinkID TextBox,将要显示的ID存于隐藏label中s lb_hide_linkid.Text = (lb_BID.Text.Trim()) + "000"; if (ddl_Data_Type.SelectedValue == "2") { b_Save.Enabled = true; } //Enable Link 环节 else { EnabledLinkTB(true); b_Add.Enabled = true; ResetLinkTB(lb_hide_linkid.Text); } //Disable ServiceInfo和DataSource 环节 EnabledSITB(false); }
public DataSourceCollectionWrapper(DataSourceCollection dataSourceCollection) { _dataSourceCollection = dataSourceCollection; }
public ReportTemplate() { DataSources = new DataSourceCollection(); Sections = new SectionCollection(); }
/// <summary> /// 填充页面 /// </summary> /// <param name="scModel"></param> protected void FillWebPage(SCModel scModel) { if (scModel.ServiceInfo == null) { FillWebPanel("-1"); } else { tb_Bid.Text = scModel.ServiceInfo.ServiceID; lb_BType.Text = scModel.ServiceInfo.ServiceTypeName; tb_ServiceName.Text = scModel.ServiceInfo.ServiceName; tb_SourceID.Text = scModel.ServiceInfo.SourceID; //填充所属业务群 //先取消所有选中项 chkblServiceGroup.ClearSelection(); //获取数据库中业务群信息 string servicegroup = scModel.ServiceInfo.ServiceGroup; //若不为空,则进行填充 if (servicegroup.Length > 0) { string[] servicegroupsingle = servicegroup.Split(','); for (int i = 0; i < servicegroupsingle.Length; i++) { if (servicegroupsingle[i].Substring(0, 1) == "0") { servicegroupsingle[i] = servicegroupsingle[i].Substring(1); } chkblServiceGroup.Items[int.Parse(servicegroupsingle[i])].Selected = true; } } //数据源类型 if (scModel.DataSourceType == "0") { DataSourceCollection dsc = (DataSourceCollection)scModel.DataSource; lb_datasource.Text = scModel.DataSourceName; tb_DataSourceDescription.Text = dsc.CollectionDescription; tb_Des_1.Text = dsc.StartTimeValue; tb_Des_2.Text = dsc.PeriodValue; CreateCorN(scModel.DataSourceType); } //数据源类型 else if (scModel.DataSourceType == "1") { DataSourceNotify dsn = (DataSourceNotify)scModel.DataSource; lb_datasource.Text = scModel.DataSourceName; tb_DataSourceDescription.Text = dsn.NotifyDescription; tb_Des_1.Text = dsn.PathsValue; tb_Des_2.Text = dsn.FilesValue; CreateCorN(scModel.DataSourceType); } else { DataSourceOuter dso = (DataSourceOuter)scModel.DataSource; lb_datasource.Text = scModel.DataSourceName; tb_DataSourceDescription.Text = dso.OuterDescription; tb_Des_1.Text = dso.OuterPathValue; tb_Des_2.Text = dso.OuterFileValue; CreateCorN(scModel.DataSourceType); } int link_count = scModel.SCLinks.Count; if (link_count != 0) { tb_LinkID.Text = (Convert.ToDouble(scModel.SCLinks[link_count - 1].LinkID) + 1).ToString(); } else { tb_LinkID.Text = scModel.ServiceInfo.ServiceID + "000"; } //tb_Description.Text = scModel.SCLinks[0].Description; //tb_Order.Text = scModel.SCLinks[0].Order; //tb_TopicLink.Text = scModel.SCLinks[0].TopicLink; tb_Description.Text = ""; tb_Order.Text = ""; tb_TopicLink.Text = ""; gvItem.DataSource = scModel.SCLinks; gvItem.DataBind(); lb_hide_linkid.Text = tb_LinkID.Text; //FillOptByRole("0"); FillWebPanel(rbl_ops.SelectedValue); EnableTextBox(rbl_ops.SelectedValue); VisibleGridViewOpt(rbl_ops.SelectedValue); } }
private static void ParseDataSourcesInto(IDependencyResolver dependencyResolver, XElement node, DataSourceCollection list) { foreach (XElement elmSource in node.Elements("source")) { DataSource source = new DataSource(); source.Name = GetAttribute(elmSource, "name", string.Empty); source.Provider = TryCreateInstance <IDataProvider>(dependencyResolver, GetAttribute(elmSource, "provider", string.Empty)); foreach (XAttribute att in elmSource.Attributes()) { switch (att.Name.LocalName) { case "name": case "provider": source.Set(att.Name.LocalName, att.Value); continue; default: source.Provider.Set(att.Name.LocalName, att.Value); break; } } foreach (XElement elm in elmSource.Elements()) { source.Provider.Set(elm.Name.LocalName, elm.Value); } list.Set(source); } }
/// <summary> /// 数据库信息提取 /// </summary> /// <param name="code">code</param> /// <param name="business_id">业务id</param> protected void GetSCDetail(string code, string business_id) { //SCModel scModel = new SCModel(); SCDB odb = new SCDB(); DataTable dt_businesstype = new DataTable(); dt_businesstype = odb.GetBTNameByBusinessCode(code); DataTable dt_business = new DataTable(); dt_business = odb.GetSCDetailByBusinessCode(code, business_id); if (dt_business != null && dt_business.Rows.Count == 1) { ServiceInfo si = new ServiceInfo(); si.GetServiceInfoFromDT(dt_business); si.ServiceTypeName = dt_businesstype.Rows[0][1].ToString(); scModel.ServiceInfo = si; scModel.DataSourceType = dt_business.Rows[0][3].ToString(); if (scModel.DataSourceType == "0") { DataSourceCollection dsc = new DataSourceCollection(); dsc.GetDataSourceFromDT(dt_business); scModel.DataSource = dsc; scModel.DataSourceName = "采集"; } else if (scModel.DataSourceType == "1") { DataSourceNotify dsn = new DataSourceNotify(); dsn.GetDataSourceFromDT(dt_business); scModel.DataSource = dsn; scModel.DataSourceName = "监控"; } else { DataSourceOuter dso = new DataSourceOuter(); dso.GetDataSourceFromDT(dt_business); scModel.DataSource = dso; scModel.DataSourceName = "外部"; } } DataTable dt_links = new DataTable(); dt_links = odb.GetSCLinksByServiceID(code, business_id); List <SCLink> scList = new List <SCLink>(); for (int i = 0; i < dt_links.Rows.Count; i++) { SCLink scLink = new SCLink(); scLink.LinkID = dt_links.Rows[i][0].ToString(); scLink.Description = dt_links.Rows[i][1].ToString(); scLink.Order = dt_links.Rows[i][2].ToString(); scLink.TopicLink = dt_links.Rows[i][3].ToString(); scLink.NextLinks = scLink.ChangeToTopicLinkList(); //变成list,以便生成xml scList.Add(scLink); } scModel.SCLinks = scList; //return scModel; }
/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void b_Save_Click(object sender, EventArgs e) { scModel = ViewState["scModel"] as SCModel; ServiceInfo si = new ServiceInfo(); si.ServiceName = tb_ServiceName.Text.Trim(); si.ServiceID = scModel.ServiceInfo.ServiceID; si.ServiceType = scModel.ServiceInfo.ServiceID.Substring(0, 2); //上游业务ID si.SourceID = tb_SourceID.Text.Trim(); //所属业务群 string servicegroup = ""; string sort = ""; for (int i = 0; i < chkblServiceGroup.Items.Count; i++) { if (chkblServiceGroup.Items[i].Selected) { sort = i.ToString(); if (i < 10) { sort = "0" + sort; } servicegroup = servicegroup + sort + ","; } } if (servicegroup.Length > 0) { servicegroup = servicegroup.Substring(0, servicegroup.LastIndexOf(',')); } si.ServiceGroup = servicegroup; scModel.ServiceInfo = si; //采集类数据源 if (scModel.DataSourceType == "0") { //scModel.DataSourceType = scModel.DataSourceType; DataSourceCollection dsc = new DataSourceCollection(); //dsc.DataSourceType = ddl_Data_Type.SelectedValue; //采集,则存0 dsc.CollectionDescription = tb_DataSourceDescription.Text.Trim(); dsc.StartTimeValue = tb_Des_1.Text.Trim(); dsc.PeriodValue = tb_Des_2.Text.Trim(); dsc.StartTimeDescription = s_StartTime_Tip; //"hh:mm:ss"; dsc.PeriodDescription = s_PeriodTime_Tip; // "second,0s means just once"; scModel.DataSource = dsc; } //监控类数据源 else if (scModel.DataSourceType == "1") { //scModel.DataSourceType = scModel.DataSourceType; DataSourceNotify dsn = new DataSourceNotify(); //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1 dsn.NotifyDescription = tb_DataSourceDescription.Text.Trim(); dsn.PathsValue = tb_Des_1.Text.Trim(); dsn.FilesValue = tb_Des_2.Text.Trim(); dsn.PathDescription = s_FileDir_Tip; //"要监控的文件目录"; dsn.FilesDescription = s_File_Tip; // "需要的数据源文件,可用${yyyyMMddHH}时间通配符"; //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示; dsn.GetPathFileMateFromString(dsn.PathsValue, dsn.FilesValue, dsn.PathDescription, dsn.FilesDescription); //20160308 syy scModel.DataSource = dsn; } //外部类数据源 else if (scModel.DataSourceType == "2") { DataSourceOuter dso = new DataSourceOuter(); //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1 dso.OuterDescription = tb_DataSourceDescription.Text.Trim(); dso.OuterPathValue = tb_Des_1.Text.Trim(); dso.OuterFileValue = tb_Des_2.Text.Trim(); dso.OuterPathDes = s_FileDir_Tip; //"要监控的文件目录"; dso.OuterFileDes = s_File_Tip; // "需要的数据源文件,可用${yyyyMMddHH}时间通配符"; //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示; //dso.GetPathFileMateFromString(dso.PathsValue, dso.FilesValue, dso.PathDescription, dso.FilesDescription); //20160308 syy scModel.DataSource = dso; } bool dbsave = false; //采集数据 if (scModel.DataSourceType == "0") { SCDB scDB = new SCDB(); dbsave = scDB.UpdateSCCollectionModel(scModel, user); SCCollectionXML sccxml = new SCCollectionXML(); sccxml.CreateXML(scModel, xml_BusinessConfig_Path);// "d:/template/" } //监控数据 else if (scModel.DataSourceType == "1") { SCDB scDB = new SCDB(); dbsave = scDB.UpdateSCNotifyModel(scModel, user); SCNotifyXML scnxml = new SCNotifyXML(); scnxml.CreateXML(scModel, xml_BusinessConfig_Path); // "d:/template/" } //外部数据 else if (scModel.DataSourceType == "2") { SCDB scDB = new SCDB(); dbsave = scDB.UpdateSCOuterModel(scModel, user); SCOuterXML scnxml = new SCOuterXML(); scnxml.CreateXML(scModel, xml_BusinessConfig_Path); // "d:/template/" } //判断是否成功,跳转页面 string filesave = xml_BusinessConfig_Path + scModel.ServiceInfo.ServiceID + ".xml"; if (dbsave && File.Exists(filesave)) { lb_updatesuccess.Text = "业务更新成功!"; } else { lb_updatesuccess.Text = "业务更新失败!"; } }