public static void AddEditContributor(ContributorAddEditModel model) { Contributor contributor = new Contributor { AffiliateID = model.AffiliateID, Bio = model.Bio, CityID = model.CityID, CountryID = model.CountryID, CreationDate = model.CreationDate, Email = model.Email, ID = model.ID, ImageURL = model.ImageURL, LastPostDate = DateTime.MinValue, Name = model.Name.CapitaliseFirstLetters(), TotalContributions = 0 }; if (contributor.ImageURL == null) { contributor.ImageURL = ""; } contributor.ImageURL = contributor.ImageURL.Replace("~", ""); //ID mevcutsa güncelle, yoksa ekle if (!Tester.TestContributors.Exists(x => x.ID != contributor.ID)) { Tester.TestContributors.Add(contributor); } else { //dbde update normalde Tester.TestContributors.RemoveAll(x => x.ID == model.ID); Tester.TestContributors.Add(contributor); } }
/// <summary> /// Test Retrieving a Record from the Data Base /// </summary> public void TestGet() { using (var controller = new ContributorApiController(_dbContext, _logger)) { if (saveItem == null || saveItem.Id == null) { TestAdd(); } var response = controller.GetContributor(loginToken, saveItem.Id) as OkObjectResult; Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); testItem = response.Value as Contributor; Assert.AreEqual(testItem.Id, saveItem.Id); Assert.AreEqual(testItem.Name, saveItem.Name); Assert.AreEqual(testItem.Description, saveItem.Description); Assert.AreEqual(testItem.Degree, saveItem.Degree); Assert.AreEqual(testItem.AlmaMater, saveItem.AlmaMater); Assert.AreEqual(testItem.Email, saveItem.Email); Assert.AreEqual(testItem.Evaluations, saveItem.Evaluations); Assert.AreEqual(testItem.Password, saveItem.Password); Assert.AreEqual(testItem.Comments, saveItem.Comments); Assert.AreEqual(testItem.AuditEntered, saveItem.AuditEntered); Assert.AreEqual(testItem.AuditEnteredBy, saveItem.AuditEnteredBy); Assert.AreEqual(testItem.AuditUpdated, saveItem.AuditUpdated); Assert.AreEqual(testItem.AuditUpdatedBy, saveItem.AuditUpdatedBy); } }
public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); Contributor cont = new Contributor(); cont.ID = Guid.NewGuid(); cont.CreatedBy = user.Id; _context.Contributors.Add(cont); _context.SaveChanges(); await _signInManager.SignInAsync(user, isPersistent : false); return(RedirectToLocal(returnUrl)); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public void Edit(Contributor model) { var oldModel = _context.Contributors.Find(model.ID); oldModel.Name = model.Name; oldModel.Phone = model.Phone; oldModel.Email = model.Email; oldModel.Address = model.Address; if (model.Avatar != null) { string result = Regex.Replace(model.Avatar, "^data:image/[a-zA-Z]+;base64,", string.Empty); byte[] byt = Convert.FromBase64String(result); string filename = Guid.NewGuid().ToString() + ".jpg"; var save_path = Path.Combine(_appEnvironment.WebRootPath, "images\\Contributors\\"); string img_path = Path.Combine(save_path, filename); System.IO.File.WriteAllBytes(img_path, byt); //physical image saving ends oldModel.Avatar = filename; } _context.Contributors.Update(oldModel); _context.SaveChanges(); }
private async void OnContributorClicked(Contributor obj) { if (!string.IsNullOrWhiteSpace(obj?.LinkUri)) { await Launcher.LaunchUriAsync(new Uri(obj.LinkUri)); } }
public void ContributorService_Update_CallUpdateCustomerAndCallsSaveChanges() { #region Arrange var dateTimeNow = DateTime.Now; var contributor = new Contributor { Id = 1, EmailAddress = "Some other email address", UpdatedBy = UserNameOne, UpdatedDate = dateTimeNow, }; #endregion #region Act _contributorService.Update(contributor); #endregion #region Assert _mockContributorRepository.Verify(x => x.Update(It.IsAny <Contributor>()), Times.Once()); _mockUnitOfWork.Verify(x => x.Save(), Times.Exactly(1)); #endregion }
public async Task <ActionResult <Contributor> > PostContributor(Contributor contributor) { var existsMemberWithName = _context.Contributor .Any(x => x.OrganizationId == contributor.OrganizationId && x.FirstName.Equals(contributor.FirstName, StringComparison.InvariantCultureIgnoreCase) && x.LastName.Equals(contributor.LastName, StringComparison.InvariantCultureIgnoreCase)); if (existsMemberWithName) { return(BadRequest($"Member with the same name [{contributor.FirstName} {contributor.LastName}] already exists")); } contributor.ContributorId = Utils.GetNextIdAsync(_context, "contributor").Result; contributor.Status = 1; contributor.DateAdded = DateTime.UtcNow; _context.Contributor.Add(contributor); if (string.IsNullOrEmpty(contributor.FamilyName)) { contributor.FamilyName = null; } await _context.SaveChangesAsync(); return(CreatedAtAction("Get", new { id = contributor.ContributorId }, contributor)); }
public void Create_SetsError_IfCreationFailed() { Book book = new Book(); book.Name = "Tim's Book"; book.Description = "Description"; Contributor contributor = new Contributor(); contributor.Name = "contributor name"; _viewModel.BookName = book.Name; _viewModel.BookDescription = book.Description; _bookServiceMock.Setup(s => s.CreateBook(_viewModel.BookName, _viewModel.BookDescription)).Returns(book).Verifiable(); _bookShelfServiceMock.Setup(s => s.AddOwnBookToBookShelfAndSaveAsync(_storeAccess, book, Moq.It.Is <Contributor>(c => c.Name == _bookShelf.OwnerName))).Returns(Task.FromResult(false)).Verifiable(); _viewModel.Init(_storeAccess, _bookShelf); _viewModel.CreateBookCommand.Execute(); Assert.IsTrue(_viewModel.CreationFailed); _bookServiceMock.Verify(); _bookShelfServiceMock.Verify(); _eventAggregator.Verify(); }
public async Task <IActionResult> PutContributor(short id, Contributor contributor) { if (id != contributor.ContributorId) { return(BadRequest()); } _context.Entry(contributor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContributorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void ContributorService_Delete_CallDeleteCustomerAndCallsSaveChanges() { #region Arrange var dateTimeNow = DateTime.Now; var contributor = new Contributor { Id = 3, }; #endregion #region Act _contributorService.Delete(contributor); #endregion #region Assert _mockContributorRepository.Verify(x => x.Delete(It.IsAny <Contributor>()), Times.Once()); _mockUnitOfWork.Verify(x => x.Save(), Times.Exactly(1)); #endregion }
object restUpdateContributorV2(RestRequestArgs args) { int xenforoId; if (!Int32.TryParse(args.Verbs["user_id"], out xenforoId)) { return(RestInvalidParam("contributor_id")); } if (String.IsNullOrWhiteSpace(args.Parameters["updates"])) { return(RestMissingParam("updates")); } ContributorUpdates updates; if (!Enum.TryParse(args.Parameters["updates"], out updates)) { return(RestInvalidParam("updates")); } Contributor con = _main.Contributors.GetByXenforoId(xenforoId); if (con != null) { // Fire the Contributor Update event and let any listener pick it up ContributorUpdate?.Invoke(this, new ContributorUpdateEventArgs(con, updates)); } // Possible improvement: send different response if something was certainly updated? return(RestResponse("Update sent.")); }
async Task ExecuteCreateBookCommand() { SaveInProgress = true; try { CreationFailed = false; var book = _bookService.CreateBook(BookName, BookDescription); var contributor = new Contributor { Name = _bookShelf.OwnerName }; book.CoverImageBase64 = CoverImageBase64; var added = await _bookShelfService.AddOwnBookToBookShelfAndSaveAsync(_storeAccess, book, contributor); if (added) { _eventAggregator.GetEvent <BookCreatedMessage>().Publish(_storeAccess); } else { CreationFailed = true; } } finally { SaveInProgress = false; } }
/// <summary> /// Test Setters for Contributor Object /// </summary> public void TestSetters() { testItem = new Contributor() { Id = 15L, // Id Name = "Name", // Name Description = "Description", // Description Degree = "Degree", // Degree AlmaMater = "AlmaMater", // AlmaMater Email = "Email", // Email Evaluations = 1, // Evaluations Password = "******", // Password Comments = "Comments", // Comments AuditEntered = testDate, // AuditEntered AuditEnteredBy = 15L, // AuditEnteredBy AuditUpdated = testDate, // AuditUpdated AuditUpdatedBy = 15L, // AuditUpdatedB }; Assert.AreEqual(15L, testItem.Id); Assert.AreEqual("Name", testItem.Name); Assert.AreEqual("Description", testItem.Description); Assert.AreEqual("Degree", testItem.Degree); Assert.AreEqual("AlmaMater", testItem.AlmaMater); Assert.AreEqual("Email", testItem.Email); Assert.AreEqual(1, testItem.Evaluations); Assert.AreEqual("Password", testItem.Password); Assert.AreEqual("Comments", testItem.Comments); Assert.AreEqual(testDate, testItem.AuditEntered); Assert.AreEqual(15L, testItem.AuditEnteredBy); Assert.AreEqual(testDate, testItem.AuditUpdated); Assert.AreEqual(15L, testItem.AuditUpdatedBy); }
/// <summary> /// Test Full Constructor for Contributor Object /// </summary> public void TestFullConstructor() { testItem = new Contributor( 0L // Id , "Name" // Name , "Description" // Description , "Degree" // Degree , "AlmaMater" // AlmaMater , "Email" // Email , 1 // Evaluations , "Password" // Password , "Comments" // Comments , testDate // AuditEntered , 15L // AuditEnteredBy , testDate // AuditUpdated , 15L // AuditUpdatedBy ); Assert.AreEqual("Name", testItem.Name); Assert.AreEqual("Description", testItem.Description); Assert.AreEqual("Degree", testItem.Degree); Assert.AreEqual("AlmaMater", testItem.AlmaMater); Assert.AreEqual("Email", testItem.Email); Assert.AreEqual(1, testItem.Evaluations); Assert.AreEqual("Password", testItem.Password); Assert.AreEqual("Comments", testItem.Comments); Assert.AreEqual(testDate, testItem.AuditEntered); Assert.AreEqual(15L, testItem.AuditEnteredBy); Assert.AreEqual(testDate, testItem.AuditUpdated); Assert.AreEqual(15L, testItem.AuditUpdatedBy); }
public void ChoralMusicSelection_MethodSetInstrumentParts() { //Arrange Contributor composer = new Contributor(new Name("David", "", "Hass"), "Composer"); ChoralMusicSelection myChoralMusicSelection = new ChoralMusicSelection("507f191e810c19729de860ea", "Blest Are They", composer, true); List <ChoralInstrumentPart> expectedInstrumentParts = new List <ChoralInstrumentPart>() { new ChoralInstrumentPart("Trombone", 2, true), new ChoralInstrumentPart("Flute", 3, true) }; //Act List <ChoralInstrumentPart> instrumentParts = new List <ChoralInstrumentPart>() { new ChoralInstrumentPart("Trombone", 2, true), new ChoralInstrumentPart("Flute", 3, true) }; myChoralMusicSelection.setInstrumentParts(instrumentParts); //Assert CollectionAssert.AreEqual(expectedInstrumentParts, myChoralMusicSelection.getInstrumentParts()); }
private void GetWebResponse(object o) { HttpWebRequest request = WebRequestFactory.CreateHttpRequest(ContributorURL); try { HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse(); using (Stream stream = httpResponse.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { while(!reader.EndOfStream) { string Line = reader.ReadLine(); Contributor s = new Contributor(); string[] split =Line.Split(new char[]{':'}); s.Name = split[0]; s.Contribution = split[1]; ContributorsList.Add(s); } reader.Close(); httpResponse.Close(); } } ContributorsReady(); } catch { } }
public IActionResult Edit(Contributor contributor) { var manager = new SimchaChipInManager(_connectionString); manager.UpdateContributor(contributor); return(RedirectToAction("index")); }
public int RollbackPlayer(Player _Player, Contributor _Contributor, DateTime _DateTime) { var contributorID = _Contributor.GetContributorID(); int removedHistoryData = 0; try { removedHistoryData += CharacterHistory.RemoveAll((CharacterDataHistoryItem _Item) => { return((_Item.Uploader.GetContributorID() == contributorID) && (_Item.Uploader.GetTime() > _DateTime)); }); removedHistoryData += GuildHistory.RemoveAll((GuildDataHistoryItem _Item) => { return((_Item.Uploader.GetContributorID() == contributorID) && (_Item.Uploader.GetTime() > _DateTime)); }); removedHistoryData += HonorHistory.RemoveAll((HonorDataHistoryItem _Item) => { return((_Item.Uploader.GetContributorID() == contributorID) && (_Item.Uploader.GetTime() > _DateTime)); }); removedHistoryData += GearHistory.RemoveAll((GearDataHistoryItem _Item) => { return((_Item.Uploader.GetContributorID() == contributorID) && (_Item.Uploader.GetTime() > _DateTime)); }); if (ArenaHistory != null) { removedHistoryData += ArenaHistory.RemoveAll((ArenaDataHistoryItem _Item) => { return((_Item.Uploader.GetContributorID() == contributorID) && (_Item.Uploader.GetTime() > _DateTime)); }); } if (TalentsHistory != null) { removedHistoryData += TalentsHistory.RemoveAll((TalentsDataHistoryItem _Item) => { return((_Item.Uploader.GetContributorID() == contributorID) && (_Item.Uploader.GetTime() > _DateTime)); }); } if (removedHistoryData > 0) { _RollbackPlayer(_Player, (_UploadID) => { if (_UploadID.GetContributorID() == contributorID && (_UploadID.GetTime() > _DateTime)) { return(true); } return(false); }); } } catch (Exception ex) { Logger.LogException(ex); return(-removedHistoryData); } return(removedHistoryData); }
public static string CreateAddonUpdate(Contributor _Contributor, Single _CurrentAddonVersion) { if (_CurrentAddonVersion >= GetLatestAddonVersion()) { return(""); } DateTime lastAddonUpdateAttempt = DateTime.Now.AddHours(-10); if (m_LastAddonUpdateAttemptForContributor.ContainsKey(_Contributor.GetContributorID()) == true) { lastAddonUpdateAttempt = m_LastAddonUpdateAttemptForContributor[_Contributor.GetContributorID()]; } string addonUpdateResponse = ""; if ((DateTime.Now - lastAddonUpdateAttempt).TotalHours > 1) { if (GetLatestAddonVersion() >= 1.3f) { addonUpdateResponse += AddAddonFile("VF_RealmPlayers.lua"); addonUpdateResponse += AddAddonFile("VF_RealmPlayers.toc"); } m_LastAddonUpdateAttemptForContributor[_Contributor.GetContributorID()] = DateTime.Now; } Logger.ConsoleWriteLine(_Contributor.Name + " is updating from AddonVersion " + _CurrentAddonVersion + " to " + GetLatestAddonVersion(), ConsoleColor.Cyan); return(addonUpdateResponse); }
public ActionResult Index([Bind(Include = "Email")] Contributor contributor) { contributor.Ip = Request.UserHostAddress; contributor.Browser = Request.Browser.Type; contributor.Os = Request.Browser.Platform; contributor.Language = Request.UserLanguages != null?Request.UserLanguages.First() : DEF_CULTURE; contributor.Referer = Request.ServerVariables["HTTP_REFERER"]; var contents = _db.GetContent(contributor.Language, HttpContext.Cache); var contributorViewModel = new ContributorViewModel { Contributor = contributor, Content = contents }; // register the new contributor if (ModelState.IsValid) { try { _db.Contributors.Add(contributorViewModel.Contributor); _db.SaveChanges(); contributorSubmitter.SubmitOrder(contributor, _db.Contributors.ToList()); } catch {} } return(View("Thanks", contributorViewModel)); }
void VerifySingleUserResponse(User user) { Assert.IsNotNull(user); Assert.IsNotNull(user.BannerSizes); Assert.IsFalse(user.BannerSizes.Any()); Assert.IsNotNull(user.Categories); Assert.IsFalse(user.Categories.Any()); Assert.AreEqual("6253282", user.UserIDResponse); Assert.AreEqual("twitterapi", user.ScreenNameResponse); Assert.AreEqual("San Francisco, CA", user.Location); Assert.IsNotNull(user.Description); Assert.IsTrue(user.Description.StartsWith("The Real Twitter API.")); Assert.AreEqual("http://dev.twitter.com", user.Url); Assert.IsFalse(user.Protected); Assert.AreEqual(1009508, user.FollowersCount); Assert.AreEqual(31, user.FriendsCount); Assert.AreEqual(10361, user.ListedCount); Assert.AreEqual(new DateTime(2007, 5, 23, 6, 1, 13), user.CreatedAt); Assert.AreEqual(24, user.FavoritesCount); Assert.AreEqual(-28800, user.UtcOffset); Assert.AreEqual("Pacific Time (US & Canada)", user.TimeZone); Assert.IsTrue(user.GeoEnabled); Assert.IsTrue(user.Verified); Assert.AreEqual(3278, user.StatusesCount); Assert.AreEqual("en", user.LangResponse); Status status = user.Status; Assert.IsNotNull(status); Assert.AreEqual("web", status.Source); List <Contributor> contributors = status.Contributors; Assert.IsNotNull(contributors); Assert.IsTrue(contributors.Any()); Contributor contributor = contributors.First(); Assert.IsNotNull(contributor); Assert.IsTrue(user.ContributorsEnabled); Assert.IsFalse(user.IsTranslator); Assert.AreEqual("E8F2F7", user.ProfileBackgroundColor); Assert.AreEqual("http://a0.twimg.com/profile_background_images/229557229/twitterapi-bg.png", user.ProfileBackgroundImageUrl); Assert.AreEqual("https://si0.twimg.com/profile_background_images/229557229/twitterapi-bg.png", user.ProfileBackgroundImageUrlHttps); Assert.IsFalse(user.ProfileBackgroundTile); Assert.AreEqual("http://a0.twimg.com/profile_images/1438634086/avatar_normal.png", user.ProfileImageUrl); Assert.AreEqual("https://si0.twimg.com/profile_images/1438634086/avatar_normal.png", user.ProfileImageUrlHttps); Assert.AreEqual("0094C2", user.ProfileLinkColor); Assert.AreEqual("0094C2", user.ProfileSidebarBorderColor); Assert.AreEqual("A9D9F1", user.ProfileSidebarFillColor); Assert.AreEqual("437792", user.ProfileTextColor); Assert.IsTrue(user.ProfileUseBackgroundImage); Assert.IsFalse(user.ShowAllInlineMedia); Assert.IsFalse(user.DefaultProfile); Assert.IsFalse(user.DefaultProfileImage); Assert.IsFalse(user.Following); Assert.IsFalse(user.FollowRequestSent); Assert.IsFalse(user.Notifications); Assert.IsNotNull(user.Entities?.Description?.UrlEntities); Assert.IsTrue(user.Entities.Description.UrlEntities.Any()); Assert.IsNotNull(user.Entities?.Url?.UrlEntities); Assert.IsTrue(user.Entities.Url.UrlEntities.Any()); }
void OnPlayerPermission(PlayerPermissionEventArgs e) { // If the player isn't logged it, he's certainly not a contributor if (e.Player == null || !e.Player.IsLoggedIn || !e.Player.ContainsData(Contributor.DataKey)) { return; } Contributor con = e.Player.GetData <Contributor>(Contributor.DataKey); #region DEBUG #if DEBUG //TShock.Log.ConsoleInfo("[" + e.Player.Index + "] Checking permission for: " + e.Permission); #endif #endregion Tier tier = Tiers.Get(con.Tier); e.Handled = tier.Permissions.HasPermission(e.Permission); #region DEBUG #if DEBUG if (e.Handled) { TShock.Log.ConsoleInfo("OnPlayerPermission: Contributor had the permission"); } #endif #endregion }
private string[] ComposeNameTokens(Contributor contributor) { StringBuilder sb = new StringBuilder(); StringBuilder sbt = new StringBuilder(); if (!String.IsNullOrWhiteSpace(contributor.LastName)) { if (!String.IsNullOrWhiteSpace(contributor.FirstName)) { sb.Append(String.Format("{0} {1}", contributor.FirstName, contributor.LastName)); sbt.Append(String.Format("{0}-{1}", Tokenize(contributor.FirstName), Tokenize(contributor.LastName))); } else { sb.Append(contributor.LastName); sbt.Append(contributor.LastName); } } else if (!String.IsNullOrWhiteSpace(contributor.FirstName)) { sb.Append(contributor.FirstName); sbt.Append(contributor.FirstName); } else { return(new string[2] { "", "" }); } //return new string[2] { ToTitleCase(sb.ToString()), sbt.ToString() }; return(new string[2] { sb.ToString(), sbt.ToString() }); }
public IActionResult Edit(Contributor contributor) { SFundDb db = new SFundDb(_connectionString); db.EditContributor(contributor); return(Redirect("/Contributors/Index")); }
private async Task <Contributor> GetContributor(string gitHubLogin, long subscriptionId) { if (_contributors.ContainsKey(gitHubLogin)) { return(_contributors[gitHubLogin]); } if (!_loadMegaInfo) { var contributor = await _dbContext .Contributors .SingleOrDefaultAsync(q => q.GitHubLogin == gitHubLogin && q.SubscriptionId == subscriptionId); if (contributor != null) { _contributors[gitHubLogin] = contributor; return(contributor); } } var newContributor = new Contributor() { CanonicalName = gitHubLogin, GitHubLogin = gitHubLogin, SubscriptionId = subscriptionId }; _contributors[gitHubLogin] = newContributor; _dbContext.Add(newContributor); return(newContributor); }
public async Task <IActionResult> PutContributor(int id, Contributor contributor) { if (id != contributor.ContributorId) { return(BadRequest($"Invalid update request. Member Id does not match Member details object. Id {id}, contributor.ContributorId {contributor.ContributorId}, {contributor.FirstName}, {contributor.LastName}")); } contributor.DateChanged = DateTime.UtcNow; _context.Entry(contributor).Property(x => x.FirstName).IsModified = true; _context.Entry(contributor).Property(x => x.LastName).IsModified = true; _context.Entry(contributor).Property(x => x.FamilyName).IsModified = true; _context.Entry(contributor).Property(x => x.DateChanged).IsModified = true; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Utils.MemberExists(_context, id)) { return(NotFound($"Member Id [{id}] is invalid/does not exist")); } else { throw; } } return(NoContent()); }
public static async Task <AddListResult> AddList(DBContext c, string listName, int userId) { var user = await Q.From(User.T).Where(x => x.Id.EqV(userId)).FirstOrDefault <User>(c.Connection);// c.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) { return new AddListResult { Success = false, Error = "User not found" } } ; var shoppingList = new ShoppingList { Name = listName }; await Q.InsertOne(c.Connection, shoppingList); var cont = new Contributor { ListId = shoppingList.Id, Permission = Contributor.Permissions.Owner, UserId = userId }; await Q.InsertOne(c.Connection, cont); return(new AddListResult { Success = true, Id = shoppingList.Id, Name = shoppingList.Name }); }
public void Create_SetsAndClears_SaveInProgress() { Book book = new Book(); book.Name = "Tim's Book"; book.Description = "Description"; Contributor contributor = new Contributor(); contributor.Name = "contributor name"; _viewModel.BookName = book.Name; _viewModel.BookDescription = book.Description; _bookServiceMock.Setup(s => s.CreateBook(_viewModel.BookName, _viewModel.BookDescription)).Returns(book).Verifiable(); _bookShelfServiceMock.Setup(s => s.AddOwnBookToBookShelfAndSaveAsync(_storeAccess, book, Moq.It.Is <Contributor>(c => c.Name == _bookShelf.OwnerName))).Returns(Task.FromResult(true)).Verifiable(); _eventAggregator.Setup(s => s.GetEvent <BookCreatedMessage>().Publish(_storeAccess)).Verifiable(); _viewModel.Init(_storeAccess, _bookShelf); Assert.IsFalse(_viewModel.SaveInProgress); _viewModel.CreateBookCommand.Execute(); Assert.IsFalse(_viewModel.SaveInProgress); _bookServiceMock.Verify(); _bookShelfServiceMock.Verify(); }
/// <summary> /// GET /Contributors/Create /// </summary> /// <param name="referer">The go-back url</param> /// <param name="sortOrder">Page Sort Order</param> /// <param name="searchString">Search String to limit results</param> /// <param name="page">Page number of results, starting at 0</param> /// <param name="pageSize">Page size to display</param> /// <param name="currentFilter">Last search string while paging</param> /// <returns>Task Action Result</returns> public IActionResult Create( string state, string sortOrder, string searchString, int?page, int?pageSize, string currentFilter = "") { // Manage call stack var stack = new ServiceStack(state); var referer = stack.GetReturnUrl(); var callstack = stack.AddReturnUrl(Request.Headers["referer"]); // pass page configuration to Views ViewData["referer"] = referer; ViewData["callstack"] = callstack; ViewData["CurrentSort"] = sortOrder; ViewData["sortOrder"] = sortOrder; ViewData["searchString"] = searchString; ViewData["page"] = page; ViewData["pageSize"] = pageSize; ViewData["currentFilter"] = currentFilter; var newItem = new Contributor(); return(View(newItem)); }
public void DateTimeCan_FillChild() { var dataNavigator = PrepareDateTimeGrouping(); ReportItemCollection searchCol = new ReportItemCollection(); searchCol.Add(new BaseDataItem() { Name = "RandomDate", ColumnName = "Last" } ); var compare = System.DateTime.MinValue; while (dataNavigator.MoveNext()) { Contributor groupResult = dataNavigator.Current as Contributor; Assert.LessOrEqual(compare, groupResult.RandomDate); if (dataNavigator.HasChildren) { var childNavigator = dataNavigator.GetChildNavigator; do { Assert.That(dataNavigator.HasChildren, Is.True); // we know that current is a 'contributor' Contributor c = dataNavigator.Current as Contributor; Assert.IsNotNull(c); // string v2 = c.Last + " GroupVal :" + c.RandomDate; // Console.WriteLine(v2); }while (childNavigator.MoveNext()); } } }
public ActionResult AddContributor(Contributor c, Deposit d) { _mgr.AddContributor(c); d.ContributorId = c.Id; _mgr.AddDeposit(d); return(Redirect("/contributors/index")); }
public ReleaseNoteItem(string title, string issueNumber, string htmlUrl, string[] tags, DateTimeOffset? resolvedOn, Contributor[] contributors) { this.title = title; this.issueNumber = issueNumber; this.htmlUrl = htmlUrl; this.tags = tags ?? new string[0]; this.resolvedOn = resolvedOn; this.contributors = contributors; }
public void InitializeContributorList() { Contributor Cambell = new Contributor() { Name = "Tyler Cambell" }; contributorsList.Add(Cambell); Contributor Christie = new Contributor() { Name = "Wade Christie" }; contributorsList.Add(Christie); Contributor Fujioka = new Contributor() { Name = "Griffin Fujioka" }; contributorsList.Add(Fujioka); Contributor Heyduck = new Contributor() { Name = "David Heyduck" }; contributorsList.Add(Heyduck); Contributor Hintzke = new Contributor() { Name = "Matt Hintzke" }; contributorsList.Add(Hintzke); Contributor Karcher = new Contributor() { Name = "Matt Karcher" }; contributorsList.Add(Karcher); Contributor Wadagnolo = new Contributor() { Name = "Joel Wadagnolo" }; contributorsList.Add(Wadagnolo); }
//--------------------------------------------------------------------- public static void ContributorQuery(OleDbConnection dbcon, CodeGenerator cg) { cg.ContributorList.Clear(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM Contributors", dbcon); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Contributor curContrib = new Contributor(); curContrib.Name = dr["Name"].ToString(); curContrib.Email = dr["Email"].ToString(); curContrib.Role = dr["Role"].ToString(); cg.ContributorList.Add(curContrib); //curContrib.Print(); } dr.Close(); }
static void Main(string [] args) { if (args.Length != 2) { Console.WriteLine ("write.exe <input.xml> <output.html>"); Environment.Exit (0); } string input = args [0]; string output = args [1]; XmlDocument document = new XmlDocument (); document.Load (input); nsmgr = new XmlNamespaceManager (document.NameTable); nsmgr.AddNamespace ("t", "http://go-mono.org/team.xsd"); XmlNodeList contributors = document.SelectNodes ("/t:contributors/t:contributor", nsmgr); list = new Contributor [contributors.Count]; Page p = new Page (); int count = 0; foreach (XmlNode n in contributors) { list [count] = new Contributor (n, p.Document); count ++; } Array.Sort (list, new ContributorComparer ()); int length = list.Length % 2 == 0 ? list.Length : list.Length + 1; int i = 0; while (i < length) { try { p.AddRow (list [i].RenderHtml (), list [i + 1].RenderHtml ()); } catch (IndexOutOfRangeException) { p.AddRow (list [i].RenderHtml (), null); } i += 2; } p.Write (output); }
public UserInfo LogIn( string name, string password ) { // Who wants to log in? (I do I do!) lock (_serializer) { UserInfo cred; if (!_database.GetUser( name, out cred )) { return null; } if (! _database.Authenticate( cred, password )) { return null; } /// /// \todo Retrieve last known mood here /// Contributor contrib = new Contributor( cred, new Mood() ); _controllers[contrib.user.id] = contrib; return cred; } }
private Contributor GetSPUser(SPListItem item, string fieldName) { SPFieldUser field = item.Fields[fieldName] as SPFieldUser; if (field != null) { SPFieldUserValue fieldValue = field.GetFieldValue(item[fieldName].ToString()) as SPFieldUserValue; if (fieldValue != null) { Contributor contributor = new Contributor() { ContributorName = fieldValue.User.Name, LoginName = fieldValue.User.LoginName }; return contributor; } } return null; }