예제 #1
0
 public StoryLite2(StoryLite storyLite)
 {
     Id = storyLite.Id;
     ImageId = storyLite.ImageId;
     Name = storyLite.Name;
     Description = storyLite.Description;
 }
예제 #2
0
 private void RemoveStoryLite(StoryLite storyLite)
 {
     SelectedStoryLites.Remove(SelectedStoryLites.Find(s => s.Id == storyLite.Id));
 }
예제 #3
0
 private void AddStoryLite(StoryLite storyLite)
 {
     SelectedStoryLites.Add(storyLite);
 }
예제 #4
0
 private void AddStoryLite(StoryLite storyLite)
 {
     SelectedStoryLites.Add(storyLite);
 }
예제 #5
0
 private void RemoveStoryLite(StoryLite storyLite)
 {
     SelectedStoryLites.Remove(SelectedStoryLites.Find(s => s.Id == storyLite.Id));
 }
예제 #6
0
        private void update_Click(object sender, RoutedEventArgs e)
        {
            backgroundWorker1.RunWorkerAsync();
            var progBar = sharpProgress;

            update.IsEnabled = false;
            var teamText  = Team.Text;
            var storyText = Story.Text;
            var userText  = Username.Text;

            sc = new SharpCloudApi(userText, Password.Password.ToString());
            try
            {
                Console.WriteLine(sc.Stories());
            }
            catch
            {
                MessageBox.Show("Invalid Username or Password");
                update.IsEnabled = true;
                return;
            }
            StoryLite[] teamBook = new StoryLite[30];
            try
            {
                teamBook = sc.StoriesTeam(teamText);
            }
            catch
            {
                MessageBox.Show("Invalid Team");
                update.IsEnabled = true;
                return;
            }
            Story dashStory = null;

            try
            {
                dashStory = sc.LoadStory(storyText);
            }
            catch
            {
                MessageBox.Show("Invalid Story");
                update.IsEnabled = true;
                return;
            }
            sharpProgress.Maximum = teamBook.Length - 1;
            sharpProgress.Value   = 0;
            sharpProgress.Minimum = 1;

            // Adds new attributes if story does not have it
            if (dashStory.Attribute_FindByName("Appropriated Budget") == null)
            {
                dashStory.Attribute_Add("Appropriated Budget", SC.API.ComInterop.Models.Attribute.AttributeType.Numeric);
            }
            if (dashStory.Attribute_FindByName("RAG Status") == null)
            {
                dashStory.Attribute_Add("RAG Status", SC.API.ComInterop.Models.Attribute.AttributeType.List);
            }
            if (dashStory.Attribute_FindByName("New Requested Budget") == null)
            {
                dashStory.Attribute_Add("New Requested Budget", SC.API.ComInterop.Models.Attribute.AttributeType.Numeric);
            }
            if (dashStory.Attribute_FindByName("Project Business Value") == null)
            {
                dashStory.Attribute_Add("Project Business Value", SC.API.ComInterop.Models.Attribute.AttributeType.Text);
            }
            if (dashStory.Attribute_FindByName("Project Dependencies/Assumptions/Risks") == null)
            {
                dashStory.Attribute_Add("Project Dependencies/Assumptions/Risks", SC.API.ComInterop.Models.Attribute.AttributeType.Text);
            }
            if (dashStory.Attribute_FindByName("Total Spent to Date") == null)
            {
                dashStory.Attribute_Add("Total Spent to Date", SC.API.ComInterop.Models.Attribute.AttributeType.Numeric);
            }
            Story tagStory = sc.LoadStory(teamBook[0].Id);

            // Add tags to new story
            foreach (var tag in tagStory.ItemTags)
            {
                if (dashStory.ItemTag_FindByName(tag.Name) == null)
                {
                    dashStory.ItemTag_AddNew(tag.Name, tag.Description, tag.Group);
                }
            }
            MessageBox.Show("Updating");
            sharpProgress.Value++;
            foreach (StoryLite storyTeam in teamBook)
            {
                Story story = sc.LoadStory(storyTeam.Id);
                highCost(dashStory, story);
                sharpProgress.Value++;
            }
            dashStory.Save();
            MessageBox.Show("Done");
            update.IsEnabled = true;
        }