/// <summary> /// Create an Ad-Hoc Access Group for the <paramref name="target"/>. /// </summary> /// <param name="instance">The instance.</param> /// <param name="target">The target registry entry.</param> /// <param name="userIds">The user ids.</param> /// <returns></returns> public static int CreateAccessGroup(this IFunctionManager instance, RegistryEntry target, params int[] userIds) { if (instance == null) { throw new ArgumentNullException("instance"); } if (target == null) { throw new ArgumentNullException("target"); } if (userIds == null || userIds.Length == 0) { throw new ArgumentException( Resources .FunctionManagerExtensions_CreateAccessGroup_The_must_be_at_least_one_member_in_the_Access_Group, "userIds"); } return ((int) instance.Execute("OpprettTilgangsgruppeHandler", 0, target.Id, string.Join(",", userIds.Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray()))); }
/// <summary> /// Oppretts the journalpost aktivitetsflyt. /// </summary> /// <param name="instance">The instance.</param> /// <param name="templateId">The template id.</param> /// <param name="registryEntryId">The journalpost id.</param> /// <param name="position">The position.</param> /// <param name="asSibling">if set to <c>true</c> [as sibling].</param> /// <param name="recipients">The mottakere.</param> public static void CreateRegistryEntryActivities(this IFunctionManager instance, int templateId, int registryEntryId, int position, bool asSibling, IEnumerable <SenderRecipient> recipients) { instance.Execute("NewActivitiesFromTemplate", templateId, registryEntryId, 1, position, asSibling, string.Join(";", recipients.Select(RecipientToString).ToArray())); }
/// <summary> /// Henter tilgangskodene til en bruker. /// </summary> /// <param name="instance">The instance.</param> /// <param name="userNameId">The personnavn id.</param> /// <returns></returns> public static IEnumerable <string> GetAccessCodes(this IFunctionManager instance, int userNameId) { var tilgangskodeIds = (string)instance.Execute("Tilgangskoder", userNameId); return (tilgangskodeIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries) .Select(tilgangskodeId => tilgangskodeId.Trim())); }
/// <summary> /// Marks the case as read. /// </summary> /// <param name="instance">The instance.</param> /// <param name="caseId">The case id.</param> public static void MarkCaseAsRead(this IFunctionManager instance, int caseId) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("MarkerSakSomLest", caseId); }
/// <summary> /// Marks the case as complete. /// </summary> /// <param name="instance">The instance.</param> /// <param name="caseId">The case id.</param> public static void MarkCaseAsComplete(this IFunctionManager instance, int caseId) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("SettSakTilFerdigmeldt", caseId); }
/// <summary> /// Marks the sender recipient as read. /// </summary> /// <param name="instance">The instance.</param> /// <param name="senderRecipientId">The sender recipient id.</param> public static void MarkSenderRecipientAsRead(this IFunctionManager instance, int senderRecipientId) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("MarkerAvsenderMottakerSomLest", senderRecipientId); }
/// <summary> /// Hents the dokumentmaltyper. /// </summary> /// <param name="instance">The instance.</param> /// <returns></returns> public static IDictionary <int, string> GetDocumentTemplateTypes(this IFunctionManager instance) { var dokumentmalTyper = (DataSet)instance.Execute("HentDokumentmalTyper"); return (dokumentmalTyper.Tables[0].Rows.Cast <DataRow>() .ToDictionary(dokumentmalType => Convert.ToInt32(dokumentmalType["DMT_ID"]), dokumentmalType => dokumentmalType["DMT_BESKRIVELSE"].ToString())); }
/// <summary> /// Marks the task as complete. /// </summary> /// <param name="instance">The instance.</param> /// <param name="taskId">The task id.</param> public static void MarkTaskAsComplete(this IFunctionManager instance, int taskId) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("MerkAktivitetSomFullfoert", taskId); }
/// <summary> /// Approves the registry entry. /// </summary> /// <param name="instance">The instance.</param> /// <param name="caseId">The case id.</param> /// <param name="registryEntryId">The registry entry id.</param> /// <param name="isApproved">if set to <c>true</c> [is approved].</param> /// <param name="remark">The remark.</param> /// <param name="notifyByEmail">if set to <c>true</c> [notify by email].</param> public static void MarkRegistryEntryAsApproved(this IFunctionManager instance, int caseId, int registryEntryId, bool isApproved, string remark, bool notifyByEmail) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("GodkjennJournalpost", caseId, registryEntryId, isApproved, remark, notifyByEmail); }
/// <summary> /// Marks the registry entry as followed up. /// </summary> /// <param name="instance">The instance.</param> /// <param name="registryEntryId">The registry entry id.</param> /// <param name="recipientId">The recipient id.</param> /// <param name="followUpMethod">The follow up method.</param> /// <param name="remark">The remark.</param> public static void MarkRegistryEntryAsFollowedUp(this IFunctionManager instance, int registryEntryId, int recipientId, string followUpMethod, string remark) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("AvskrivJournalpost", registryEntryId, recipientId, followUpMethod, remark); }
/// <summary> /// Marks the registry entry document as complete. /// </summary> /// <param name="instance">The instance.</param> /// <param name="registryEntryId">The registry entry id.</param> /// <param name="documentDescriptionId">The document description id.</param> public static void MarkRegistryEntryDocumentAsComplete(this IFunctionManager instance, int registryEntryId, int documentDescriptionId) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("FerdigstillDokument", registryEntryId, documentDescriptionId); }
/// <summary> /// Requests the document approval. /// </summary> /// <param name="instance">The instance.</param> /// <param name="registryEntryId">The registry entry id.</param> /// <param name="documentDescriptionId">The document description id.</param> /// <param name="approverUserNameId">The approver user name id.</param> public static void RequestDocumentApproval(this IFunctionManager instance, int registryEntryId, int documentDescriptionId, int?approverUserNameId = null) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Execute("GodkjennDokument", registryEntryId, documentDescriptionId, (approverUserNameId ?? 0).ToString(CultureInfo.InvariantCulture)); }
/// <summary> /// Hents the dokumentmal. /// </summary> /// <param name="instance">The instance.</param> /// <param name="journalpostId">The journalpost id.</param> /// <param name="dokumentbeskrivelseId">The dokumentbeskrivelse id.</param> /// <param name="dokumentmalTypeIds">The dokumentmal type ids.</param> /// <returns></returns> public static IEnumerable <Dokumentmal> HentDokumentmal(this IFunctionManager instance, int journalpostId, int dokumentbeskrivelseId, params int[] dokumentmalTypeIds) { var dokumentmaler = (DataSet)instance.Execute("HentDokumentmaler", journalpostId, dokumentbeskrivelseId, string.Join(",", dokumentmalTypeIds.Select(x => x.ToString()).ToArray())); return(from DataRow dokumentmalRow in dokumentmaler.Tables[0].Rows select new Dokumentmal { Id = Convert.ToInt32(dokumentmalRow["Id"]), Betegnelse = (string)dokumentmalRow["malnavn"], DokumentmalTypeId = Convert.ToInt32(dokumentmalRow["Type"]) }); }
/// <summary> /// Henter sak aktivitetsmaler. /// </summary> /// <param name="instance">The instance.</param> /// <returns></returns> public static IDictionary <int, string> GetCaseActivityTemplates(this IFunctionManager instance) { var aktivitetsmaler = (DataSet)instance.Execute("HentAktivitetsmaler", 0); var templates = new Dictionary <int, string>(); for (var i = 0; i < aktivitetsmaler.Tables[0].DefaultView.Count; i++) { var aktivitetsmal = aktivitetsmaler.Tables[0].DefaultView[i]; templates.Add(Convert.ToInt32(aktivitetsmal[0]), aktivitetsmal[1].ToString()); } return(templates); }
/// <summary> /// Designates the registry entry as reply. /// </summary> /// <param name="instance">The instance.</param> /// <param name="replyToSenderId">The reply to sender id.</param> /// <param name="replyToRegistryEntryId">The reply to registry entry id.</param> /// <param name="replyWithRegistryEntryId">The reply with registry entry id.</param> /// <param name="followUpMethod">The follow up method.</param> /// <param name="documentCategory">The document category.</param> public static void DesignateRegistryEntryAsReply(this IFunctionManager instance, int replyToSenderId, int replyToRegistryEntryId, int replyWithRegistryEntryId, string followUpMethod, string documentCategory) { instance.Execute("BesvarInngaaendeJournalposterMedUtgaaende", new object[] { replyToSenderId, replyWithRegistryEntryId, followUpMethod, replyToRegistryEntryId.ToString( CultureInfo.InvariantCulture), documentCategory }); }
/// <summary> /// Marks the registry entry as read. /// </summary> /// <param name="instance">The instance.</param> /// <param name="registryEntryId">The registry entry id.</param> public static void MarkRegistryEntryAsRead(this IFunctionManager instance, int?registryEntryId) { if (instance == null) { throw new ArgumentNullException("instance"); } if (!registryEntryId.HasValue) { throw new ArgumentNullException("registryEntryId"); } instance.Execute("MarkerJournalpostSomLest", registryEntryId); }
/// <summary> /// Distributes the registry entry. /// </summary> /// <param name="instance">The instance.</param> /// <param name="registryEntryId">The registry entry id.</param> /// <param name="administrativeUnitId">The administrative unit id.</param> /// <param name="userNameId">The user name id.</param> /// <param name="registryManagementUnitId">The registry management unit id.</param> /// <param name="sendEmail">if set to <c>true</c> [send email].</param> /// <param name="remark">The remark.</param> /// <param name="newRecipients">The new recipients.</param> public static void DistributeRegistryEntry(this IFunctionManager instance, int registryEntryId, int administrativeUnitId, int userNameId, string registryManagementUnitId, bool sendEmail, string remark, IEnumerable <SenderRecipient> newRecipients) { var newRecipientSerialized = new StringBuilder(); using (var nyeMottakereWriter = XmlWriter.Create(newRecipientSerialized)) { var serializer = new DataContractSerializer(typeof(SenderRecipient[]), new[] { typeof(SenderRecipient) }); serializer.WriteObject(nyeMottakereWriter, newRecipients.ToArray()); } instance.Execute("DistributeV3En", registryEntryId, administrativeUnitId, userNameId, registryManagementUnitId, sendEmail, remark, newRecipientSerialized.ToString()); }
/// <summary> /// Hents the dokumentmal. /// </summary> /// <param name="instance">The instance.</param> /// <param name="registryEntryId">The registry entry id.</param> /// <param name="documentDescriptionId">The document description id.</param> /// <param name="registryEntryTypeIds">The registry entry type ids.</param> /// <returns></returns> public static IEnumerable <DocumentTemplate> GetDocumentTemplates(this IFunctionManager instance, int registryEntryId, int documentDescriptionId, params string[] registryEntryTypeIds) { var documentTemplateSet = (DataSet) instance.Execute("HentDokumentmaler", registryEntryId, documentDescriptionId, string.Join(",", registryEntryTypeIds)); var documentTemplates = from DataRow dokumentmalRow in documentTemplateSet.Tables[0].Rows select new DocumentTemplate { Id = Convert.ToInt32(dokumentmalRow["Id"]), Description = (string)dokumentmalRow["malnavn"], DocumentTemplateTypeId = Convert.ToInt32(dokumentmalRow["Type"]) }; return(documentTemplates.OrderBy(x => x.FileName)); }
/// <summary> /// Gets the user roles. /// </summary> /// <param name="instance">The instance.</param> /// <param name="userId">The user id.</param> /// <returns></returns> public static IEnumerable <UserRole> GetUserRoles(this IFunctionManager instance, int userId) { var functionResult = (string)instance.Execute("HentRolleHandler", userId); foreach (var roleElement in functionResult.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries)) { var roleValues = roleElement.Split(','); var userRole = new UserRole { Id = int.Parse(roleValues[0]), RoleId = int.Parse(roleValues[1]), DefaultRole = int.Parse(roleValues[2]) == -1, Title = roleValues[3], AdministrativeUnitId = int.Parse(roleValues[4]) }; yield return(userRole); } }
/// <summary> /// Opprett ad-hoc tilgangsgruppe for journalpost. /// </summary> /// <param name="instance">The instance.</param> /// <param name="journalpost">The journalpost.</param> /// <param name="personIds">The person ids.</param> /// <returns></returns> public static int OpprettTilgangsgruppe(this IFunctionManager instance, Journalpost journalpost, params int[] personIds) { if (instance == null) { throw new ArgumentNullException("instance"); } if (journalpost == null) { throw new ArgumentNullException("journalpost"); } if (personIds == null || personIds.Length == 0) { throw new ArgumentException(@"Det må angis minst ett medlem av tilgangsgruppen.", "personIds"); } return((int)instance.Execute("OpprettTilgangsgruppeHandler", 0, journalpost.Id, string.Join(",", personIds.Select(x => x.ToString()).ToArray()))); }
/// <summary> /// Creates the reply. /// </summary> /// <param name="instance">The instance.</param> /// <param name="target">The target.</param> /// <param name="replyFromRecipientId">The reply from recipient id.</param> /// <param name="accessGroupId">The access group id.</param> /// <param name="downgradingCodeId">The downgrading code id.</param> /// <param name="downgradingDate">The downgrading date.</param> /// <param name="documentCategory">The document category.</param> /// <returns> /// The Id of the registry entry representing the reply. /// </returns> public static int CreateReply(this IFunctionManager instance, RegistryEntry target, int replyFromRecipientId = 0, int accessGroupId = -1, string downgradingCodeId = "", string downgradingDate = "", string documentCategory = "") { return((int)instance.Execute("BesvarJournalpostMedSkjerming", target.Id, replyFromRecipientId, target.RegistryEntryTypeId == "N" ? "X" : "U", target.IsPhysical.HasValue && target.IsPhysical.Value ? "BU" : "***", target.Title, target.TitleRestricted, target.TitlePersonNameTagged, target.AccessCodeId, accessGroupId, target.Pursuant, downgradingCodeId, downgradingDate, documentCategory)); }
/// <summary> /// Opprett ad-hoc tilgangsgruppe for sak. /// </summary> /// <param name="instance">The instance.</param> /// <param name="sak">The sak.</param> /// <param name="personIds">The person ids.</param> /// <returns></returns> public static int OpprettTilgangsgruppe(this IFunctionManager instance, Sak sak, params int[] personIds) { if (instance == null) { throw new ArgumentNullException("instance"); } if (sak == null) { throw new ArgumentNullException("sak"); } if (personIds == null || personIds.Length == 0) { throw new ArgumentException(@"Det må angis minst ett medlem av tilgangsgruppen.", "personIds"); } if (!sak.Id.HasValue) { throw new InvalidOperationException("Sak må ha en Id."); } return((int)instance.Execute("OpprettTilgangsgruppeHandler", sak.Id, 0, string.Join(",", personIds.Select(x => x.ToString()).ToArray()))); }
/// <summary> /// Oppretts the sak aktivitetsflyt. /// </summary> /// <param name="instance">The instance.</param> /// <param name="templateId">The template id.</param> /// <param name="sakId">The sak id.</param> /// <param name="position">The position.</param> /// <param name="asSibling">if set to <c>true</c> [as sibling].</param> /// <param name="mottakere">The mottakere.</param> public static void OpprettSakAktivitetsflyt(this IFunctionManager instance, int templateId, int sakId, int position, bool asSibling, IEnumerable <AvsenderMottaker> mottakere) { instance.Execute("NewActivitiesFromTemplate", templateId, sakId, 1, position, asSibling, string.Join(";", mottakere.Select(AktivitetMottakerToString).ToArray())); }
/// <summary> /// Henter tilgangskodene til en bruker. /// </summary> /// <param name="instance">The instance.</param> /// <param name="personnavnId">The personnavn id.</param> /// <returns></returns> public static IEnumerable <string> HentTilgangskoder(this IFunctionManager instance, int personnavnId) { var tilgangskodeIds = (string)instance.Execute("Tilgangskoder", personnavnId); return(tilgangskodeIds.Split(new [] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(tilgangskodeId => tilgangskodeId.Trim())); }
/// <summary> /// Creates the case party letter. /// </summary> /// <param name="instance">The instance.</param> /// <param name="target">The target.</param> /// <param name="type">The type.</param> /// <param name="includeCaseParties">if set to <c>true</c> [include case parties].</param> /// <returns></returns> public static int CreateCasePartyLetter(this IFunctionManager instance, RegistryEntry target, string type, bool includeCaseParties) { return((int)instance.Execute("NyttPartsbrev", target.Id, type, includeCaseParties)); }