Example #1
0
        /// <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())));
        }
Example #2
0
 /// <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()));
 }
Example #3
0
        private EphorteContext(
            Func <IObjectModelAdapter, NcoreVersion, IStateManager> createStateManager,            // Workaround to be able to instantiate a statemanager with a different IQueryProvider
            IObjectModelAdapter objectModelAdapter,
            IFunctionsAdapter functionsAdapter,
            IDocumentsAdapter documentsAdapter,
            IMetadataAdapter metadataAdapter,
            NcoreVersion ncoreVersion
            )
        {
            NcoreVersion = ncoreVersion ?? NcoreVersion.Configured;

            if (objectModelAdapter != null)
            {
                _stateManager       = createStateManager(objectModelAdapter, NcoreVersion);
                _objectModelAdapter = objectModelAdapter;
            }

            if (functionsAdapter != null)
            {
                _functionManager = new FunctionManager(functionsAdapter);
            }

            if (documentsAdapter != null)
            {
                _documentManager = new DocumentManager(documentsAdapter);
            }

            if (metadataAdapter != null)
            {
                _metadataManager = new MetadataManager(metadataAdapter);
            }
        }
Example #4
0
        /// <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()));
        }
Example #5
0
        /// <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()));
        }
Example #6
0
        /// <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);
        }
Example #7
0
        /// <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);
        }
Example #8
0
        /// <summary>
        /// Marks the case as complete.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="completedCase">The @case.</param>
        public static void MarkCaseAsComplete(this IFunctionManager instance, Case completedCase)
        {
            if (completedCase == null)
            {
                throw new ArgumentNullException("completedCase");
            }

            MarkCaseAsComplete(instance, completedCase.Id);
        }
Example #9
0
        /// <summary>
        /// Marks the registry entry as read.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="registryEntry">The registry entry.</param>
        public static void MarkRegistryEntryAsRead(this IFunctionManager instance, RegistryEntry registryEntry)
        {
            if (registryEntry == null)
            {
                throw new ArgumentNullException("registryEntry");
            }

            MarkRegistryEntryAsRead(instance, registryEntry.Id);
        }
Example #10
0
        /// <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);
        }
Example #11
0
        /// <summary>
        /// Marks the sender recipient as read.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="senderRecipient">The sender recipient.</param>
        public static void MarkSenderRecipientAsRead(this IFunctionManager instance, SenderRecipient senderRecipient)
        {
            if (senderRecipient == null)
            {
                throw new ArgumentNullException("senderRecipient");
            }

            MarkSenderRecipientAsRead(instance, senderRecipient.Id);
        }
Example #12
0
        /// <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);
        }
Example #13
0
        /// <summary>
        /// Marks the task as complete.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="task">The task.</param>
        public static void MarkTaskAsComplete(this IFunctionManager instance, Task task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            MarkTaskAsComplete(instance, task.Id);
        }
Example #14
0
        /// <summary>
        /// Marks the case as read.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="readCase">The read case.</param>
        public static void MarkCaseAsRead(this IFunctionManager instance, Case readCase)
        {
            if (readCase == null)
            {
                throw new ArgumentNullException("readCase");
            }

            MarkCaseAsRead(instance, readCase.Id);
        }
Example #15
0
 public Context(IFunctionManager functionManager, IInputManager myInputManager, IFileManager myFileManager, string myPath)
 {
     _variables       = new Dictionary <string, Value>();
     FileManager      = myFileManager;
     _inputManager    = myInputManager;
     _functionManager = functionManager;
     AddVariable(ValueTypes.Path, "thisfile", myPath);
     AddVariable(ValueTypes.Path, "thisdir", Path.GetDirectoryName(myPath));
 }
Example #16
0
        /// <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);
        }
Example #17
0
        /// <summary>
        /// Gets the document templates.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="documentTemplateTypeId">The document template type id.</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 documentTemplateTypeId, int registryEntryId,
                                                                          int documentDescriptionId,
                                                                          params string[] registryEntryTypeIds)
        {
            var documentTemplates = instance.GetDocumentTemplates(registryEntryId, documentDescriptionId,
                                                                  registryEntryTypeIds);

            return(documentTemplates.Where(x => x.DocumentTemplateTypeId == documentTemplateTypeId));
        }
Example #18
0
        /// <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);
        }
Example #19
0
        /// <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);
        }
Example #20
0
        /// <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"])
            });
        }
Example #21
0
        /// <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));
        }
 public MenuApplication(IMenuManager menuManager,
                        IDapperRepository <Menu, long> menuRepository,
                        IDapperRepository <Permission, long> permissionRepository,
                        IDapperRepository <Function, long> functionRepository,
                        IFunctionManager functionManager)
 {
     _menuManager          = menuManager;
     _menuRepository       = menuRepository;
     _permissionRepository = permissionRepository;
     _functionRepository   = functionRepository;
     _functionManager      = functionManager;
 }
Example #23
0
        /// <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);
        }
Example #24
0
 /// <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
     });
 }
Example #25
0
        /// <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);
        }
Example #26
0
        /// <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());
        }
Example #27
0
        /// <summary>
        /// Marks the <see cref="RegistryEntryDocument"/> as complete.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="registryEntryDocument">The target.</param>
        public static void MarkRegistryEntryDocumentAsComplete(this IFunctionManager instance,
                                                               RegistryEntryDocument registryEntryDocument)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (registryEntryDocument == null)
            {
                throw new ArgumentNullException("registryEntryDocument");
            }

            instance.MarkRegistryEntryDocumentAsComplete(registryEntryDocument.RegistryEntryId,
                                                         registryEntryDocument.DocumentDescriptionId);
        }
Example #28
0
        /// <summary>
        ///     This method will be called by SqlRace framework.
        /// </summary>
        /// <param name="functionManager"></param>
        public void Initialize(IFunctionManager functionManager)
        {
            // create the function definition
            var functionDefinition = functionManager.CreateFunctionDefinition(DotNetFunctionConstants.UniqueId, FunctionMode.Instantaneous, CalculationModeInfoDefinition.EachSamplePoint());

            //var functionDefinition = functionManager.CreateFunctionDefinition(DotNetFunctionConstants.UniqueId);
            functionDefinition.CalculateOverWholeSession = false;
            functionDefinition.InterpolateBetweenSamples = false;
            functionDefinition.JoinGapsAroundNull        = false;
            functionDefinition.Name           = FunctionName;
            functionDefinition.StoreInSession = false;

            // set the implementation
            var implementationDefinition = (DotNetFunctionImplementationDefinition)functionDefinition.ImplementationDefinition;

            implementationDefinition.Function = this;

            // create the single output parameter
            functionDefinition.OutputParameterDefinitions.Add(
                new FunctionOutputParameterDefinition
            {
                ApplicationName = ApplicationName,
                ByteOrder       = ByteOrderType.BigEndian,
                Description     = "HelloDotNet.vCarDoubled",
                FormatOverride  = @"%5.2f",
                Name            = ParameterName,
                Units           = "km/h",
                MaximumValue    = "800",
                MinimumValue    = "0",
                ShowInBrowser   = true
            });

            functionDefinition.InputParameterIdentifiers.Add("vCar:Chassis");

            // build the function
            var buildResults = functionManager.Build(functionDefinition);

            // make sure we have no build errors
            if (buildResults.Errors.Count > 0)
            {
                Console.WriteLine($"Error building DotNet function '{FunctionName}': {buildResults.Errors.FirstOrDefault()?.ErrorText}.");
            }
            else
            {
                Console.WriteLine($"DotNet function '{FunctionName}' created successfully.");
            }
        }
Example #29
0
        /// <summary>
        /// Requests the document approval.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="registryEntryDocument">The registry entry document.</param>
        /// <param name="approverUserNameId">The approver user name id.</param>
        public static void RequestDocumentApproval(this IFunctionManager instance,
                                                   RegistryEntryDocument registryEntryDocument,
                                                   int?approverUserNameId = null)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (registryEntryDocument == null)
            {
                throw new ArgumentNullException("registryEntryDocument");
            }

            instance.RequestDocumentApproval(registryEntryDocument.RegistryEntryId,
                                             registryEntryDocument.DocumentDescriptionId, approverUserNameId ?? 0);
        }
Example #30
0
        /// <summary>
        /// Marks the registry entry as followed up.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="recipient">The recipient.</param>
        /// <param name="followUpMethod">The follow up method.</param>
        /// <param name="remark">The remark.</param>
        public static void MarkRegistryEntryAsFollowedUp(this IFunctionManager instance, SenderRecipient recipient,
                                                         string followUpMethod, string remark)
        {
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            if (!recipient.RegistryEntryId.HasValue)
            {
                throw new ArgumentException(
                          Resources.FunctionManagerExtensions_The_recipient_must_have_a_valid_RegistryEntryId, "recipient");
            }

            MarkRegistryEntryAsFollowedUp(instance, recipient.RegistryEntryId.Value, recipient.Id, followUpMethod,
                                          remark);
        }
 public DeploymentManager(ISiteBuilderFactory builderFactory,
                          IEnvironment environment,
                          ITraceFactory traceFactory,
                          IAnalytics analytics,
                          IDeploymentSettingsManager settings,
                          IDeploymentStatusManager status,
                          IOperationLock deploymentLock,
                          ILogger globalLogger,
                          IWebHooksManager hooksManager,
                          IFunctionManager functionManager)
 {
     _builderFactory = builderFactory;
     _environment = environment;
     _traceFactory = traceFactory;
     _analytics = analytics;
     _deploymentLock = deploymentLock;
     _globalLogger = globalLogger ?? NullLogger.Instance;
     _settings = settings;
     _status = status;
     _hooksManager = hooksManager;
     _functionManager = functionManager;
 }
Example #32
0
 public FunctionController(IFunctionManager manager, ITraceFactory traceFactory, IEnvironment environment)
 {
     _manager = manager;
     _traceFactory = traceFactory;
     _environment = environment;
 }
Example #33
0
 private void LoadDefaults()
 {
     LoadProgramsInSameAddressSpace = false;
     FuncManager = null;
     IsCalledFromRun = true;
 }
Example #34
0
 public FunctionController(IFunctionManager manager, ITraceFactory traceFactory)
 {
     _manager = manager;
     _traceFactory = traceFactory;
 }