Пример #1
0
        public void LoadGraph(StoryType storyType)
        {
            Window g = null;

            switch (storyType)
            {
            case StoryType.STORYGRAPH:
                g = new Storygraph(_dt, IsForceSelected, new ForceParameters()
                {
                    Iterations = this.Iterations, Segments = this.Segments
                });
                break;

            case StoryType.STORYLINES:
                g = new Storylines(_dt, IsUncertaintySelected);
                break;

            case StoryType.MAP:
                g = new E2Charts.Map(_dt);
                _graphList.Add(g);
                g.Show();
                break;

            case StoryType.TIMELINE:
                g = new Timeline(_dt);
                break;
            }
            _graphList.Add(g);
            g.Show();
        }
Пример #2
0
 public Story(string title, StoryType storyType, bool isOriginal, string author)
 {
     Title      = title;
     StoryType  = storyType;
     IsOriginal = isOriginal;
     Author     = author;
 }
Пример #3
0
 public StoryAnthology(string title, string author, StoryType type, bool original)
 {
     Title        = title;
     Author       = author;
     StoryType    = type;
     IsItOriginal = original;
 }
        public void GenresGetCorrectlyTakenFromDb()
        {
            //arrange
            var genres = new StoryType[]
            {
                new StoryType
                {
                    Id   = 1,
                    Name = "Fantasy"
                },
                new StoryType
                {
                    Id   = 2,
                    Name = "Young Adult"
                },
                new StoryType
                {
                    Id   = 3,
                    Name = "Comedy"
                }
            };

            this.Context.StoryTypes.AddRange(genres);
            this.Context.SaveChanges();

            //act

            var storyService = GetService();

            var genresFromDb = storyService.Genres();

            genresFromDb.Should().HaveCount(3);
        }
Пример #5
0
        public static List <StoryType> SelectAll()
        {
            List <StoryType> list = null;

            using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                conn.Open();
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "dbo.StoryTypes_SelectAll";

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        StoryType st  = new StoryType();
                        int       ord = 0;

                        st.Id   = reader.GetSafeInt32(ord++);
                        st.Name = reader.GetSafeString(ord++);

                        if (list == null)
                        {
                            list = new List <StoryType>();
                        }

                        list.Add(st);
                    }
                }
                conn.Close();
            }
            return(list);
        }
Пример #6
0
        public bool IsTheRightStoryType(StoryType storyType)
        {
            switch (storyType)
            {
            case StoryType.PLAYER_IS_CAPTIVE:      return(GameData.Instance.GameContext.Heroes.Player.IsPrisoner);

            case StoryType.PLAYER_IS_CAPTOR:       return(GameData.Instance.GameContext.Heroes.PlayerIsCaptor != null && (bool)GameData.Instance.GameContext.Heroes.PlayerIsCaptor);

            case StoryType.PLAYER_ON_CAMPAIGN_MAP: return(GameData.Instance.GameContext.Tracking.IsCurrentlyOnMap != null && (bool)GameData.Instance.GameContext.Tracking.IsCurrentlyOnMap);

            case StoryType.PLAYER_IN_SETTLEMENT:   return(GameData.Instance.GameContext.Tracking.IsCurrentlyInSettlement != null && (bool)GameData.Instance.GameContext.Tracking.IsCurrentlyInSettlement);

            case StoryType.PLAYER_SURRENDER:       return(GameData.Instance.GameContext.Heroes.Player.IsPrisoner);

            case StoryType.NONE:                   return(true);

            case StoryType.UNKNOWN:                throw new ApplicationException("Story type undefined.");

            case StoryType.WAITING:                break;

            default:                               throw new ApplicationException("Story type undefined.");
            }

            return(true);
        }
Пример #7
0
        public IAct RetrieveActToPlay(StoryType storyType)
        {
            var qualifiedActs = GetAllPrisonerQualifiedActs().Where(n => n.ParentStory.Header.TypeOfStory == storyType).ToList();

            return(qualifiedActs.Count > 0
                ? ChooseOneToPlay(qualifiedActs)
                : null);
        }
Пример #8
0
 public Story(StoryType storyType, String displayedMessage, PureLogic pureLogic, bool positive, String storyGraphic)
 {
     DisplayedMessage = displayedMessage;
     StoryType = storyType;
     PureLogic = pureLogic;
     Positive = positive;
     StoryGraphic = storyGraphic;
 }
Пример #9
0
 public Story(StoryType storyType, String displayedMessage, PureLogic pureLogic, bool positive, String storyGraphic)
 {
     DisplayedMessage = displayedMessage;
     StoryType        = storyType;
     PureLogic        = pureLogic;
     Positive         = positive;
     StoryGraphic     = storyGraphic;
 }
Пример #10
0
 public MapDrawingManager(Dictionary <string, object> layoutObjects, DataTable dataTable, StoryType st)
 {
     this._storyType     = st;
     this._layoutObjects = layoutObjects;
     this._dt            = dataTable;
     this._meta          = new Dictionary <string, object>();
     refresh             = RefreshMeta();
 }
Пример #11
0
        public StoryDrawingManager(Dictionary <string, object> layoutObjects, DataTable dt, StoryType st, ForceParameters f)
        {
            this._storyType     = st;
            this._layoutObjects = layoutObjects;
            this._dt            = dt;
            this._meta          = new Dictionary <string, object>();
            refresh             = RefreshMeta();

            this._forceParameters = f;
        }
        public void DeleteComment_Should_Delete_Comment()
        {
            //arrange

            var user = new FanFictionUser
            {
                Id       = "user",
                UserName = "******"
            };

            var genre = new StoryType
            {
                Id   = 1,
                Name = "Fantasy"
            };

            var story = new FanFictionStory
            {
                Title     = "One",
                Id        = 1,
                CreatedOn = DateTime.Now,
                Summary   = null,
                ImageUrl  = GlobalConstants.DefaultNoImage,
                Type      = genre,
                AuthorId  = "user"
            };

            var comment = new Comment
            {
                StoryId         = 1,
                FanFictionUser  = user,
                FanFictionStory = story,
                CommentedOn     = DateTime.Now.Date,
                Message         = "SomeComment",
                UserId          = user.Id,
                Id = 1
            };

            var userManager = (UserManager <FanFictionUser>) this.Provider.GetService(typeof(UserManager <FanFictionUser>));

            userManager.CreateAsync(user).GetAwaiter();
            this.Context.Comments.Add(comment);
            this.Context.StoryTypes.Add(genre);
            this.Context.FictionStories.Add(story);
            this.Context.SaveChanges();

            //act

            this.CommentService.DeleteComment(1);
            var result = this.Context.Comments.ToList();

            //assert

            result.Should().BeEmpty();
        }
Пример #13
0
 public StoryViewModel(IGraph sg, DataTable dt, StoryType storyType)
 {
     if (storyType == StoryType.TIMELINE)
     {
         _dm = new TimelineDrawingManager(sg.GetLayout(), dt, storyType);
     }
     else if (storyType == StoryType.STORYGRAPH || storyType == StoryType.STORYLINES || storyType == StoryType.STORYLINESWU)
     {
         _dm = new StoryDrawingManager(sg.GetLayout(), dt, storyType);
     }
 }
Пример #14
0
        public void ShowCategories(StoryType type = StoryType.All)
        {
            foreach (var category in m_CategoryItems)
            {
                // TODO make multi language
                // tabTitle = category.Category == type ? type.ToString() : tabTitle;

                // Show the category if category is selected or is the category is set to none.
                category.gameObject.SetActive(category.Category == type || type == StoryType.All);
            }
        }
Пример #15
0
 public string ToXml()
 {
     return(new XElement("story",
                         new XElement("project_id", ProjectId),
                         new XElement("name", Name),
                         new XElement("story_type", StoryType.ToString().ToLower()),
                         new XElement("description", Description),
                         //new XElement("estimate", Estimate),
                         new XElement("requested_by", RequestedBy))
            .ToString(SaveOptions.DisableFormatting));
 }
        public void CreateStory_Should_Work_Correct_With_Null_Iform_File()
        {
            //arrange
            var author = new FanFictionUser
            {
                Id       = "AuthorId",
                Nickname = "StoryAuthor",
                UserName = "******",
            };

            var genre = new StoryType
            {
                Id   = 1,
                Name = "fantasy"
            };
            var usermanager = this.Provider.GetRequiredService <UserManager <FanFictionUser> >();

            usermanager.CreateAsync(author).GetAwaiter();
            this.Context.StoryTypes.Add(genre);
            this.Context.SaveChanges();

            var newStory = new StoryInputModel
            {
                Author     = author.UserName,
                StoryImage = null,
                CreatedOn  = DateTime.Now,
                Genre      = "fantasy",
                Summary    = "someSummary",
                Title      = "NewStoryTitle",
            };

            //act
            var storyService = GetService();
            int result       = storyService.CreateStory(newStory).GetAwaiter().GetResult();

            var story = this.Context.FictionStories.First();

            //assert

            result.Should().BePositive().And.Subject.Should().Be(1);
            story.Should().NotBeNull().And.Subject.Should().BeEquivalentTo(new
            {
                Id       = 1,
                ImageUrl = GlobalConstants.DefaultNoImage,
                newStory.Title,
                Type = new StoryTypeOutputModel
                {
                    Id   = 1,
                    Type = newStory.Genre
                }
            }, options => options.ExcludingMissingMembers());
        }
Пример #17
0
        /// <summary>
        /// Creates a new story in a project.
        /// </summary>
        /// <param name="projectId">Id of the project to create a story in.</param>
        /// <param name="name">The name you wish to give to the story.</param>
        /// <param name="storyType">Type of the story, eg feature, bug.</param>
        /// <param name="labels">Any labels you wish to give to the story.</param>
        /// <param name="description">(optional) Description of the story. Use this for additional info.</param>
        /// <returns>Returns a completed PivotalStory</returns>
        public PivotalStory CreateNewStory(int projectId, string name, StoryType storyType, List <string> labels = null, string description = null)
        {
            var story = new PivotalNewStory
            {
                Name        = name,
                Description = description,
                Labels      = labels ?? new List <string>(),
                StoryType   = storyType.ToString()
            };
            var response = HttpService.PostAsync(StringUtil.PivotalStoriesUrl(projectId), story).Result;

            return(HandleResponse <PivotalStory>(response));
        }
Пример #18
0
        public void FillCategory(KeyValuePair <StoryType, List <StorySO> > item)
        {
            m_Category = item.Key;

            FillInteractionPanel();

            foreach (var story in item.Value)
            {
                if (m_Category == StoryType.All || story.TypeId == m_Category)
                {
                    Add(story);
                }
            }
        }
Пример #19
0
        /// <summary>
        /// Finds recent stories categorizd by a certain type
        /// </summary>
        /// <returns>Stories categorized by a certain type.</returns>
        /// <param name="storyType">Type of story (ask, show, job).</param>
        /// <param name="amount">Amount of stories, follows same as last method.</param>
        public async Task <List <Story> > FindTypeStories(StoryType storyType, int amount)
        {
            string storyBase = "";

            switch (storyType)
            {
            case StoryType.Ask:
                storyBase = AskStories;
                break;

            case StoryType.Show:
                storyBase = ShowStories;
                break;

            case StoryType.Job:
                storyBase = JobStories;
                break;

            case StoryType.Default:
                storyBase = NewStories;
                break;

            default:
                break;
            }

            List <Story> retStories = new List <Story>();


            using (var client = this.client)
            {
                var content = await client.GetStringAsync(storyBase);

                int[] stories = JsonConvert.DeserializeObject <int[]>(content);
                if (amount > stories.Length)
                {
                    amount = stories.Length;
                }
                for (int i = 0; i < amount; i++)
                {
                    var storyJSON = await client.GetStringAsync(SharpHacker.MakeItemRequest(stories[i]));

                    retStories.Add(await SharpHacker.SetUpStory(JsonConvert.DeserializeObject <Story>(content)));
                }
                return(retStories);
            }
        }
Пример #20
0
        public StoryApplication(string title, string content, StoryType storyType,
                                string imageUrl, string videoUrl, int storyID, int rating)
        {
            this.Title     = title;
            this.Content   = content;
            this.StoryType = storyType;
            this.Status    = StoryApplicationStatus.Pending;
            this.StoryID   = storyID;
            this.Rating    = rating;

            // Caught by validations in web project, however if using a Console then this would throw
            if (String.IsNullOrWhiteSpace(this.Title) ||
                String.IsNullOrWhiteSpace(this.Content))
            {
                throw new InvalidOperationException("Can't have an empty Title or Content");
            }
        }
Пример #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Story"/> class.
        /// </summary>
        /// <param name="project">The project.</param>  
        /// <param name="aangemaaktDoor">The aangemaakt door.</param>
        /// <param name="impact">The impact.</param>
        /// <param name="storyType">Type of the story.</param>
        public Story(Project project, Gebruiker aangemaaktDoor, Impact? impact, StoryType storyType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project", "Het project mag niet null zijn.");
            }

            if (aangemaaktDoor == null)
            {
                throw new ArgumentNullException("aangemaaktDoor", "De gebruiker die deze story aanmaakt kan niet null zijn.");
            }

            project.VoegStoryToe(this);
            this.aangemaaktDoor = aangemaaktDoor;
            this.impact = impact;
            this.storyType = storyType;
        }
Пример #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Story"/> class.
        /// </summary>
        /// <param name="project">The project.</param>  
        /// <param name="createdBy">The user that created this story.</param>
        /// <param name="impact">The impact.</param>
        /// <param name="storyType">Type of the story.</param>
        public Story(Project project, User createdBy, Impact? impact, StoryType storyType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project", "Project can't be null.");
            }

            if (createdBy == null)
            {
                throw new ArgumentNullException("createdBy", "The user creating this story can't be null.");
            }

            project.AddStory(this);
            this.createdBy = createdBy;
            this.impact = impact;
            this.storyType = storyType;
        }
        public string AddGenre(string newType)
        {
            bool notExisting = this.Context.StoryTypes.Select(x => x.Name).All(x => x != newType);

            if (notExisting)
            {
                var newGenre = new StoryType
                {
                    Name = newType
                };
                this.Context.StoryTypes.Add(newGenre);
                this.Context.SaveChanges();

                return(GlobalConstants.Success);
            }

            return(GlobalConstants.Failed);
        }
Пример #24
0
        private static void AddToOutput(Active deleted,
                                        string title,
                                        string storyNumber,
                                        StoryType storyType,
                                        BookType bookType,
                                        string bookIssue,
                                        string bookIssueTitle,
                                        string language,
                                        string notes,
                                        int bookYear,
                                        DateTime purchaseDate,
                                        SortedSet <string> characters,
                                        SortedList <string, ArtistType> artists,
                                        SortedSet <string> series,
                                        SortedSet <string> publishers,
                                        StringBuilder exportText)
        {
            _ = exportText.Append('"' + Escape(title) + '"' + ',');
            _ = exportText.Append('"' + storyNumber + '"' + ',');
            _ = exportText.Append('"' + EnumHelper <StoryType> .GetName(storyType) + '"' + ',');
            _ = exportText.Append('"' + EnumHelper <BookType> .GetName(bookType) + '"' + ',');

            _ = exportText.Append('"' + String.Join(",", EscapeList(characters)) + '"' + ',');
            _ = exportText.Append('"' + String.Join(",", ArtistAndShortType(artists)) + '"' + ',');

            _ = exportText.Append('"' + bookIssue?.ToString() + '"' + ',');
            _ = exportText.Append('"' + Escape(bookIssueTitle) + '"' + ',');
            _ = exportText.Append('"' + language + '"' + ',');

            _ = exportText.Append('"' + String.Join(",", EscapeList(series)) + '"' + ',');
            _ = exportText.Append('"' + String.Join(",", EscapeList(publishers)) + '"' + ',');

            _ = exportText.Append('"' + bookYear.ToString() + '"' + ',');
            _ = exportText.Append('"' + purchaseDate.ToString("MM/dd/yyyy") + '"' + ',');
            _ = exportText.Append('"' + Escape(notes ?? "") + '"' + ',');
            _ = exportText.Append('"' + (deleted == Active.active ? "" : "del") + '"' + ',');
            _ = exportText.AppendLine();
        }
Пример #25
0
 private void SimpleCheckBox_Click(object sender, EventArgs e)
 {
     StoryType = StoryType.Simple;
     AdjustCheckBoxes();
 }
Пример #26
0
 private void UncommonCheckBox_Click(object sender, EventArgs e)
 {
     StoryType = StoryType.Uncommon;
     AdjustCheckBoxes();
 }
Пример #27
0
 private void TwistCheckBox_Click(object sender, EventArgs e)
 {
     StoryType = StoryType.Twisted;
     AdjustCheckBoxes();
 }
 [Test] public void TypeIsNotPeerType()
 {
     Assert.IsFalse(StoryType.Is(TaskType));
 }
 [Test] public void TypeIsClass()
 {
     Assert.IsTrue(StoryType.Is(WorkitemType));
 }
 [Test] public void CachedAttribute()
 {
     StoryType.GetAttributeDefinition("Order");
 }
 [Test] public void LookupAttribute()
 {
     StoryType.GetAttributeDefinition("Name");
 }
Пример #32
0
 public MapViewModel(IGraph sg, DataTable dt, StoryType storyType)
 {
     _dm = new MapDrawingManager(sg.GetLayout(), dt, storyType);
 }
 public FilteringCriteria Type(StoryType type)
 {
     this.AddFilter(string.Format("type:{0}", type.ToString().ToLower()));
     return this;
 }
 [Test] public void FailLookupAttribute()
 {
     StoryType.GetAttributeDefinition("Blah");
 }