public IVersionInfo GetCurrentVersion(IResource newResource, IVersionInfo oldresource, string userName, string reason) { if (oldresource == null) return new VersionInfo(DateTime.Now, reason, userName, (1).ToString(CultureInfo.InvariantCulture), newResource.ResourceID, Guid.NewGuid()); // ReSharper disable PossibleNullReferenceException return new VersionInfo(DateTime.Now, reason, userName, (1 + int.Parse(oldresource.VersionNumber)).ToString(CultureInfo.InvariantCulture), oldresource.ResourceId, oldresource.VersionId); }
private void AddVersionToTree(IVersionInfo pVersionInfo, TreeNode pParentNode) { IEnumVersionInfo pEnumVersionInfo; TreeNode pNode; if (pParentNode == null) pNode = treeViewVersion.Nodes.Add(pVersionInfo.VersionName, pVersionInfo.VersionName); pEnumVersionInfo=pVersionInfo.Children; pVersionInfo=pEnumVersionInfo.Next(); }
public IVersionInfo GetCurrentVersion(IResource newResource, IVersionInfo oldresource, string userName, string reason) { if (oldresource == null) { return(new VersionInfo(DateTime.Now, reason, userName, 1.ToString(CultureInfo.InvariantCulture), newResource.ResourceID, Guid.NewGuid())); } // ReSharper disable PossibleNullReferenceException return(new VersionInfo(DateTime.Now, reason, userName, (1 + int.Parse(oldresource.VersionNumber)).ToString(CultureInfo.InvariantCulture), oldresource.ResourceId, oldresource.VersionId)); }
/// <summary> /// 提交当前版本(经过仲裁) /// </summary> /// <param name="pWorkspace">工作区</param> /// <param name="sVersion">父版本名称</param> public static void PostVerison(IWorkspace pWorkspace, string sVersion) { IVersion pVersion = (IVersion)pWorkspace; if (!IsLocked(pVersion)) { throw new Exception("不能提交数据到父版本,其它用户正在编辑"); } IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pVersion; if (!pWorkspaceEdit.IsBeingEdited()) { throw new Exception("请开始编辑会话"); } IVersionEdit pVersionEdit = (IVersionEdit)pVersion; IVersionInfo pVersionInfo = pVersion.VersionInfo; try { string sParentName = pVersionInfo.VersionName; bool bConflicts = pVersionEdit.Reconcile(sParentName); if (bConflicts) { pWorkspaceEdit.StopEditing(true); } else { if (pVersionEdit.CanPost()) { pVersionEdit.Post(sParentName); pWorkspaceEdit.StopEditing(true); } else { pWorkspaceEdit.StopEditing(true); // false //MessageBox.Show("不能提交数据到父版本[" + sParentName + "]"); } } } catch (Exception ex) { throw ex; } finally { if (pWorkspaceEdit.IsBeingEdited()) { pWorkspaceEdit.StopEditing(true); // false } pWorkspaceEdit.StartEditing(true); } }
public UpdateSever(string Url,string Method,string PostData,MyDeleGetInfo Callback,string OldDt,bool Canuseold) : base(Url,Method,PostData,Callback) { oldDt = OldDt; CanUseOld = Canuseold; version = base.GetUpdateVersionInfo; TimeSpan ts=new TimeSpan (DateTime.Parse(version.LatestDt).Ticks-DateTime.Parse(oldDt).Ticks); if (ts.Ticks > 0) needUpdate = true; else needUpdate = false; }
private void AddVersionToTree(IVersionInfo pVersionInfo, TreeNode pParentNode) { IEnumVersionInfo pEnumVersionInfo; TreeNode pNode; if (pParentNode == null) { pNode = treeViewVersion.Nodes.Add(pVersionInfo.VersionName, pVersionInfo.VersionName); } pEnumVersionInfo = pVersionInfo.Children; pVersionInfo = pEnumVersionInfo.Next(); }
public StringBuilder GetVersion(IVersionInfo version) { var resource = _catalogue.GetResource(Guid.Empty, version.ResourceId); var path = GetVersionFolderFromResource(resource); var files = _directory.GetFiles(path).FirstOrDefault(a => a.Contains(string.Format("{0}_{1}_", resource.VersionInfo.VersionId.ToString(), version.VersionNumber))); if (string.IsNullOrEmpty(files)) { throw new VersionNotFoundException("Version Does not exist"); } return(new StringBuilder(_file.ReadAllText(files))); }
public FundingSummaryReportModelBuilder( IDateTimeProvider dateTimeProvider, IFundingSummaryReportDataProvider dataProvider, IFundingSummaryYearConfiguration yearConfiguration, IVersionInfo versionInfo, ILogger logger) { _dateTimeProvider = dateTimeProvider; _versionInfo = versionInfo; _logger = logger; _dataProvider = dataProvider; _yearConfiguration = yearConfiguration; }
private void method_0() { if ((this.iversion_0 != null) && this.iversion_0.HasParent()) { this.VersionListBox.Items.Clear(); IEnumVersionInfo ancestors = this.iversion_0.VersionInfo.Ancestors; ancestors.Reset(); for (IVersionInfo info2 = ancestors.Next(); info2 != null; info2 = ancestors.Next()) { this.VersionListBox.Items.Add(info2.VersionName); } this.VersionListBox.SelectedIndex = 0; } }
public StringBuilder GetVersion(IVersionInfo version, string resourcePath) { var versionFolder = _filePath.Combine(_envVersionFolder, version.ResourceId.ToString()); var v = _directory.GetFiles(versionFolder) .FirstOrDefault(p => _filePath.GetFileName(p) .StartsWith(version.VersionNumber, StringComparison.Ordinal)); if (string.IsNullOrEmpty(v)) { throw new VersionNotFoundException("Version Does not exist"); } return(new StringBuilder(_file.ReadAllText(v))); }
public static List <string> GetParentVersionNameList(IVersion pVersion) { List <string> strs = new List <string>(); if (pVersion.HasParent()) { IEnumVersionInfo ancestors = pVersion.VersionInfo.Ancestors; for (IVersionInfo i = ancestors.Next(); i != null; i = ancestors.Next()) { strs.Add(i.VersionName); } } return(strs); }
public StringBuilder GetVersion(IVersionInfo versionInfo) { var workSpaceId = Guid.NewGuid(); var controller = CommunicationControllerFactory.CreateController("GetVersion"); var serializer = new Dev2JsonSerializer(); controller.AddPayloadArgument("versionInfo", serializer.SerializeToBuilder(versionInfo).ToString()); var executeMessage = controller.ExecuteCommand<ExecuteMessage>(Connection, workSpaceId); if(executeMessage == null || executeMessage.HasError) { return null; } return executeMessage.Message; }
public void List_CO_Versions(IWorkspace iworkspace_0) { if (iworkspace_0 is IVersionedWorkspace) { IVersionedWorkspace workspace = iworkspace_0 as IVersionedWorkspace; IEnumVersionInfo versions = workspace.Versions; versions.Reset(); for (IVersionInfo info2 = versions.Next(); info2 != null; info2 = versions.Next()) { if (!this.method_0(info2.VersionName, iworkspace_0 as IWorkspaceReplicas)) { } } } }
public StringBuilder GetVersion(IVersionInfo versionInfo) { var workSpaceId = Guid.NewGuid(); var controller = CommunicationControllerFactory.CreateController("GetVersion"); var serializer = new Dev2JsonSerializer(); controller.AddPayloadArgument("versionInfo", serializer.SerializeToBuilder(versionInfo).ToString()); var executeMessage = controller.ExecuteCommand <ExecuteMessage>(Connection, workSpaceId); if (executeMessage == null || executeMessage.HasError) { return(null); } return(executeMessage.Message); }
public UpdateSever(string Url, string Method, string PostData, MyDeleGetInfo Callback, string OldDt, bool Canuseold) : base(Url, Method, PostData, Callback) { oldDt = OldDt; CanUseOld = Canuseold; version = base.GetUpdateVersionInfo; TimeSpan ts = new TimeSpan(DateTime.Parse(version.LatestDt).Ticks - DateTime.Parse(oldDt).Ticks); if (ts.Ticks > 0) { needUpdate = true; } else { needUpdate = false; } }
public void LoadVersionInfo() { bool tableCreated = false; if (!AlreadyCreatedVersionSchema) { Runner.Up(VersionSchemaMigration); } if (!AlreadyAppliedGroupMigration) { Runner.Up(GroupVersionMigration); } if (!AlreadyCreatedVersionTable) { Runner.Up(VersionMigration); } if (!AlreadyAppliedGroupMigration) { Runner.Up(GroupVersionMigration); tableCreated = true; } if (!AlreadyMadeVersionUnique) { Runner.Up(VersionUniqueMigration); } _versionInfo = new VersionInfo(); if (tableCreated) { return; } var dataSet = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName); foreach (DataRow row in dataSet.Tables[0].Rows) { if (string.Equals(row[VersionTableMetaData.GroupName], Group)) { _versionInfo.AddAppliedMigration(long.Parse(row[VersionTableMetaData.ColumnName].ToString())); } } }
private void method_1(IVersionedWorkspace iversionedWorkspace_1, TreeView treeView_0) { try { IVersionInfo versionInfo = iversionedWorkspace_1.DefaultVersion.VersionInfo; TreeNode node = new TreeNode(versionInfo.VersionName) { Tag = versionInfo }; treeView_0.Nodes.Add(node); this.method_0(versionInfo, node); treeView_0.SelectedNode = node; } catch { } }
public static List <IVersion> GetParentVersionList(IVersion pVersion) { List <IVersion> versions = new List <IVersion>(); if (pVersion.HasParent()) { IVersionedWorkspace versionedWorkspace = pVersion as IVersionedWorkspace; IEnumVersionInfo ancestors = pVersion.VersionInfo.Ancestors; IVersionInfo versionInfo = ancestors.Next(); while (versionInfo != null) { versions.Add(versionedWorkspace.FindVersion(versionInfo.VersionName)); versionInfo = ancestors.Next(); } } return(versions); }
public void RollbackTo(IVersionInfo versionInfo, Guid environmentId) { VerifyArgument.IsNotNull("versionInfo", versionInfo); Dev2Logger.Log.Info(String.Format("Rollback Version Resource: {0} Version:{1}", versionInfo.ResourceId, versionInfo.VersionNumber)); var resourceId = versionInfo.ResourceId; var versionProxy = GetVersionProxy(environmentId); IRollbackResult rollbackResult = versionProxy.RollbackTo(resourceId, versionInfo.VersionNumber); if (rollbackResult != null) { var parent = FindItem(i => i.ResourceId == resourceId && i.EnvironmentId == environmentId); if (parent != null && parent.DisplayName != rollbackResult.DisplayName) { parent.RefreshName(rollbackResult.DisplayName); } AttachVersionHistoryToParent(environmentId, resourceId, rollbackResult.VersionHistory); } }
private bool method_3(IVersionedWorkspace iversionedWorkspace_1, IEnumVersionInfo ienumVersionInfo_0, string string_0, bool bool_0, bool bool_1) { bool flag = true; try { for (IVersionInfo info = ienumVersionInfo_0.Next(); info != null; info = ienumVersionInfo_0.Next()) { IVersionEdit edit; if (bool_0) { if (!this.method_3(iversionedWorkspace_1, info.Children, info.VersionName, bool_0, bool_1)) { flag = false; this.txtMessage.Text = "无法合并 " + info.VersionName + "的所有子版"; } else { this.txtMessage.Text = "正在合并 " + info.VersionName; edit = iversionedWorkspace_1.FindVersion(info.VersionName) as IVersionEdit; if (!this.method_4(edit, string_0, bool_0, bool_1)) { flag = true; } } } else { this.txtMessage.Text = "正在合并 " + info.VersionName; edit = iversionedWorkspace_1.FindVersion(info.VersionName) as IVersionEdit; if (this.method_4(edit, string_0, bool_0, bool_1)) { this.method_3(iversionedWorkspace_1, info.Children, info.VersionName, bool_0, bool_1); } } } } catch { flag = false; } return(flag); }
public static ArrayList getVerionNameList(IWorkspace pWorkspace) { if (pWorkspace == null) { return(null); } IFeatureWorkspace FeatureWorkspace = pWorkspace as IFeatureWorkspace; IVersionedWorkspace3 VersionedWorkspace = FeatureWorkspace as IVersionedWorkspace3; ArrayList VersionNames = new ArrayList(); IEnumVersionInfo MulVersionInfo = VersionedWorkspace.Versions; IVersionInfo SiglVersionInfo = MulVersionInfo.Next(); while (SiglVersionInfo != null) { VersionNames.Add(SiglVersionInfo.VersionName); SiglVersionInfo = MulVersionInfo.Next(); } return(VersionNames); }
private void method_0() { if (this.ienumVersionInfo_0 != null) { this.ienumVersionInfo_0.Reset(); this.ilist_0.Clear(); for (IVersionInfo info = this.ienumVersionInfo_0.Next(); info != null; info = this.ienumVersionInfo_0.Next()) { this.cboVersions.Properties.Items.Add(info.VersionName); this.ilist_0.Add(info.Description); } if (this.cboVersions.Properties.Items.Count > 0) { this.cboVersions.SelectedIndex = 0; } } }
private void InitControl() { if (this.m_pEnumVersionInfo != null) { this.m_pEnumVersionInfo.Reset(); this.m_pList.Clear(); for (IVersionInfo info = this.m_pEnumVersionInfo.Next(); info != null; info = this.m_pEnumVersionInfo.Next()) { this.cboVersions.Properties.Items.Add(info.VersionName); this.m_pList.Add(info.Description); } if (this.cboVersions.Properties.Items.Count > 0) { this.cboVersions.SelectedIndex = 0; } } }
public static IContextualResourceModel ToContextualResourceModel(this IVersionInfo versionViewModel, IServer server, Guid?Id) { VerifyArgument.IsNotNull(nameof(versionViewModel), versionViewModel); var workflowXaml = server?.ProxyLayer?.GetVersion(versionViewModel, versionViewModel.ResourceId); if (workflowXaml != null) { var resourceModel = server?.ResourceRepository.LoadContextualResourceModel(versionViewModel.ResourceId); var xamlElement = XElement.Parse(workflowXaml.ToString()); var dataList = xamlElement.Element(@"DataList"); var dataListString = string.Empty; if (dataList != null) { dataListString = dataList.ToString(); } var action = xamlElement.Element(@"Action"); var xamlString = string.Empty; var xaml = action?.Element(@"XamlDefinition"); if (xaml != null) { xamlString = xaml.Value; } var resourceName = xamlElement.AttributeSafe("Name"); var resourceVersion = new ResourceModel(server, EventPublishers.Aggregator) { ResourceType = resourceModel.ResourceType, VersionInfo = resourceModel.VersionInfo, Version = resourceModel.Version, ResourceName = resourceName, WorkflowXaml = new StringBuilder(xamlString), UserPermissions = Permissions.Contribute, DataList = dataListString, IsVersionResource = true, ID = Id ?? Guid.NewGuid() }; return(resourceVersion); } return(default(IContextualResourceModel)); }
public void LoadVersionInfo() { if (!AlreadyCreatedVersionSchema && !_versionSchemaMigrationAlreadyRun) { Runner.Up(VersionSchemaMigration); _versionSchemaMigrationAlreadyRun = true; } if (!AlreadyCreatedVersionTable && !_versionMigrationAlreadyRun) { Runner.Up(VersionMigration); _versionMigrationAlreadyRun = true; } if (!AlreadyMadeVersionUnique && !_versionUniqueMigrationAlreadyRun) { Runner.Up(VersionUniqueMigration); _versionUniqueMigrationAlreadyRun = true; } if (!AlreadyMadeVersionDescription && !_versionDescriptionMigrationAlreadyRun) { Runner.Up(VersionDescriptionMigration); _versionDescriptionMigrationAlreadyRun = true; } _versionInfo = new VersionInfo(); if (!AlreadyCreatedVersionTable) { return; } using (var dataReader = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName)) { while (dataReader.Read()) { _versionInfo.AddAppliedMigration(long.Parse(dataReader[VersionTableMetaData.ColumnName].ToString())); } } }
private bool method_7(IVersionedWorkspace iversionedWorkspace_0, IEnumVersionInfo ienumVersionInfo_0, string string_0, bool bool_2, bool bool_3) { bool flag = true; try { for (IVersionInfo info = ienumVersionInfo_0.Next(); info != null; info = ienumVersionInfo_0.Next()) { IVersionEdit edit; if (bool_2) { if (!this.method_7(iversionedWorkspace_0, info.Children, info.VersionName, bool_2, bool_3)) { flag = false; } else { edit = iversionedWorkspace_0.FindVersion(info.VersionName) as IVersionEdit; if (!this.method_8(edit, string_0, bool_2, bool_3)) { flag = true; } } } else { edit = iversionedWorkspace_0.FindVersion(info.VersionName) as IVersionEdit; if (this.method_8(edit, string_0, bool_2, bool_3)) { this.method_7(iversionedWorkspace_0, info.Children, info.VersionName, bool_2, bool_3); } } } } catch { flag = false; } return(flag); }
private void AddVersionsToComb(IWorkspace pWorkSpace) { IVersionedWorkspace pVerWorkspace = null; IEnumVersionInfo pEnumVersionInfo = null; pVerWorkspace = (IVersionedWorkspace)pWorkSpace; pEnumVersionInfo = pVerWorkspace.Versions; pEnumVersionInfo.Reset(); IVersionInfo pVersionInfo = default(IVersionInfo); pVersionInfo = pEnumVersionInfo.Next(); ////在组合框中加载sde的所有版本 while (!(pVersionInfo == null)) { cboVersion.Items.Add(pVersionInfo.VersionName); pVersionInfo = pEnumVersionInfo.Next(); } cboVersion.Text = "SDE.DEFAULT"; }
public void LoadVersionInfo() { if (!AlreadyCreatedVersionSchema && !_versionSchemaMigrationAlreadyRun) { Runner.Up(VersionSchemaMigration); _versionSchemaMigrationAlreadyRun = true; } if (!AlreadyCreatedVersionTable && !_versionMigrationAlreadyRun) { Runner.Up(VersionMigration); _versionMigrationAlreadyRun = true; } if (!AlreadyMadeVersionUnique && !_versionUniqueMigrationAlreadyRun) { Runner.Up(VersionUniqueMigration); _versionUniqueMigrationAlreadyRun = true; } if (!AlreadyMadeVersionDescription && !_versionDescriptionMigrationAlreadyRun) { Runner.Up(VersionDescriptionMigration); _versionDescriptionMigrationAlreadyRun = true; } _versionInfo = new VersionInfo(); if (!AlreadyCreatedVersionTable) { return; } var dataSet = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName); foreach (DataRow row in dataSet.Tables[0].Rows) { _versionInfo.AddAppliedMigration(long.Parse(row[VersionTableMetaData.ColumnName].ToString())); } }
private void method_1(IVersionInfo iversionInfo_0, TreeNode treeNode_0) { try { treeNode_0.Expand(); IEnumVersionInfo children = iversionInfo_0.Children; iversionInfo_0 = children.Next(); while (iversionInfo_0 != null) { TreeNode node = new TreeNode(iversionInfo_0.VersionName) { Tag = iversionInfo_0 }; treeNode_0.Nodes.Add(node); this.method_1(iversionInfo_0, node); iversionInfo_0 = children.Next(); } } catch { } }
public void LoadVersionInfo() { if (!AlreadyCreatedVersionSchema) { Runner.Up(VersionSchemaMigration); } if (!AlreadyCreatedVersionTable) { Runner.Up(VersionMigration); _versionInfo = new VersionInfo(); return; } _versionInfo = new VersionInfo(); var dataSet = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName); foreach (DataRow row in dataSet.Tables[0].Rows) { _versionInfo.AddAppliedMigration(long.Parse(row[0].ToString())); } }
private void method_1(TreeNode treeNode_0, IEnumVersionInfo ienumVersionInfo_0) { ienumVersionInfo_0.Reset(); for (IVersionInfo info = ienumVersionInfo_0.Next(); info != null; info = ienumVersionInfo_0.Next()) { TreeNode node = new TreeNode(info.VersionName) { Tag = info }; if (info.VersionName == this.string_1) { node.ImageIndex = 1; node.SelectedImageIndex = 1; } else { node.ImageIndex = 0; node.SelectedImageIndex = 0; } treeNode_0.Nodes.Add(node); this.method_1(node, info.Children); } }
public void GetVersionInfo(IWorkspace workspace) { if (workspace.Type != esriWorkspaceType.esriRemoteDatabaseWorkspace) { return; } this.cboVersion.Properties.Items.Clear(); IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace; IEnumVersionInfo enumVersionInfo = versionedWorkspace.Versions; enumVersionInfo.Reset(); IVersionInfo version = (IVersionInfo)enumVersionInfo.Next(); if (version != null) { this.cboVersion.Properties.Items.Clear(); } while (version != null) { this.cboVersion.Properties.Items.Add(version.VersionName); version = (IVersionInfo)enumVersionInfo.Next(); } }
public AdultFundingClaimReport( ILogger logger, IStreamableKeyValuePersistenceService streamableKeyValuePersistenceService, IIlrProviderService ilrProviderService, IOrgProviderService orgProviderService, IAllbProviderService allbProviderService, IFM35ProviderService fm35ProviderService, IDateTimeProvider dateTimeProvider, IIntUtilitiesService intUtilitiesService, IValueProvider valueProvider, ILarsProviderService larsProviderService, IEasProviderService easProviderService, IPostcodeProviderService postcodeProviderService, ILargeEmployerProviderService largeEmployerProviderService, IVersionInfo versionInfo, ITopicAndTaskSectionOptions topicAndTaskSectionOptions, IAdultFundingClaimBuilder adultFundingClaimBuilder) : base(dateTimeProvider, valueProvider, streamableKeyValuePersistenceService) { _logger = logger; _ilrProviderService = ilrProviderService; _orgProviderService = orgProviderService; _allbProviderService = allbProviderService; _fm35ProviderService = fm35ProviderService; _larsProviderService = larsProviderService; _easProviderService = easProviderService; _postcodeProviderService = postcodeProviderService; _largeEmployerProviderService = largeEmployerProviderService; _versionInfo = versionInfo; _dateTimeProvider = dateTimeProvider; _intUtilitiesService = intUtilitiesService; _adultFundingClaimBuilder = adultFundingClaimBuilder; ReportFileName = "Adult Funding Claim Report"; ReportTaskName = topicAndTaskSectionOptions.TopicReports_TaskGenerateAdultFundingClaimReport; }
/// <summary> /// Updates the non workflow related details of from another resource model. /// </summary> /// <param name="resourceModel">The resource model to update from.</param> public void Update(IResourceModel resourceModel) { AllowCategoryEditing = resourceModel.AllowCategoryEditing; Category = resourceModel.Category; Comment = resourceModel.Comment; DataTags = resourceModel.DataTags; DisplayName = resourceModel.DisplayName; VersionInfo = resourceModel.VersionInfo; HelpLink = resourceModel.HelpLink; IsDebugMode = resourceModel.IsDebugMode; RequiresSignOff = resourceModel.RequiresSignOff; ResourceName = resourceModel.ResourceName; ResourceType = resourceModel.ResourceType; Tags = resourceModel.Tags; DataList = resourceModel.DataList; UpdateIconPath(resourceModel.IconPath); Version = resourceModel.Version; ConnectionString = resourceModel.ConnectionString; ID = resourceModel.ID; ServerResourceType = resourceModel.ServerResourceType; UserPermissions = resourceModel.UserPermissions; Inputs = resourceModel.Inputs; Outputs = resourceModel.Outputs; WorkflowXaml = resourceModel.WorkflowXaml; _errors.Clear(); if (resourceModel.Errors != null) { foreach (var error in resourceModel.Errors) { _errors.Add(error); } } }
public void UpdateVersionInfo(IVersionInfo version) { var dataExpression = new InsertDataExpression(); dataExpression.Rows.Add(CreateVersionInfoInsertionData(version)); dataExpression.TableName = VersionTableMetaData.TableName; dataExpression.SchemaName = VersionTableMetaData.SchemaName; dataExpression.ExecuteWith(Processor); }
public void RollbackTo(IVersionInfo versionInfo, Guid environmentId) { VerifyArgument.IsNotNull("versionInfo", versionInfo); Dev2Logger.Log.Info(String.Format("Rollback Version Resource: {0} Version:{1}", versionInfo.ResourceId, versionInfo.VersionNumber)); var resourceId = versionInfo.ResourceId; var versionProxy = GetVersionProxy(environmentId); IRollbackResult rollbackResult = versionProxy.RollbackTo(resourceId, versionInfo.VersionNumber); if(rollbackResult != null) { var parent = FindItem(i => i.ResourceId == resourceId && i.EnvironmentId == environmentId); if(parent != null && parent.DisplayName != rollbackResult.DisplayName) { parent.RefreshName(rollbackResult.DisplayName); } AttachVersionHistoryToParent(environmentId, resourceId, rollbackResult.VersionHistory); } }
public void LoadVersionInfo() { if (Processor.Options.PreviewOnly) { if (!AlreadyCreatedVersionTable) { Runner.Up(VersionMigration); VersionInfo = new VersionInfo(); } else VersionInfo = new VersionInfo(); return; } if (!AlreadyCreatedVersionSchema) Runner.Up(VersionSchemaMigration); if (!AlreadyCreatedVersionTable) { Runner.Up(VersionMigration); _versionInfo = new VersionInfo(); return; } var dataSet = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName); _versionInfo = new VersionInfo(); foreach (DataRow row in dataSet.Tables[0].Rows) { _versionInfo.AddAppliedMigration(long.Parse(row[0].ToString())); } }
/// <summary> /// Updates the specified <see cref="IVersionInfo"/> entity. /// </summary> /// <param name="versionInfo">The <see cref="IVersionInfo"/> entity to update.</param> /// <returns>A <see cref="ManagerResponse"/> object.</returns> public ManagerResponse Update(IVersionInfo versionInfo) { // Validate parameters if (versionInfo == null) { return ManagerResponse.MissingData; } if (String.IsNullOrWhiteSpace(versionInfo.Component)) { return ManagerResponse.InvalidData; } if (String.IsNullOrWhiteSpace(versionInfo.Version)) { return ManagerResponse.InvalidData; } ManagerResponse response; using (var context = new Entities(_connectionString)) { context.SqlScriptVersionInfos.Attach(versionInfo as SqlScriptVersionInfo); context.ObjectStateManager.ChangeObjectState(versionInfo, EntityState.Modified); response = context.SaveChanges() == 1 ? ManagerResponse.Success : ManagerResponse.UnknownFailure; } return response; }
public StringBuilder GetVersion(IVersionInfo versionInfo, Guid environmentId) { VerifyArgument.IsNotNull("versionInfo", versionInfo); var versionProxy = GetVersionProxy(environmentId); return versionProxy.GetVersion(versionInfo); }
public void DeleteVersion(IVersionInfo versionInfo, Guid environmentId) { VerifyArgument.IsNotNull("versionInfo", versionInfo); Dev2Logger.Log.Info(String.Format("Delete Version. Resource: {0} Version:{1}", versionInfo.ResourceId, versionInfo.VersionNumber)); var resourceId = versionInfo.ResourceId; var versionProxy = GetVersionProxy(environmentId); var versions = versionProxy.DeleteVersion(resourceId, versionInfo.VersionNumber); AttachVersionHistoryToParent(environmentId, resourceId, versions); }
private void OpenVersionCommand(Guid resourceId, IVersionInfo versionInfo) { _shellViewModel.OpenVersion(resourceId, versionInfo); }
public void UpdateVersionInfo(IVersionInfo version) { this.Versions.Add(version); this.DidUpdateVersionInfoGetCalled = true; }
public virtual void LoadVersionInfo() { if (!AlreadyCreatedVersionSchema && !_versionSchemaMigrationAlreadyRun) { Runner.Up(VersionSchemaMigration); _versionSchemaMigrationAlreadyRun = true; } if (!AlreadyCreatedVersionTable && !_versionMigrationAlreadyRun) { Runner.Up(VersionMigration); _versionMigrationAlreadyRun = true; } if (!AlreadyMadeVersionUnique && !_versionUniqueMigrationAlreadyRun) { Runner.Up(VersionUniqueMigration); _versionUniqueMigrationAlreadyRun = true; } _versionInfo = new VersionInfo(); if (!AlreadyCreatedVersionTable) return; var dataSet = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName); foreach (DataRow row in dataSet.Tables[0].Rows) { _versionInfo.AddAppliedMigration(long.Parse(row[0].ToString())); } }
public StringBuilder GetVersion(IVersionInfo version) { var resource = _catalogue.GetResource(Guid.Empty, version.ResourceId); var path = GetVersionFolderFromResource(resource); var files = _directory.GetFiles(path).FirstOrDefault(a => a.Contains(string.Format("{0}_{1}_", resource.VersionInfo.VersionId.ToString(), version.VersionNumber))); if(string.IsNullOrEmpty(files)) throw new VersionNotFoundException("Version Does not exist"); return new StringBuilder(_file.ReadAllText(files)); }
protected virtual InsertionDataDefinition CreateVersionInfoInsertionData(IVersionInfo version) { var xmlSerializer = new XmlSerializer(typeof(VersionMetadata)); var metadata = new XmlDocument(); using (var writer = metadata.CreateNavigator().AppendChild()) { version.Metadata.WriteXml(writer); } metadata.InsertBefore(metadata.CreateXmlDeclaration("1.0", null, null), metadata.DocumentElement); return new InsertionDataDefinition { new KeyValuePair<string, object>(VersionTableMetaData.ColumnName, version.Version), new KeyValuePair<string, object>("AppliedOn", DateTime.UtcNow), new KeyValuePair<string, object>(VersionTableMetaData.MetadataColumnName, metadata) }; }
private static IVersionInfo AddOrUpdateVersionInfo(string component, string version, IVersionInfo versionInfo, IVersionInfoDao versionInfoDao) { if (versionInfo == null) { // Add new script version info record versionInfoDao.Add(component, version); } else { // Update existing script version info record versionInfo.Version = version; versionInfoDao.Update(versionInfo); } return versionInfo; }
public void AddAppliedMigration(IVersionInfo migration) { _versionsApplied.Add(migration); }