public bool ArtifactCodeRuleEditing_PreTransitionCRUD(string transition) { try { switch (transition) { case "Save": Guid artifactTypeId = Guid.Parse(cbbArtifactType.SelectedItem.Value.ToString()); string name = txtArtifactCodeRuleName.Text; string description = txtArtifactCodeRuleDescription.Text; ArtifactType artifactType = session.GetObjectByKey <ArtifactType>(artifactTypeId); Guid artifactCodeRuleId = ArtifactCodeRuleId; ArtifactCodeRule artifactCodeRule = session.GetObjectByKey <ArtifactCodeRule>(artifactCodeRuleId); artifactCodeRule.ArtifactTypeId = artifactType; artifactCodeRule.Description = description; artifactCodeRule.LastUpdateDate = DateTime.Now; artifactCodeRule.Name = name; artifactCodeRule.Save(); break; default: break; } return(true); } catch (Exception ex) { return(false); } }
public void Delete(Session session, Guid artifactCodeRuleId) { try { ArtifactCodeRule artifactCodeRule = session.GetObjectByKey <ArtifactCodeRule>(artifactCodeRuleId); artifactCodeRule.RowStatus = Utility.Constant.ROWSTATUS_DELETED; artifactCodeRule.Save(); if (artifactCodeRule != null) { if (artifactCodeRule.CodeRuleDefinitions != null) { CodeRuleDefinitionBO codeRuleDefinitionBO = new CodeRuleDefinitionBO(); foreach (var definition in artifactCodeRule.CodeRuleDefinitions) { codeRuleDefinitionBO.Delete(session, definition.CodeRuleDefinitionId); } } } } catch (Exception) { throw; } }
public bool ArtifactCodeRuleCreating_PreTransitionCRUD(string transition) { try { switch (transition) { case "Save": Guid artifactTypeId = Guid.Parse(cbbArtifactType.SelectedItem.Value.ToString()); string name = txtArtifactCodeRuleName.Text; string description = txtArtifactCodeRuleDescription.Text; ArtifactType artifactType = session.GetObjectByKey <ArtifactType>(artifactTypeId); ArtifactCodeRule newArtifactCodeRule = new ArtifactCodeRule(session) { ArtifactCodeRuleId = Guid.NewGuid(), ArtifactTypeId = artifactType, CreateDate = DateTime.Now, Description = description, IssueDate = DateTime.Now, LastUpdateDate = DateTime.Now, Name = name, RowStatus = Utility.Constant.ROWSTATUS_ACTIVE }; newArtifactCodeRule.Save(); ArtifactCodeRuleId = newArtifactCodeRule.ArtifactCodeRuleId; break; default: break; } return(true); } catch (Exception ex) { return(false); } }