コード例 #1
0
        /// <summary>
        /// Updates an existing organizational unit to the given values.
        /// </summary>
        /// <param name="updatedUnit">The updated unit.</param>
        /// <returns>MethodResult indicating success.</returns>
        public MethodResult UpdateOrganizationalUnit(OrganizationalUnit updatedUnit)
        {
            var adapter = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>();

            if (updatedUnit.IsPrincipalUnit)
            {
                var current = adapter.GetOrganizationalUnitById(updatedUnit.Id);
                if (current.AdminMailAddress != updatedUnit.AdminMailAddress)
                {
                    var user       = adapter.GetUserByMailAddress(current.AdminMailAddress);
                    var tempResult = new UserController().ChangeMailAddress(user, updatedUnit.AdminMailAddress);
                    if (!tempResult.IsSucceeded())
                    {
                        return(tempResult);
                    }

                    tempResult = new UserController().ResetPassword(updatedUnit.AdminMailAddress);
                    if (!tempResult.IsSucceeded())
                    {
                        return(tempResult);
                    }
                }

                if (current.Name == updatedUnit.Name)
                {
                    return(new MethodResult());
                }
            }

            return(adapter.RenameOrganizationalUnit(updatedUnit.Id, updatedUnit.Name));
        }
コード例 #2
0
        /// <summary>
        /// Changes the users mail address.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="newUserMail">The new mail address.</param>
        /// <returns>MethodResult indicating success.</returns>
        public MethodResult ChangeMailAddress(User user, string newUserMail)
        {
            if (string.IsNullOrWhiteSpace(newUserMail) || (newUserMail.Contains("@") == false))
            {
                throw new InvalidDataException("Invalid mail address.");
            }

            var oldMail = user.MailAddress;
            var result  = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>().ChangeMailAddress(user, newUserMail);

            if (result.IsSucceeded())
            {
                string newPasswordAppender = null;
                if (user.MustChangePassword)
                {
                    var innerResult = InnerResetPassword(newUserMail);
                    if (innerResult.IsSucceeded())
                    {
                        newPasswordAppender =
                            string.Format(ClipperTexts.NewlyGeneratedPasswordOnMailReset, innerResult.Result);
                    }
                }

                QuerySendMailAsync(user, ClipperTexts.MailChangedMailSubject, ClipperTexts.MailChangedMailBody + newPasswordAppender);
                QuerySendMailAsync(new Notifiable(oldMail, user.UserName), ClipperTexts.MailChangedMailSubject, ClipperTexts.MailChangedMailBody);
            }

            return(result);
        }
コード例 #3
0
        private void textBoxInputFileName_TextChanged(object sender, EventArgs e)
        {
            string filename = textBoxInputFileName.Text.Trim();

            if (File.Exists(filename))
            {
                //Create input database adapter
                tp.InputDatabase          = DatabaseAdapterFactory.CreateReader(Path.GetExtension(filename), CheckBoxEditMode.Checked);
                tp.InputDatabase.FileName = filename;

                textBoxInputFileName.ForeColor = System.Drawing.SystemColors.WindowText;
                //Fill tables list
                comboBoxTableName.Items.Clear();

                comboBoxTableName.Items.AddRange(tp.InputDatabase.GetTables());
                if (comboBoxTableName.Items.Count == 1)
                {
                    comboBoxTableName.SelectedIndex = 0;
                }
                else
                {
                    comboBoxTableName.Text = "";
                }
            }
            else
            {
                textBoxInputFileName.ForeColor = Color.Red;
            }
        }
コード例 #4
0
        public Endpoint()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();

            adapters.Add(factory.Create("sqlserver"));
            adapters.Add(factory.Create("oracle"));
        }
コード例 #5
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case ListItemType.Item:
            case ListItemType.AlternatingItem:
            {
                // Find secondary DDL
                DropDownList DropDownList2 = e.Item.FindControl("DropDownList2") as DropDownList;
                if (DropDownList2 != null)
                {
                    string filename = Session["InputFileName"].ToString();
                    //input fields
                    IDatabaseAdapter inputDatabase = DatabaseAdapterFactory.CreateReader(Path.GetExtension(filename), CheckBoxEditMode.Checked);
                    List <string>    tables        = (List <string>)Session["tables"];

                    inputDatabase.Connect(Session["InputFileName"].ToString());
                    Dictionary <string, int> fields = inputDatabase.GetFields(tables[0]);

                    DropDownList2.Items.Clear();
                    DropDownList2.Items.Add("");
                    foreach (KeyValuePair <string, int> row in fields)
                    {
                        var item = new ListItem(row.Key);
                        //Set field if it present in input document
                        DropDownList2.Items.Add(item);
                    }
                }
                break;
            }
            }
        }
コード例 #6
0
        void FillMapFields()
        {
            string filename = Session["InputFileName"].ToString();
            //input fields
            IDatabaseAdapter inputDatabase = DatabaseAdapterFactory.CreateReader(Path.GetExtension(filename), CheckBoxEditMode.Checked);
            List <string>    tables        = (List <string>)Session["tables"];

            inputDatabase.Connect(filename);
            Dictionary <string, int> fields = inputDatabase.GetFields(tables[0]);

            //target fields
            TableProcessorNS.TableProcessor tp = new TableProcessorNS.TableProcessor();
            List <string> modules           = (List <string>)Session["Modules"];
            var           processorFileName = Server.MapPath(Path.Combine("Modules", modules[0]));

            tp.SetRecordProcessor(processorFileName);

            Dictionary <Field, bool> transformFields = tp.GetTransformFields();

            DataTable transformFieldsTable = new DataTable();

            transformFieldsTable = new DataTable();
            transformFieldsTable.Columns.Add("targetField");
            transformFieldsTable.Columns.Add("inputField");
            transformFieldsTable.Columns["targetField"].ReadOnly = true;

            foreach (KeyValuePair <Field, bool> row in transformFields)
            {
                transformFieldsTable.Rows.Add(row.Key.Name, "");
            }

            Repeater1.DataSource = transformFieldsTable;
            Repeater1.DataBind();
        }
コード例 #7
0
        public void Test()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();
            IDatabaseAdapter       a       = factory.Create("oracle");
            IDatabaseAdapter       b       = factory.Create("sqlserver");

            b.SetData(a.GetData());
        }
コード例 #8
0
        public void Test1()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();
            IDatabaseAdapter       adapter = factory.Create("oracle");

            Assert.AreEqual("oracle", adapter.ProviderName);
            Assert.IsInstanceOf(typeof(OracleAdapter), adapter);
        }
コード例 #9
0
        public void Test()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();
            IDatabaseAdapter       adapter = factory.Create("oracle");

            Assert.AreEqual <string>("oracle", adapter.ProviderName);
            Assert.AreEqual <Type>(typeof(OracleAdapter), adapter.GetType());
        }
コード例 #10
0
        /// <summary>
        /// Resets a given users password
        /// </summary>
        /// <param name="userMail">The mail of the of which the pw should be reset.</param>
        /// <returns>MethodResult containing generated password.</returns>
        private static MethodResult <string> InnerResetPassword(string userMail)
        {
            var newPassword = PasswordGenerator.GeneratePw();
            var result      = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>().ResetPassword(userMail, newPassword);

            return(result.IsSucceeded()
                ? new MethodResult <string>(newPassword)
                : new MethodResult <string>(result == null ? SuccessState.UnknownError : result.Status, result?.UserMessage, null));
        }
コード例 #11
0
        /// <summary>
        /// Gets the feed data.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <param name="feedId">The feed id.</param>
        /// <param name="page">The requested page.</param>
        /// <param name="showArchived">A value indicating whether the archived articles should be shown or not.</param>
        /// <returns>List of <see cref="ShortArticle"/>s within the feed.</returns>
        public IReadOnlyCollection <ShortArticle> GetFeed(Guid userId, Guid feedId, int page, bool showArchived)
        {
            var adapter       = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>();
            var data          = adapter.GetFeedRequestData(userId, feedId);
            var since         = showArchived ? DateTime.MinValue : data.Item2;
            var inheritedUnit = adapter.GetUnitInheritedBlackList(userId);

            return(DatabaseAdapterFactory.GetControllerInstance <IIndexerService>().GetFeedAsync(data.Item1, since, data.Item3, page, inheritedUnit).Result);
        }
コード例 #12
0
        public Endpoint()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();

            adapters.Add(factory.Create("sqlserver"));
            adapters.Add(factory.Create("oracle"));

            // 构造函数部分执行其他Adapter的构造、准备工作的相关任务
        }
コード例 #13
0
        public void GetControllerTest()
        {
            var firstController = DatabaseAdapterFactory.GetControllerInstance <IIndexerService>();

            Assert.IsNotNull(firstController);

            var secondController = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>();

            Assert.IsNotNull(secondController);
        }
コード例 #14
0
        /// <summary>
        /// Attempts to change the password.
        /// </summary>
        /// <param name="user">The users mail address</param>
        /// <param name="newPassword">The new user password.</param>
        /// <returns>MethodResult indicating success.</returns>
        public MethodResult ChangePassword(User user, string newPassword)
        {
            if (string.IsNullOrWhiteSpace(newPassword))
            {
                throw new InvalidDataException("Invalid password");
            }
            var result = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>().ChangePassword(user, newPassword);

            if (result.IsSucceeded())
            {
                QuerySendMailAsync(user, ClipperTexts.PasswordChangedMailSubject, ClipperTexts.PasswordChangedMailBody);
            }

            return(result);
        }
コード例 #15
0
        public void InvalidControllerInterface()
        {
            Exception t = null;

            try
            {
                // ReSharper disable once UnusedVariable
                var tmp = DatabaseAdapterFactory.GetControllerInstance <IClipperUserAPI>();
            }
            catch (Exception e)
            {
                t = e;
            }

            Assert.IsTrue(t is ArgumentOutOfRangeException);
        }
コード例 #16
0
        /// <summary>
        /// Notifies the Observer that (probably) new web page content has been detected by a crawler.
        /// Note: Must be thread safe
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="description">The image description</param>
        /// <param name="link">The link.</param>
        /// <param name="imageLink">The link of the image.</param>
        /// <param name="published">The published date.</param>
        /// <param name="source">The source.</param>
        /// <returns>If indexing is required: a task with the corresponding indexing job.
        /// <para>Otherwise: a completed Task</para></returns>
        public Task NotifyNewImageContentFoundThreadSafe(string title, string description, string imageLink, string link,
                                                         DateTime published, Source source)
        {
            if (DoesNotViolateBlackList(source, title) && DoesNotViolateBlackList(source, description))
            {
                var article = new Article(Guid.NewGuid(),
                                          title,
                                          link,
                                          imageLink,
                                          description,
                                          published,
                                          DateTime.UtcNow,
                                          source.Id);
                var job = DatabaseAdapterFactory.GetControllerInstance <IIndexerService>().IndexArticleThreadSafeAsync(article);
                return(job ?? Task.CompletedTask);
            }

            return(Task.CompletedTask);
        }
コード例 #17
0
        public void IndexArticleTest()
        {
            var elasticController = DatabaseAdapterFactory.GetControllerInstance <IIndexerService>();
            var milliseconds      = DateTimeOffset.Now.ToUnixTimeMilliseconds();
            var guid        = Guid.NewGuid();
            var indexedguid = Guid.NewGuid();
            var articleOne  = new Article(guid, "abgef" + milliseconds,
                                          "http://" + milliseconds + ".de", "http://" + milliseconds + ".de", "abgefssmt",
                                          DateTime.Today, DateTime.Today, indexedguid);

            try
            {
                elasticController.IndexArticleThreadSafeAsync(articleOne);
                Assert.IsTrue(true);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
コード例 #18
0
        private void buttonStart_Click(object sender, System.EventArgs e)
        {
            buttonStart.Enabled = false;
            try
            {
                string filename    = textBoxInputFileName.Text.Trim();
                string outfilename = textBoxOutputFileName.Text.Trim();
                //extract settings
                tp.InputDatabase = DatabaseAdapterFactory.CreateReader(Path.GetExtension(filename), CheckBoxEditMode.Checked);

                tp.InputDatabase.FileName = filename;
                //transform settings
                tp.tableName          = comboBoxTableName.Text;
                tp.InputFieldNamesMap = TableProcessor.DeserializeFieldsMap(textBoxFieldsMapping.Text);

                //load settings

                //If Edit mode - copy original and open for wrtiting
                if (CheckBoxEditMode.Checked)
                {
                    tp.OutputDatabase = DatabaseAdapterFactory.CreateWriter(Path.GetExtension(outfilename));
                    tp.ProcessMode    = ProcessMode.pmEdit;
                }

                tp.OutputDatabase.FileName = outfilename;

                tp.Progress = new ProgressBarMonitor(toolStripProgressBar1, toolStripStatusLabel1, 100);

                int.TryParse(textBoxOffset.Text, out tp.ProcessOffset);

                tp.Process();

                string Msg = Path.GetFileName(tp.InputDatabase.FileName) + " processing complete";
                MessageBox.Show(this, Msg, "Results");
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message + " " + ex.StackTrace, "Error");
            }
            buttonStart.Enabled = true;
        }
コード例 #19
0
        void FillTables()
        {
            //OleDbDatabaseAdapter inputDatabase = new OleDbDatabaseAdapter();
            string           infilename    = Session["InputFileName"].ToString();
            IDatabaseAdapter inputDatabase = DatabaseAdapterFactory.CreateReader(Path.GetExtension(infilename), CheckBoxEditMode.Checked);

            inputDatabase.FileName = infilename;

            string[] tables = inputDatabase.GetTables();

            CheckBoxListTables.Items.Clear();
            foreach (string tablename in tables)
            {
                CheckBoxListTables.Items.Add(tablename);
            }

            if (CheckBoxListTables.Items.Count == 1)
            {
                CheckBoxListTables.Items[0].Selected = true;
            }
        }
コード例 #20
0
        protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            Session["progress"] = new BaseProgress();
            SetMappings();
            //Start Processing
            TableProcessorNS.TableProcessor tp = new TableProcessorNS.TableProcessor();
            tp.Progress = (BaseProgress)Session["progress"];

            string inputFileName  = Session["InputFileName"].ToString().Trim();
            string outputFileName = Path.Combine(Path.GetDirectoryName(inputFileName), TextBoxOutputFileName.Text);

            tp.InputDatabase          = DatabaseAdapterFactory.CreateReader(Path.GetExtension(inputFileName), CheckBoxEditMode.Checked);
            tp.InputDatabase.FileName = inputFileName;
            tp.InputDatabase.Connect(inputFileName);
            List <string> tables = (List <string>)Session["tables"];

            tp.tableName = tables[0];
            List <string> modules = (List <string>)Session["Modules"];

            tp.SetRecordProcessor(Server.MapPath(Path.Combine("Modules", modules[0])));

            tp.InputFieldNamesMap = TableProcessor.DeserializeFieldsMap((string)Session["Mappings"]);



            //If Edit mode - copy original and open for wrtiting
            if (CheckBoxEditMode.Checked)
            {
                tp.OutputDatabase = DatabaseAdapterFactory.CreateWriter(Path.GetExtension(outputFileName));
                tp.ProcessMode    = ProcessMode.pmEdit;
            }

            tp.OutputDatabase.FileName = outputFileName;

            Thread run = new Thread(new ThreadStart(tp.Process));

            run.Start();
            Response.Write("Process started");
        }
コード例 #21
0
        /// <summary>
        /// Administratively adds a user.
        /// </summary>
        /// <param name="toAdd">The user to add.</param>
        /// <param name="userUnits">The users units.</param>
        /// <returns>MethodResult indicating success.</returns>
        public MethodResult AdministrativelyAddUser(User toAdd, IReadOnlyList <Guid> userUnits)
        {
            var password = PasswordGenerator.GeneratePw();
            var result   = Factory.GetControllerInstance <IClipperDatabase>().AddUser(toAdd.MailAddress, toAdd.UserName,
                                                                                      password, toAdd.Role, toAdd.PrincipalUnitId,
                                                                                      userUnits[0], true, true);
            MethodResult innerResult = result;

            if (result.IsSucceeded())
            {
                if (userUnits.Count > 1)
                {
                    innerResult = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>()
                                  .SetUserOrganizationalUnits(result.Result, userUnits.Skip(1));
                }

                QuerySendMailAsync(toAdd, ClipperTexts.AccountCreatedMailSubject,
                                   string.Format(ClipperTexts.AccountCreatedMailBody, toAdd.UserName, password));
            }

            return(innerResult);
        }
コード例 #22
0
        /// <summary>
        /// Notifies the Observer that a (probably) new Rss feed item has been detected by a crawler.
        /// Note: Must be thread safe
        /// </summary>
        /// <param name="item">The item to index</param>
        /// <param name="rssKey">The belonging rss key.</param>
        /// <param name="source">The source.</param>
        /// <returns>If indexing is required: a task with the corresponding indexing job.
        /// <para>Otherwise: a completed Task</para></returns>
        public Task NotifyNewRssFeedFoundThreadSave(SyndicationItem item, RssKey rssKey, Source source)
        {
            var plainText  = item.Summary?.Text?.GetTextFromHtml() ?? string.Empty;
            var plainTitle = item.Title?.Text.GetTextFromHtml() ?? source.Name;

            if (DoesNotViolateBlackList(source, plainText) && DoesNotViolateBlackList(source, plainTitle))
            {
                var article = new Article(Guid.NewGuid(),
                                          plainTitle,
                                          rssKey.Link,
                                          null,
                                          plainText,
                                          new DateTime(rssKey.Updated),
                                          DateTime.UtcNow,
                                          source.Id);
                var job = DatabaseAdapterFactory.GetControllerInstance <IIndexerService>()
                          .IndexRssFeedItemThreadSafeAsync(article, rssKey);
                return(job ?? Task.CompletedTask);
            }

            return(Task.CompletedTask);
        }
コード例 #23
0
        /// <summary>
        /// Modifies the user.
        /// </summary>
        /// <param name="toModify">The user to modify.</param>
        /// <param name="userUnits">The users units.</param>
        /// <returns>MethodResult indicating success.</returns>
        public MethodResult ModifyUser(User toModify, IReadOnlyList <Guid> userUnits)
        {
            var adapter     = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>();
            var currentUser = GetUserInfo(toModify.Id);

            if (toModify.UserMailAddress != currentUser.MailAddress)
            {
                var result = ChangeMailAddress(toModify, toModify.UserMailAddress);
                if (!result.IsSucceeded())
                {
                    return(result);
                }
            }

            if (toModify.UserName != currentUser.UserName || toModify.Role != currentUser.Role ||
                toModify.IsValid != currentUser.IsValid ||
                !userUnits.ToHashSet().SetEquals(currentUser.OrganizationalUnits.Select(x => x.Id)))
            {
                return(adapter.ModifyUser(toModify.Id, toModify.UserName, toModify.Role, toModify.IsValid, userUnits));
            }

            return(new MethodResult());
        }
コード例 #24
0
        public static T GetControllerInstance <T>()
        {
            if (typeof(T) == typeof(IClipperUserAPI) ||
                typeof(IClipperSystemAdministratorAPI) == typeof(T) ||
                typeof(IClipperStaffChiefAPI) == typeof(T))
            {
                return((T)(object)new UserController());
            }

            if (typeof(T) == typeof(IClipperDatabase))
            {
                return((T)DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>());
            }

            if (typeof(T) == typeof(IClipperService))
            {
                return((T)(object)new StatusController());
            }

            if (typeof(T) == typeof(IClipperOrganizationalUnitAPI))
            {
                return((T)(object)new OrganizationalUnitController());
            }

            if (typeof(T) == typeof(ICrawlerController))
            {
                return((T)(object)CrawlerController.GetCrawlerController());
            }

            if (typeof(T) == typeof(INotificationController))
            {
                return((T)(object)new NotificationControllerWrapper());
            }

            throw new ArgumentOutOfRangeException(nameof(T));
        }
コード例 #25
0
 /// <summary>
 /// Gets the user settings.
 /// </summary>
 /// <param name="userId">The user id.</param>
 /// <returns>The settings of the given user.</returns>
 public UserSettings GetUserSettings(Guid userId)
 {
     return(DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>().GetUserSettingsByUserId(userId));
 }
コード例 #26
0
 /// <summary>
 /// Gets a specific article.
 /// </summary>
 /// <param name="articleId">The article id.</param>
 /// <returns>The (full) <see cref="Article"/>.</returns>
 public Article GetArticle(Guid articleId)
 {
     return(DatabaseAdapterFactory.GetControllerInstance <IIndexerService>().GetArticleAsync(articleId).Result);
 }
コード例 #27
0
        /// <summary>
        /// Checks if new feeds available and if notification and what kind of notification is wanted.
        /// </summary>
        /// <param name="timerState">The timer state.</param>
        private static void CheckForNotifications(object timerState)
        {
            using (new PerfTracer(nameof(CheckForNotifications)))
            {
                try
                {
                    Scheduler.Change(Timeout.Infinite, Timeout.Infinite);
                    var notifiableUserSettings = Factory.GetControllerInstance <IClipperDatabase>().GetNotifiableUserSettings();
                    var parallelOpts           = new ParallelOptions
                    {
                        MaxDegreeOfParallelism = AppConfiguration.MaxNotificationJobDegreeOfParallelism
                    };
                    Parallel.ForEach(notifiableUserSettings, parallelOpts, (notifiable) =>
                    {
                        if (notifiable != null && notifiable.Settings != null &&
                            notifiable.Settings.NotificationSettings != NotificationSetting.None &&
                            notifiable.Settings.Feeds.Any())
                        {
                            var lastFetched = LastCheckTime.TryGetOrAddIfNotPresentOrNull(notifiable.UserId);
                            if (lastFetched < notifiable.LastLoginTime)
                            {
                                lastFetched = notifiable.LastLoginTime;
                            }

                            if (lastFetched.AddMinutes(notifiable.Settings.NotificationCheckIntervalInMinutes) <= DateTime.UtcNow)
                            {
                                LastCheckTime[notifiable.UserId] = DateTime.UtcNow;
                                var indexer = DatabaseAdapterFactory.GetControllerInstance <IIndexerService>();
                                var feeds   = indexer.GetCompleteFeedAsync(notifiable.Settings, lastFetched).GetAwaiter().GetResult();

                                if (feeds.Any())
                                {
                                    // We need to loop though all (-> blacklists)
                                    // Anyways one query to determine if at least something COULD be relevant is way better than x querys
                                    // which determine nothing is relevant at all.
                                    var blackList = DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>()
                                                    .GetUnitInheritedBlackList(notifiable.UserId);

                                    //These can run in parallel aswell, as the main amount of time is waiting for elastic
                                    feeds = notifiable.Settings.Feeds
                                            .AsParallel()
                                            .WithDegreeOfParallelism(AppConfiguration.MaxNotificationJobDegreeOfParallelism)
                                            .Select(f => indexer.GetFeedAsync(f, lastFetched, 100000, 0, blackList).Result)
                                            .SelectMany(s => s)
                                            .Distinct(ArticleComparer.ShortArticleComparer).ToList();
                                    if (feeds.Any())
                                    {
                                        var defText = "Visit " + AppConfiguration.MailConfigurationFELoginLink + notifiable.PrincipalUnitName;
                                        if (notifiable.Settings.NotificationSettings == NotificationSetting.PdfPerMail)
                                        {
                                            var pdf = PdfGenerator.GeneratePdf(feeds, notifiable.UserName);
                                            MailController.QuerySendMailAsync(notifiable, ClipperTexts.DefaultMailSubject, defText,
                                                                              pdf, "Clipper.pdf");
                                        }
                                        else
                                        {
                                            MailController.QuerySendMailAsync(notifiable, ClipperTexts.DefaultMailSubject, defText);
                                        }
                                    }
                                }
                            }
                        }
                    });
                }
                catch (Exception error)
                {
                    Console.WriteLine(error);
                }
                finally
                {
                    Scheduler.Change(60 * 1000, Timeout.Infinite);
                }
            }
        }
コード例 #28
0
 /// <summary>
 /// Gets all information on a user
 /// </summary>
 /// <param name="requested">The id of the user whose information is requested</param>
 /// <returns>All the information on a user like the <see cref="OrganizationalUnit"/>s he belongs to</returns>
 public ExtendedUser GetUserInfo(Guid requested)
 {
     return(DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>().GetUserInfo(requested));
 }
コード例 #29
0
 /// <summary>
 /// Gets the minimal information of the users a staffchief can manage
 /// </summary>
 /// <param name="userId">The id of the staffchief</param>
 /// <returns>A list of <see cref="BasicUserInformation"/> if the given id actually belonged to a staffchief</returns>
 public IReadOnlyList <BasicUserInformation> GetManageableUsers(Guid userId)
 {
     return(DatabaseAdapterFactory.GetControllerInstance <IClipperDatabase>().GetManageableUsers(userId));
 }
コード例 #30
0
 /// <summary>
 /// Clears all indexes (use with care, this is a permanent operation).
 /// </summary>
 public void ClearAllIndexes()
 {
     DatabaseAdapterFactory.GetControllerInstance <IIndexerService>().ClearIndex();
 }