public CaseHandlingDataObject AddCaseHandling(CaseHandlingDataObject caseHandling) { CaseHandling entity = this.caseHandlingRepository.Create(); entity = DyMapper.Map(caseHandling, entity); this.caseHandlingRepository.Add(entity); this.caseHandlingRepository.Commit(); return(DyMapper.Map <CaseHandling, CaseHandlingDataObject>(entity)); }
public CaseHandlingDataObject UpdateCaseHandling(CaseHandlingDataObject caseHandling) { CaseHandling entity = this.caseHandlingRepository.FindByID(caseHandling.ID); entity = DyMapper.Map(caseHandling, entity); this.caseHandlingRepository.Add(entity); this.caseHandlingRepository.Commit(); return(DyMapper.Map <CaseHandling, CaseHandlingDataObject>(entity)); }
public CaseHandlingDataObject NextStep(CaseHandlingDataObject caseHandling) { CaseHandling entity = this.caseHandlingRepository.FindByID(caseHandling.ID); entity.WorkFlow = entity.WorkFlow.Next; this.caseHandlingRepository.Update(entity); this.caseHandlingRepository.Commit(); return(DyMapper.Map <CaseHandling, CaseHandlingDataObject>(entity)); }
public CaseHandlingDataObject PreviousStep(CaseHandlingDataObject caseHandling) { CaseHandling entity = this.caseHandlingRepository.FindByID(caseHandling.ID); if (entity.WorkFlow == null) { return(null); } entity.WorkFlow = entity.WorkFlow.Previous; this.caseHandlingRepository.Update(entity); this.caseHandlingRepository.Commit(); return(DyMapper.Map <CaseHandling, CaseHandlingDataObject>(entity)); }
public static bool GetLocallyUniqueItemName(Item item, string disallowed, SpaceHandling removeSpaces, CaseHandling forceLowercase, bool replaceDiacritics, out string uniqueName) { var newName = GetNewItemName(item.Name, disallowed, removeSpaces, forceLowercase, replaceDiacritics); var finalName = newName; var nameSuffix = 0; while (NameIsTakenBySibling(item, finalName)) { nameSuffix++; finalName = newName + "-" + nameSuffix.ToString(CultureInfo.InvariantCulture); } uniqueName = finalName; return true; }
/// <summary> /// Checks if two section names are equal under the current <see cref="CaseHandling"/> flags /// </summary> /// <param name="A">Section Name</param> /// <param name="B">Section name</param> /// <returns>true, if considered identical</returns> private bool SecEq(string A, string B) { if (A == null && B == null) { return(true); } else if (A == null || B == null) { return(false); } if (CaseHandling.HasFlag(CaseSensitivity.CaseInsensitiveSection)) { return(A.ToLower() == B.ToLower()); } return(A == B); }
/// <summary> /// Actual method where string manipulation takes place. /// </summary> /// <param name="oldName">The original name of the target Item.</param> /// <param name="disallowed">Regex string of characters that should be stripped from the name.</param> /// <param name="removeSpaces">Desired behavior for space replacement in the name.</param> /// <param name="forceLowercase">Desired behavior for mixed-case names.</param> /// <param name="replaceDiacritics">Desired behavior for handling of diacritics in text.</param> /// <returns>The modified string to use as the name.</returns> public static string GetNewItemName(string oldName, string disallowed, SpaceHandling removeSpaces, CaseHandling forceLowercase, bool replaceDiacritics) { var spaceReplacer = string.Empty; if (removeSpaces == SpaceHandling.UseDash) { spaceReplacer = "-"; } var name = oldName.Replace(" ", spaceReplacer); name = Regex.Replace(name, disallowed, string.Empty); if (replaceDiacritics) { name = ReplaceDiacritics(name); } return forceLowercase == CaseHandling.ForceLowercase ? name.ToLower(CultureInfo.InvariantCulture) : name; }
/// <summary>Creates a new instance.</summary> /// <param name="caseHandling">Defines if the value shall be converted to camelCase, PascalCase, lowercase or kebab-case.</param> public EnumBaseConverter(CaseHandling caseHandling = CaseHandling.CamelCase) { CaseHandlingMode = caseHandling; }
/// <summary>Creates a new instance.</summary> /// <param name="defaultValue">Specified the default value of the enum.</param> /// <param name="caseHandling">Specified the case.</param> public EnumBaseConverter(T defaultValue, CaseHandling caseHandling = CaseHandling.CamelCase) { this.DefaultValue = defaultValue; this.CaseHandlingMode = caseHandling; }
public static bool GetLocallyUniqueItemName(Item item, string disallowed, SpaceHandling removeSpaces, CaseHandling forceLowercase, bool replaceDiacritics, out string uniqueName) { var newName = GetNewItemName(item.Name, disallowed, removeSpaces, forceLowercase, replaceDiacritics); var finalName = newName; var nameSuffix = 0; while (NameIsTakenBySibling(item, finalName)) { nameSuffix++; finalName = newName + "-" + nameSuffix.ToString(CultureInfo.InvariantCulture); } uniqueName = finalName; return(true); }
/// <summary> /// Actual method where string manipulation takes place. /// </summary> /// <param name="oldName">The original name of the target Item.</param> /// <param name="disallowed">Regex string of characters that should be stripped from the name.</param> /// <param name="removeSpaces">Desired behavior for space replacement in the name.</param> /// <param name="forceLowercase">Desired behavior for mixed-case names.</param> /// <param name="replaceDiacritics">Desired behavior for handling of diacritics in text.</param> /// <returns>The modified string to use as the name.</returns> public static string GetNewItemName(string oldName, string disallowed, SpaceHandling removeSpaces, CaseHandling forceLowercase, bool replaceDiacritics) { var spaceReplacer = string.Empty; if (removeSpaces == SpaceHandling.UseDash) { spaceReplacer = "-"; } var name = oldName.Replace(" ", spaceReplacer); name = Regex.Replace(name, disallowed, string.Empty); if (replaceDiacritics) { name = ReplaceDiacritics(name); } return(forceLowercase == CaseHandling.ForceLowercase ? name.ToLower(CultureInfo.InvariantCulture) : name); }