public ActionResult Submit(string p, long s, Guid id, PersonalFolderIdFormats nf) { string result = "ok"; try { PersonalFolder f = null; if(id.Equals(Guid.Empty)) { f = new PersonalFolder() { PersonalFolderKey = Guid.NewGuid(), FolderPath = p, NameFormat = nf, MembershipScope = s }; cm.LdapContext.PersonalFolders.Insert(f); } else { f = cm.LdapContext.PersonalFolders.GetByID(id); f.MembershipScope = s; f.FolderPath = p; f.NameFormat = nf; cm.LdapContext.PersonalFolders.Update(f); } } catch(Exception ex) { ExceptionCollector ec = new ExceptionCollector(ex); result = ec.ToUL(); } return Content(result); }
public static string GetFolderPath(IDirectoryMember member, PersonalFolder pf) { if (pf.NameFormat == PersonalFolderIdFormats.Fullname) { string name = DirectoryMemberRepository.GetName(member, DirectoryMemberNameFormats.Full | DirectoryMemberNameFormats.Sort) + " - " + member.UserName; return Path.Combine(pf.FolderPath, name); } else { return Path.Combine(pf.FolderPath, member.UserName); } }
public static string FormatFolderName(IDirectoryMember member, PersonalFolder pf) { return FormatFolderName(member, pf.NameFormat); }