internal void initData() { if (Utilities.Runningintestmode) { Roomname = "c/1457606766"; Roomname_daily = "c/1151058807"; Roomname_weekly = "c/1233617142"; } logger.Info("Lade Autor-Manager"); this.authors = new AuthorManager(); logger.Info("Lade Posting-Manager"); this.posts = new PostingManager(); logger.Info("Lade Statistik-Manager"); this.statistics = new DRaumStatistics(); logger.Info("Lade Feedback-Manager"); this.feedbackManager = new FeedbackManager(); if (!this.loadDataFromFiles()) { this.startupinfo = "!!! Server ist ohne Daten gestartet !!!"; logger.Info("Lade Autor-Manager neu"); this.authors = new AuthorManager(); logger.Info("Lade Posting-Manager neu"); this.posts = new PostingManager(); logger.Info("Lade Statistik-Manager neu"); this.statistics = new DRaumStatistics(); logger.Info("Lade Feedback-Manager neu"); this.feedbackManager = new FeedbackManager(); } else { this.startupinfo = "Server ist gestartet"; } this.textBuilder = new PostingTextBuilder(this.posts, this.authors); this.startupinfo += "\r\nMaximale Autorenzahl:" + AuthorManager.Maxmanagedusers; }
public ViewHome() { InitializeComponent(); ComicStripManager sm = new ComicStripManager(new UnitOfWork()); Comicstrips = new StripGrid(StripsGrid, sm.GetAll()); Comicstrips.SetDeleteButton(Button_DeleteStrips); Comicstrips.SetEditButton(Button_EditStrip); AuthorManager am = new AuthorManager(new UnitOfWork()); Authors = new AuthorGrid(AuthorsGrid, am.GetAll()); Authors.SetDeleteButton(Button_DeleteAuthors); Authors.SetEditButton(Button_EditAuthor); PublisherManager pm = new PublisherManager(new UnitOfWork()); Publishers = new PublisherGrid(PublishersGrid, pm.GetAll()); Publishers.SetDeleteButton(Button_DeletePublishers); Publishers.SetEditButton(Button_EditPublisher); ComicstripBundleManager bm = new ComicstripBundleManager(new UnitOfWork()); Bundles = new BundleGrid(BundlesGrid, bm.GetAll()); Bundles.SetDeleteButton(Button_DeleteBundles); Bundles.SetEditButton(Button_EditBundles); }
private void ClearResultSearchingByAuthor() { var activeViewModel = MainWindowViewModel.Value.ActiveDocumentViewModel; activeViewModel.BookCabinet.ClearSearchResult(); AuthorManager.ClearSearchResult(); }
protected void Page_Load(object sender, EventArgs e) { AuthorTBx author = new AuthorTBx(); AuthorManager am = new AuthorManager(); author = am.GetByID(Convert.ToInt32(Request["id"])); author.Name = Request["name"]; author.Phone = Request["phone"]; author.Desc = Request["desc"]; author.Email = Request["email"]; string listcat = Request["listcat"]; Author_CategoryManager acm = new Author_CategoryManager(); List <Author_CategoryTBx> listauthorcatnew = new List <Author_CategoryTBx>(); for (int i = 0; i < listcat.Split('@').Length - 1; i++) { Author_CategoryTBx authorcat = new Author_CategoryTBx(); authorcat.CategoryID = Convert.ToInt32(listcat.Split('@')[i]); authorcat.AuthorID = author.ID; listauthorcatnew.Add(authorcat); } List <Author_CategoryTBx> listauthorcat = new List <Author_CategoryTBx>(); listauthorcat = acm.GetListID(author.ID); acm.DeleteCat(listauthorcat); acm.AddNew(listauthorcatnew); am.Save(); }
protected void ButtonSave_Click(object sender, EventArgs e) { // create new author object if this is a new user, retrieve existing author object if one is being edited Author author = null; if (Request.QueryString["user"] == null) { // new user author = new Author(); } else { // edit user author = AuthorManager.GetItem(long.Parse(Request.QueryString["user"].ToString())); } TextBox tbName = (TextBox)FormViewAuthor.FindControl("AuthorUserName"); author.username = tbName.Text; TextBox tbPassword = (TextBox)FormViewAuthor.FindControl("AuthorPassword"); author.password = tbPassword.Text; AuthorManager.Save(author); Response.Redirect("~/View/Pages/Admin/AdminAuthors.aspx"); }
public void DeleteByID() { var manager = new ComicStripManager(new UnitOfWork("development")); manager.DeleteAll(); var publisherManager = new PublisherManager(new UnitOfWork("development")); publisherManager.DeleteAll(); publisherManager.Add(new Publisher("test-publisher")); var AuthorManager = new AuthorManager(new UnitOfWork("development")); AuthorManager.DeleteAll(); AuthorManager.Add(new Author("test-author", "test-author")); manager.Add(new BusinessLayer.Models.ComicStrip("test-strip", new ComicstripSerie("testSerie"), 5, AuthorManager.GetAll(), publisherManager.GetAll()[0])); var comic = manager.GetAll(); Assert.AreEqual(comic.Count, 1); var comc = manager.Get(comic[0].ID); Assert.AreEqual(comc.Titel, "test-strip"); Assert.AreEqual(comc.Number, 5); manager.Delete(comc.ID); comic = manager.GetAll(); Assert.AreEqual(comic.Count, 0); publisherManager.DeleteAll(); AuthorManager.DeleteAll(); manager.DeleteAll(); }
public IdentityServerDataSeedContributor( IClientRepository clientRepository, IApiResourceRepository apiResourceRepository, IApiScopeRepository apiScopeRepository, IIdentityResourceDataSeeder identityResourceDataSeeder, IGuidGenerator guidGenerator, IPermissionDataSeeder permissionDataSeeder, IConfiguration configuration, ICurrentTenant currentTenant, IRepository <Book, Guid> bookRepository, IAuthorRepository authorRepository, AuthorManager authorManager) { _clientRepository = clientRepository; _apiResourceRepository = apiResourceRepository; _apiScopeRepository = apiScopeRepository; _identityResourceDataSeeder = identityResourceDataSeeder; _guidGenerator = guidGenerator; _permissionDataSeeder = permissionDataSeeder; _configuration = configuration; _currentTenant = currentTenant; _bookRepository = bookRepository; _authorRepository = authorRepository; _authorManager = authorManager; }
public void Update() { var manager = new AuthorManager(new UnitOfWork("development")); manager.DeleteAll(); manager.Add(new BusinessLayer.Models.Author("test-first", "test-Last")); var authors = manager.GetAll(); Assert.AreEqual(authors.Count, 1); var author = manager.Get(authors[0].ID); Assert.AreEqual(author.Firstname, "test-first"); Assert.AreEqual(author.Surname, "test-Last"); author.SetSurname("test-Sur"); author.SetFirstName("test-First"); manager.Update(author); authors = manager.GetAll(); Assert.AreEqual(authors.Count, 1); author = manager.Get(authors[0].ID); Assert.AreEqual(author.Firstname, "test-First"); Assert.AreEqual(author.Surname, "test-Sur"); manager.DeleteAll(); }
public AuthorAppService( IAuthorRepository authorRepository, AuthorManager authorManager) { _authorRepository = authorRepository; _authorManager = authorManager; }
protected void Page_Load(object sender, EventArgs e) { settingsItem = XBlogHelper.General.DataManager.GetBlogSettingsItem(DataSourceItem != null ? DataSourceItem : Sitecore.Context.Item); authorCount = AuthorManager.GetAuthorCount(DataSourceItem != null ? DataSourceItem : Sitecore.Context.Item); // set title frTitle.FieldName = BlogSettings.AuthorListTitleFieldId; frTitle.Item = settingsItem.InnerItem; //Get search results IEnumerable <Author> authors = null; if (settingsItem.OrderAuthorOnCount) { authors = AuthorManager.GetAuthorsOrderedByCount(authorCount); } else { authors = AuthorManager.GetAuthors(DataSourceItem != null ? DataSourceItem : Sitecore.Context.Item); } // Set max display authors = AuthorManager.SetAuthorDisplayLimit(settingsItem.AuthorListMaxAuthorsToDisplay, authors); if (authors == null || !authors.Any()) { return; } // Bind data source lvAuthorList.DataSource = authors; lvAuthorList.DataBind(); }
// GET: Authors public ActionResult Index(string searchString, string currentFilter, int?page) { if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; int pageSize = 15; int pageNumber = (page ?? 1); if (!String.IsNullOrEmpty(searchString)) { AuthorManager incomingAuthors = new AuthorManager(); var authorList = incomingAuthors.getAuthors(searchString); return(View("Authors", authorList.ToPagedList(pageNumber, pageSize))); } else { AuthorManager incomingAuthors = new AuthorManager(); var authorList = incomingAuthors.getAllAuthors(); return(View("Authors", authorList.ToPagedList(pageNumber, pageSize))); } }
// lists all the authors on the db and sends as paged list public ActionResult ListAuthors(int?page) { IList <Author> allAuthors = AuthorManager.GetAuthorList(); int currentPageIndex = page.HasValue ? page.Value - 1 : 0; return(View("ListAuthors", allAuthors.ToPagedList(currentPageIndex, DefaultPageSize))); }
public void Get() { var manager = new ComicStripManager(new UnitOfWork("development")); manager.DeleteAll(); var publisherManager = new PublisherManager(new UnitOfWork("development")); publisherManager.DeleteAll(); publisherManager.Add(new Publisher("test-publisher")); var AuthorManager = new AuthorManager(new UnitOfWork("development")); AuthorManager.DeleteAll(); AuthorManager.Add(new Author("test-author", "test-author")); manager.Add(new BusinessLayer.Models.ComicStrip("test-strip", new ComicstripSerie("testSerie"), 5, AuthorManager.GetAll(), publisherManager.GetAll()[0])); var comic = manager.GetAll(); var bundleManager = new ComicstripBundleManager(new UnitOfWork("development")); bundleManager.DeleteAll(); bundleManager.Add(new ComicstripBundle("test-bundle", comic, publisherManager.GetAll()[0])); var bundles = bundleManager.GetAll(); var bundle = bundleManager.Get(bundles[0].ID); Assert.AreEqual(bundles.Count, 1); Assert.AreEqual(bundle.Titel, "test-bundle"); Assert.AreEqual(bundle.Comicstrips.Count, 1); manager.DeleteAll(); AuthorManager.DeleteAll(); bundleManager.DeleteAll(); }
public void checkMassPostings() { AuthorManager.Maxmanagedusers = int.MaxValue; Utilities.Runningintestmode = true; AuthorManager authors = new AuthorManager(); PostingManager postings = new PostingManager(); NLog.LogManager.DisableLogging(); for (int i = 0; i < 5000; i++) { authors.getCoolDownTimer(10000 + i, "autor_" + i, Author.InteractionCooldownTimer.Default); } int authorid = 10000; for (int monat = 1; monat <= 6; monat++) { for (int tag = 1; tag <= 30; tag++) { for (int postcount = 0; postcount < 200; postcount++) { postings.addPosting("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt " + "ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo " + "dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit " + "amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor " + "invidunt ut labor" + postcount + ":" + tag + ":" + monat, authorid); authorid++; if (authorid > 14999) { authorid = 10000; } } } } DateTime before = DateTime.Now; FileStream backupfile = File.Create("testposts.json"); StreamWriter sr = new StreamWriter(backupfile); sr.Write(JsonConvert.SerializeObject(postings, Formatting.Indented)); sr.Close(); TimeSpan durationToStore = DateTime.Now - before; Console.Out.WriteLine("Speichern dauerte " + durationToStore.TotalSeconds + " Sekunden."); before = DateTime.Now; FileStream inputFilestream = File.OpenRead("testposts.json"); StreamReader sreader = new StreamReader(inputFilestream); string jsonstring = sreader.ReadToEnd(); sreader.Close(); postings = JsonConvert.DeserializeObject <PostingManager>(jsonstring); durationToStore = DateTime.Now - before; Console.Out.WriteLine("Laden dauerte " + durationToStore.TotalSeconds + " Sekunden."); Assert.IsTrue(true); }
public BookStoreDataSeederContributor(IRepository <Book, Guid> bookRepository, IAuthorRepository authorRepository, AuthorManager authorManager) { _bookRepository = bookRepository; _authorRepository = authorRepository; _authorManager = authorManager; }
protected void Page_Load(object sender, EventArgs e) { AuthorManager AM = new AuthorManager(); AuthorTBx author = AM.GetByID(Convert.ToInt32(Request["id"])); author.Status = -1; AM.Save(); }
internal StatisticCollectionTask(AuthorManager authors, DRaumStatistics statistics, PostingManager posts, AdminBot adminBot) { this.authors = authors; this.posts = posts; this.statistics = statistics; this.adminBot = adminBot; this.statisticCollectionTask = this.periodicStatisticCollectionTask(new TimeSpan(0, 0, intervalStatisticCollectionMinutes, 0, 0), this.cancelTaskSource.Token); }
/// <summary> /// TODO Call Dispose Methods for each Manager. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing) { if (_pman != null) { _pman.Dispose(); _pman = null; } if (_sman != null) { _sman.Dispose(); _sman = null; } if (_sman != null) { _iman.Dispose(); _iman = null; } if (_dman != null) { _dman.Dispose(); _dman = null; } if (_cman != null) { _cman.Dispose(); _cman = null; } if (_tman != null) { _tman.Dispose(); _tman = null; } if (_aman != null) { _aman.Dispose(); _aman = null; } if (_pubman != null) { _pubman.Dispose(); _pubman = null; } if (_eman != null) { _eman.Dispose(); _eman = null; } if (_semman != null) { _semman.Dispose(); _semman = null; } base.Dispose(disposing); } }
protected void Page_Load(object sender, EventArgs e) { AuthorManager am = new AuthorManager(); listAuthor = am.GetList(); CategoryManager cm = new CategoryManager(); listCategory = cm.GetList(); }
public AngularMaterialDataSeederContributor( IRepository <Book, Guid> bookRepository, IAuthorRepository authorRepository, AuthorManager authorManager) { _bookRepository = bookRepository; _authorRepository = authorRepository; _authorManager = authorManager; }
protected void displaySelectedAuthorDetails(string AuthorName) { AuthorManager manager = new AuthorManager(); List <Author> allAuthors = manager.getAllAuthorsInDB((ConfigurationManager.ConnectionStrings["GeekTextConnection"].ConnectionString)); Author toDisplay = allAuthors.FirstOrDefault(o => o.authorName == AuthorName); AuthorName_lbl.Text = toDisplay.authorName; AuthorShortBio_lbl.Text = toDisplay.shortBio; }
static void Main(string[] args) { List <AuthorModel> myAuthors = AuthorManager.GetAllAuthors(); foreach (AuthorModel item in myAuthors) { Console.WriteLine($"{item.AuthorName} is {item.AuthorAge} years old"); } }
public RedirectToRouteResult DeleteAuthor(Author auth) { bool isAuthorized = Administrator.IsAuthorized((string)(Session["UserSession"]), (int)(Session["UserRank"]), (int)Authorization.Rank.administrator); if (isAuthorized) { AuthorManager.RemoveAuthor(auth); } return(RedirectToAction("ListAuthors", 0)); }
public void LoadAllAuthor() { AuthorManager authorManager = new AuthorManager(); List <Author> authors = authorManager.GetAllAuthors(); authorDropDownList.DataSource = authors; authorDropDownList.DataTextField = "AuthorName"; authorDropDownList.DataValueField = "AuthorId"; authorDropDownList.DataBind(); //authorDropDownList.Items.Insert(0, new ListItem("Select", "NA")); }
protected void Page_Load(object sender, EventArgs e) { AuthorManager am = new AuthorManager(); author = am.GetByID(Convert.ToInt32(Request["id"])); CategoryManager cm = new CategoryManager(); listCategory = cm.GetList(); Author_CategoryManager acm = new Author_CategoryManager(); listauthorcat = acm.GetListID(author.ID); }
private void SearchByAuthor(IEnumerable <AuthorCountViewModel> items) { var activeViewModel = MainWindowViewModel.Value.ActiveDocumentViewModel; activeViewModel.BookCabinet.ClearSearchResult(); foreach (var item in items) { item.IsSearchingKey = true; } AuthorManager.ShowBySelectedItems(MainWindowViewModel.Value, items.Select(ac => ac.Author)); HomeDocumentViewModel.ResetScrollOffset(); }
public void maxManagedAuthorsTest() { AuthorManager am = new AuthorManager(); AuthorManager.Maxmanagedusers = 20; for (int i = 0; i < AuthorManager.Maxmanagedusers; i++) { am.getCoolDownTimer(i * 10 + 1, "user" + i, Author.InteractionCooldownTimer.Default); } Assert.ThrowsException <DRaumException>(() => { am.getCoolDownTimer(5000, "toomuch", Author.InteractionCooldownTimer.Default); }); }
/// <summary> /// 登陆 /// </summary> /// <param name="import">数据集</param> /// <returns>返回操作结果(如成功将返回档次登陆的身份标识)</returns> public NormalResult<string> Login(LoginImport import) { try { import.CheckAllowExecuteOrNot(db); Author user = new AuthorManager(db).Login(import); string token = AuthorLoginInfoPond.AddInfo(db, user.Id); return new NormalResult<string>(token); } catch (Exception ex) { return new NormalResult<string>(null, ex.Message); } }
/// <summary> /// 创建新的顶级用户 /// </summary> /// <param name="import">数据集</param> /// <returns>返回操作结果</returns> public NormalResult CreateUser(CreateUserImport import) { try { import.CheckAllowExecuteOrNot(db); AuthorManager manager = new AuthorManager(db); manager.Create(import); return new NormalResult(); } catch (Exception ex) { return new NormalResult(ex.Message); } }
/// <summary> /// 修改额外的直属高点号配额 /// </summary> /// <param name="import">数据集</param> /// <returns>返回操作结果</returns> public NormalResult SetExtraQuotas(SetExtraQuotasImport import) { try { import.CheckAllowExecuteOrNot(db); AuthorManager manager = new AuthorManager(db); manager.Update(import); return new NormalResult(); } catch (Exception ex) { return new NormalResult(ex.Message); } }