Ejemplo n.º 1
0
        public void UpdateMilestoneAsyncTest()
        {
            var milestone = new Milestone(5978)
            {
                Name        = "test1",
                Description = null,
                StartDate   = new DateTime(2018, 11, 1),
                DueDate     = new DateTime(2018, 11, 22),
            };

            milestone.Name        = "test11";
            milestone.Description = "test111";
            milestone.StartDate   = new DateTime(2018, 11, 2);
            milestone.DueDate     = default;

            var updatedMilestone = _project.UpdateMilestoneAsync(milestone).Result.Content;

            Assert.AreNotEqual(updatedMilestone, null);
            Assert.AreEqual(updatedMilestone.Id, milestone.Id);
            Assert.AreEqual(updatedMilestone.Name, milestone.Name);
            Assert.AreEqual(updatedMilestone.Description, milestone.Description);
            Assert.AreEqual(updatedMilestone.StartDate, milestone.StartDate);
            Assert.AreEqual(updatedMilestone.DueDate, milestone.DueDate);
            Assert.AreEqual(updatedMilestone.IsArchived, milestone.IsArchived);

            milestone.Name        = "test1";
            milestone.Description = null;
            milestone.StartDate   = new DateTime(2019, 11, 1);
            milestone.DueDate     = new DateTime(2019, 11, 22);

            updatedMilestone = _project.UpdateMilestoneAsync(milestone).Result.Content;
            Assert.AreNotEqual(updatedMilestone, null);
            Assert.AreEqual(updatedMilestone.Id, milestone.Id);
            Assert.AreEqual(updatedMilestone.Name, milestone.Name);
            Assert.AreEqual(updatedMilestone.Description, milestone.Description);
            Assert.AreEqual(updatedMilestone.StartDate, milestone.StartDate);
            Assert.AreEqual(updatedMilestone.DueDate, milestone.DueDate);
            Assert.AreEqual(updatedMilestone.IsArchived, milestone.IsArchived);
        }
Ejemplo n.º 2
0
        public void SendAboutResponsibleByMilestone(Milestone milestone)
        {
            var recipient = ToRecipient(milestone.Responsible);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_ResponsibleForMilestone,
                    milestone.NotifyId,
                    new[] { recipient },
                    GetDefaultSenders(recipient),
                    null,
                    new TagValue(NotifyConstants.Tag_ProjectID, milestone.Project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, milestone.Project.Title),
                    new TagValue(NotifyConstants.Tag_EntityTitle, milestone.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, milestone.ID),
                    new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable {
                    { "MilestoneDescription", HttpUtility.HtmlEncode(milestone.Description) }
                }),
                    ReplyToTagProvider.Comment("project.milestone", milestone.ID.ToString()));
            }
        }
Ejemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Url != null ? Url.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HtmlUrl != null ? HtmlUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Number.GetHashCode();
         hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Body != null ? Body.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (User != null ? User.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Labels != null ? Labels.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Assignee != null ? Assignee.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Milestone != null ? Milestone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Comments;
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ ClosedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (PullRequest != null ? PullRequest.GetHashCode() : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
        public MilestoneWrapper(ProjectApiBase projectApiBase, Milestone milestone)
        {
            Id              = milestone.ID;
            ProjectOwner    = new SimpleProjectWrapper(milestone.Project);
            Title           = milestone.Title;
            Description     = milestone.Description;
            Created         = (ApiDateTime)milestone.CreateOn;
            Updated         = (ApiDateTime)milestone.LastModifiedOn;
            Status          = (int)milestone.Status;
            Deadline        = new ApiDateTime(milestone.DeadLine, TimeZoneInfo.Local);
            IsKey           = milestone.IsKey;
            IsNotify        = milestone.IsNotify;
            CanEdit         = projectApiBase.ProjectSecurity.CanEdit(milestone);
            CanDelete       = projectApiBase.ProjectSecurity.CanDelete(milestone);
            ActiveTaskCount = milestone.ActiveTaskCount;
            ClosedTaskCount = milestone.ClosedTaskCount;

            if (projectApiBase.Context.GetRequestValue("simple") != null)
            {
                CreatedById = milestone.CreateBy;
                UpdatedById = milestone.LastModifiedBy;
                if (!milestone.Responsible.Equals(Guid.Empty))
                {
                    ResponsibleId = milestone.Responsible;
                }
            }
            else
            {
                CreatedBy = projectApiBase.GetEmployeeWraper(milestone.CreateBy);
                if (milestone.CreateBy != milestone.LastModifiedBy)
                {
                    UpdatedBy = projectApiBase.GetEmployeeWraper(milestone.LastModifiedBy);
                }
                if (!milestone.Responsible.Equals(Guid.Empty))
                {
                    Responsible = projectApiBase.GetEmployeeWraper(milestone.Responsible);
                }
            }
        }
Ejemplo n.º 5
0
        private void ShowActionNotification(Milestone milestone, NotificationManager notificationManager, int i)
        {
            var resultIntent = new Intent(MainActivity.Instance, typeof(MainActivity));

            resultIntent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);

            var builder = new Notification.Builder(this)
                          .SetContentTitle($"Put the {milestone.ItemsToStartCooking} in at {milestone.Temperature}°")
                          .SetSmallIcon(Resource.Drawable.Icon_24)
                          .SetContentIntent(PendingIntent.GetActivity(MainActivity.Instance, 0, resultIntent, PendingIntentFlags.OneShot))
                          .SetAutoCancel(true)
                          .SetPriority((int)NotificationPriority.High);

            if (!MainActivity.Instance.IsVisible)
            {
                builder
                .SetDefaults(NotificationDefaults.All)
                .SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Alarm));
            }

            notificationManager.Notify(i, builder.Build());
        }
        public async Task <int> GetNumberOfCommitsBetween(Milestone previousMilestone, Milestone currentMilestone)
        {
            try
            {
                if (previousMilestone == null)
                {
                    var gitHubClientRepositoryCommitsCompare = await this.gitHubClient.Repository.Commit.Compare(this.user, this.repository, "master", currentMilestone.Title);

                    return(gitHubClientRepositoryCommitsCompare.AheadBy);
                }

                var compareResult = await this.gitHubClient.Repository.Commit.Compare(this.user, this.repository, previousMilestone.Title, "master");

                return(compareResult.AheadBy);
            }
            catch (NotFoundException)
            {
                // If there is not tag yet the Compare will return a NotFoundException
                // we can safely ignore
                return(0);
            }
        }
        protected void AddMilestone(Object s, EventArgs e)
        {
            string newName = txtName.Text.Trim();

            if (newName == String.Empty)
            {
                return;
            }

            Milestone newMilestone = new Milestone(ProjectId, newName, lstImages.SelectedValue);

            if (newMilestone.Save())
            {
                txtName.Text = "";
                BindMilestones();
                lstImages.SelectedValue = String.Empty;
            }
            else
            {
                lblError.Text = "Could not save Milestone";
            }
        }
Ejemplo n.º 8
0
        public void ShouldGenerateMilestonesForGoal()
        {
            //Arrange
            const int expectedGoalId = 10;
            const string expectedGoalName = "Testing Goal";
            Goal goal = new Goal(expectedGoalId, expectedGoalName, "Test", 100, GoalStatus.Open, false);

            //Set up the mocks
            mockRepository.Setup(r => r.GetForGoal(It.Is<int>(val => val == expectedGoalId))).Returns(new List<Milestone>());
            mockRepository.Setup(r => r.CreateMultipleForGoal(It.IsAny<IEnumerable<Milestone>>(), It.Is<int>(val => val == expectedGoalId)))
            .Returns<IEnumerable<Milestone>, int>
            (
                (unsavedMilestones, goalId) =>
                {
                    int id = 1;
                    foreach (var milestone in unsavedMilestones)
                    {
                        milestone.Id = id;
                        id++;
                    }
                    return unsavedMilestones;
                }
            );
            IMilestoneService service = new MilestoneService(mockRepository.Object);

            //Act
            Milestone[] milestones = service.GenerateMilestones(goal).ToArray();

            //Assert
            milestones.Should().NotBeNull();
            milestones.Count().Should().Be(EXPECTED_GENERATION_COUNT);
            milestones.Select(m => m.Id).Should().BeInAscendingOrder();
            for (int i = 1; i <= EXPECTED_GENERATION_COUNT; i++)
            {
                Milestone testMilestone = milestones[i - 1];
                testMilestone.Target.Should().Be((goal.Target / EXPECTED_GENERATION_COUNT) * i);
                testMilestone.Description.Should().Be($"{goal.Name} - {i}/{EXPECTED_GENERATION_COUNT} completed!");
            }
        }
        public async Task <IActionResult> UpdateMilestone([FromBody] Milestone milestone, int id)
        {
            if (milestone.Id != id)
            {
                return(BadRequest());
            }
            var item = await _context.Milestones.FirstOrDefaultAsync(ms => ms.Id == id);

            if (item == null)
            {
                return(NotFound());
            }
            if (!await MilestoneAccessCheck(item))
            {
                return(Forbid());
            }
            item.MilestoneStatusId = milestone.MilestoneStatusId;
            item.Name = milestone.Name;
            await _context.SaveChangesAsync();

            return(Ok(milestone));
        }
Ejemplo n.º 10
0
        private static async Task <Release> PublishReleaseForMilestone(string owner, string repoName, string tagName, string milestone, bool publish)
        {
            Console.WriteLine("{0}/{1}", owner, repoName);

            Milestone matchingMilestone = await GetMilestone(owner, repoName, milestone);

            if (matchingMilestone == null)
            {
                throw new InvalidOperationException($"Milestone {milestone} not found in repo {owner}/{repoName}");
            }

            Release release = null;

            if (matchingMilestone != null)
            {
                string releaseNotes = await BuildReleaseNotesForMilestone(owner, repoName, matchingMilestone);

                string releaseName = GetReleaseName(tagName);
                release = await CreateOrUpdateRelease(owner, repoName, tagName, releaseName, releaseNotes, publish);
            }
            return(release);
        }
Ejemplo n.º 11
0
        private static IDictionary <(string title, Milestone milestone), IList <PullRequest> > GroupPullrequestsByMilestone(
            [NotNull][ItemNotNull] IReadOnlyList <PullRequest> pullRequests)
        {
            IDictionary <(string title, Milestone milestone), IList <PullRequest> > collection =
                new Dictionary <(string title, Milestone milestone), IList <PullRequest> >
            {
                {
                    (null, null), new List <PullRequest>()
                },
            };

            foreach (PullRequest pullRequest in pullRequests)
            {
                (string Title, Milestone milestone)key;

                if (pullRequest.Milestone == null)
                {
                    key = (null, null);
                }
                else
                {
                    Milestone milestone = pullRequest.Milestone;
                    (string Title, Milestone milestone)tempKey = (milestone.Title, milestone);

                    if (collection.All(entry => entry.Key.title != pullRequest.Milestone.Title))
                    {
                        collection.Add(tempKey, new List <PullRequest>());
                    }

                    key = collection.Keys.First(entry => entry.title == pullRequest.Milestone.Title);
                }

                collection[key]
                .Add(pullRequest);
            }

            return(collection);
        }
Ejemplo n.º 12
0
        public void ShareTransactionAcrossContextInstancesWithTransactionTracking()
        {
            int resultCount = 0;
            int unitCount   = 0;
            var unit        = new Unit {
                LocationId = 1, Acquired = DateTime.Now.Date
            };

            using (var scope = new TransactionScope(TransactionScopeOption.Required,
                                                    new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                try
                {
                    using (var context = new BusinessDBContext())
                    {
                        context.Units.Add(unit);
                        context.SaveChanges();
                        unitCount = context.Units.Where(l => l.LocationId == 1).Count();
                    }
                    using (var context2 = new BusinessDBContext())
                    {
                        var milestone = new Milestone(1, DateTime.Now.Date,
                                                      $"Unit #{unitCount} acquired for location");
                        context2.Entry(milestone).State = EntityState.Added;
                        resultCount = context2.SaveChanges();
                    }
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception occured ({ex.Message})... transaction will rollback");
                }

                Assert.AreEqual(1, resultCount);
            }
        }
Ejemplo n.º 13
0
        public void LoadMilestones()
        {
            if (Strength >= 120)
            {
                Milestones |= Milestone.StunningForce;

                if (Strength >= 126)
                {
                    Milestones |= Milestone.EnergizedBolts;
                }
            }

            if (Constitution >= 105)
            {
                Milestones |= Milestone.BleedResistance1;

                if (Constitution >= 115)
                {
                    Milestones &= ~Milestone.BleedResistance1;
                    Milestones |= Milestone.BleedResistance2;

                    if (Constitution >= 120)
                    {
                        Milestones |= Milestone.ExceptionalHealth;
                    }
                }
            }

            if (Reasoning >= 115)
            {
                Milestones |= Milestone.MentalBarrier;

                if (Reasoning >= 125)
                {
                    Milestones |= Milestone.PenetrateMind;
                }
            }
        }
Ejemplo n.º 14
0
        public void SendAboutTaskRemoved(List <IRecipient> recipients, Task task, Milestone milestone, bool newMilestone)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                client.SendNoticeToAsync(newMilestone ? NotifyConstants.Event_TaskMovedToMilestone : NotifyConstants.Event_TaskMovedFromMilestone,
                                         task.NotifyId,
                                         recipients.ToArray(),
                                         true,
                                         new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
                                         new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
                                         new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
                                         new TagValue(NotifyConstants.Tag_EntityID, task.ID),
                                         new TagValue(NotifyConstants.Tag_SubEntityTitle, milestone.Title),
                                         new TagValue(NotifyConstants.Tag_AdditionalData, HttpUtility.HtmlEncode(task.Description)),
                                         ReplyToTagProvider.Comment("project.task", task.ID.ToString(CultureInfo.InvariantCulture)));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
        public static Version Version(this Milestone ver)
        {
            if (ver is null)
            {
                throw new ArgumentNullException(nameof(ver));
            }

            var nameWithoutPrerelease = ver.Title.Split('-')[0];

            if (nameWithoutPrerelease.StartsWith("v", StringComparison.OrdinalIgnoreCase))
            {
                _logger.Debug("Removing version prefix from {Name}", ver.Title);
                nameWithoutPrerelease = nameWithoutPrerelease.Remove(0, 1);
            }

            if (!System.Version.TryParse(nameWithoutPrerelease, out Version parsedVersion))
            {
                _logger.Warning("No valid version was found on {Title}", ver.Title);
                return(new Version(0, 0));
            }

            return(parsedVersion);
        }
Ejemplo n.º 16
0
 private void FillupMilestoneDropDown()
 {
     m_MilestoneDropDown.Items.Clear();
     if (SelectedProject == null)
     {
         m_MilestoneDropDown.Items.Add(new ListItem(m_SelectProjectDropDownEntry, String.Empty)
         {
             Selected = true
         });
     }
     else
     {
         IQueryable <Milestone> _milestones = from _milestone in SelectedProject.Milestone
                                              where _milestone.Active.GetValueOrDefault(false)
                                              orderby _milestone.SortOrder ascending
                                              select _milestone;
         m_MilestoneDropDown.EntityListDataSource <Milestone>(_milestones);
         Milestone _default = (from _amx in _milestones
                               where _amx.Default.GetValueOrDefault(false)
                               select _amx).FirstOrDefault();
         m_MilestoneDropDown.SelectItem4Element(_default);
     }
 }
Ejemplo n.º 17
0
        public ActionResult DeleteMilestone(int milestoneID, int assignmentID)
        {
            Milestone milestone = _db.Milestones
                                  .Where(x => x.ID == milestoneID)
                                  .SingleOrDefault();

            _db.Milestones.Remove(milestone);
            _db.SaveChanges();

            int milestoneCount = _db.Milestones
                                 .Where(x => x.AssignmentID == assignmentID)
                                 .Count();

            if (milestoneCount == 0)
            {
                Assignment assignment = _db.Assignments.Where(x => x.ID == assignmentID).SingleOrDefault();

                _db.Assignments.Remove(assignment);
                _db.SaveChanges();
            }

            return(Redirect("~/Teacher/Assignments"));
        }
        /// <summary>
        /// Set milestone status of milestone to In Progress so no other user can access/generate invoice
        /// </summary>
        /// <param name="milestoneId">The milestone id</param>
        /// <param name="userId"></param>
        /// <param name="milestoneStatus">Set milestone status</param>
        /// <param name="invoiceDate">Invoice date actual bill date</param>
        private void SetMilestoneStatus(int milestoneId, int?userId, int milestoneStatus, DateTime invoiceDate)
        {
            Milestone milestone = mdbDataContext.Milestones.Single(m => m.ID == milestoneId);

            if (milestone == null)
            {
                return;
            }

            milestone.MilestoneStatus1 = mdbDataContext.MilestoneStatus.Single(m => m.ID == milestoneStatus);

            //Set billing date if milestone status is link loaded
            if (milestoneStatus == Convert.ToInt32(Constants.MilestoneStatus.LINK_LOADED))
            {
                milestone.BillDate = invoiceDate;
            }

            //milestone.MilestoneStatusID = ms.ID;
            milestone.LastUpdatedBy   = userId;
            milestone.LastUpdatedDate = DateTime.Now;

            mdbDataContext.SubmitChanges();
        }
Ejemplo n.º 19
0
        public static bool CanEdit(Milestone milestone)
        {
            if (!Can(milestone))
            {
                return(false);
            }
            if (milestone.Project.Status == ProjectStatus.Closed)
            {
                return(false);
            }
            if (IsProjectManager(milestone.Project))
            {
                return(true);
            }
            if (!CanRead(milestone))
            {
                return(false);
            }

            return(IsInTeam(milestone.Project) &&
                   (milestone.CreateBy == CurrentUserId ||
                    milestone.Responsible == CurrentUserId));
        }
Ejemplo n.º 20
0
    public bool CarPooling(int[][] trips, int capacity)
    {
        List <Milestone> milestones = new List <Milestone>();

        for (int loop = 0; loop < trips.Length; loop++)
        {
            int cap    = trips[loop][0];
            int atpick = trips[loop][1];
            int atdrop = trips[loop][2];

            Milestone mpick = new Milestone(cap, atpick);
            Milestone mdrop = new Milestone(-cap, atdrop);
            milestones.Add(mpick);
            milestones.Add(mdrop);
        }

        milestones.Sort((a, b) => {
            if (a.at == b.at)
            {
                return(a.capacity.CompareTo(b.capacity));
            }
            return(a.at.CompareTo(b.at));
        });

        int c = 0;

        for (int loop = 0; loop < milestones.Count; loop++)
        {
            c += milestones[loop].capacity;
            if (c > capacity)
            {
                return(false);
            }
        }

        return(true);
    }
 private void ProjectChanged(Projects _project)
 {
     m_TaskCommentsTextBox.Text = String.Empty;
     m_TaskTitleTextBox.Text    = String.Empty;
     if (_project == null)
     {
         ProjectNotSelected(m_AsignedToDropDown);
         ProjectNotSelected(m_CategoryDropDown);
         m_ProjectLabel.Text = String.Empty;
     }
     else
     {
         Entities _edc = this.m_DataContext.DataContext;
         m_ProjectLabel.Text = _project.Title;
         int _pId = _project.Id.Value;
         m_AsignedToDropDown.EntityListDataSource(from _estimation in _edc.Estimation
                                                  where _estimation.Estimation2ProjectTitle.Id == _pId
                                                  select _estimation.AssignedTo);
         m_CategoryDropDown.EntityListDataSource(_project.Category);
         m_VersionDropDown.EntityListDataSource(_project.Milestone);
         IQueryable <Milestone> _activeMilestones = from _milestone in _project.Milestone
                                                    where _milestone.Active.GetValueOrDefault(true)
                                                    select _milestone;
         m_MilestoneDropDown.EntityListDataSource(_activeMilestones);
         Milestone _firsMilestone = _activeMilestones.FirstOrDefault <Milestone>();
         m_MilestoneDropDown.SelectItem4Element(_firsMilestone);
         if (m_ShowAllMilestonesCheckBox.Checked)
         {
             m_RequirementDropDown.EntityListDataSource(_project.Requirements);
             m_RequirementDropDown.SelectItem4Element(_firsMilestone.Requirements.FirstOrDefault <Requirements>());
         }
         else
         {
             m_RequirementDropDown.EntityListDataSource(_firsMilestone == null ? null : _firsMilestone.Requirements);
         }
     }
 }
Ejemplo n.º 22
0
        public IssueMilestonesViewModel(
            Func <Task <IReadOnlyList <Milestone> > > loadMilestones,
            Func <Task <Milestone> > currentMilestone,
            Func <Milestone, Task> updateIssue
            )
        {
            DismissCommand = ReactiveCommand.Create();

            var milestones = new ReactiveList <Milestone>();

            Milestones = milestones.CreateDerivedCollection(x =>
            {
                var vm = new IssueMilestoneItemViewModel(x);
                if (_selectedMilestone != null)
                {
                    vm.IsSelected = x.Number == _selectedMilestone.Number;
                }
                vm.GoToCommand
                .Select(_ => vm.IsSelected ? x : null)
                .Subscribe(milestone =>
                {
                    foreach (var a in Milestones.Where(y => y != vm))
                    {
                        a.IsSelected = false;
                    }
                    updateIssue(milestone).ToBackground();
                    DismissCommand.ExecuteIfCan();
                });
                return(vm);
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ =>
            {
                _selectedMilestone = (await currentMilestone());
                milestones.Reset(await loadMilestones());
            });
        }
Ejemplo n.º 23
0
        protected override async Task OnGetInternalAsync(SqlConnection connection)
        {
            var emptyMilestones = await new Milestones()
            {
                OrgId = OrgId, HasWorkItems = false
            }.ExecuteAsync(connection);

            EmptyMilestones = emptyMilestones.Select(ms => new OpenWorkItemsResult()
            {
                MilestoneId       = ms.Id,
                MilestoneDate     = ms.Date,
                MilestoneDaysAway = ms.DaysAway,
                MilestoneName     = ms.Name
            });

            NextSoonest = await Milestone.GetSoonestNextAsync(connection, OrgId);

            NextGenerated = await Milestone.CreateNextAsync(connection, OrgId);

            BacklogItems = await new OpenWorkItems()
            {
                OrgId = OrgId, HasMilestone = false
            }.ExecuteAsync(connection);
        }
        /// <summary>
        /// Return default billing
        /// </summary>
        /// <param name="contractId"></param>
        /// <param name="groupId"></param>
        /// <param name="periodFrequencyId"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        public MilestoneVO GetDefaultBillingLine(int contractId, int?groupId, int periodFrequencyId, DateTime fromDate,
                                                 DateTime toDate)
        {
            Milestone milestone =
                mdbDataContext.Milestones.FirstOrDefault(
                    m => m.ContractID == contractId && m.ContractMaintenance.GroupId == groupId &&
                    m.ContractMaintenance.ChargeFrequencyID == periodFrequencyId &&
                    m.ContractMaintenance.IsDefaultLineInGroup == true && !m.IsDeleted && !m.ContractMaintenance.IsDeleted &&
                    m.EstimatedDate >= fromDate && m.EstimatedDate <= toDate);

            #region Khushboo

            MilestoneVO milestoneVO = null;

            if (milestone != null)
            {
                //MilestoneVO milestoneVO = new MilestoneVO(milestone);
                milestoneVO = new MilestoneVO(milestone);
                //return milestoneVO;
            }
            else
            {
                //Billing line tag of that particular(original billing text) billing line
                Milestone milestoneOfParticularBillingLine =
                    mdbDataContext.Milestones.FirstOrDefault(
                        m => m.ContractID == contractId && m.ContractMaintenance.GroupId == groupId &&
                        m.ContractMaintenance.ChargeFrequencyID == periodFrequencyId &&
                        !m.IsDeleted && !m.ContractMaintenance.IsDeleted &&
                        m.EstimatedDate >= fromDate && m.EstimatedDate <= toDate);
                milestoneVO = new MilestoneVO(milestoneOfParticularBillingLine);
                //return null;
            }
            return(milestoneVO);

            #endregion
        }
        /// <summary>
        /// UnApprove milestones for payment
        /// </summary>
        /// <param name="Ids">Ids of milestones to be unapproved</param>
        /// <param name="userId">The logged in user id</param>
        public void UnApproveAllMaintenance(List <int> Ids, int?userId)
        {
            foreach (var id in Ids)
            {
                if (id != 0)
                {
                    Milestone milestone = mdbDataContext.Milestones.SingleOrDefault(c => c.ID == id);
                    if (milestone != null)
                    {
                        //If milestone status is "Approved for Payment"
                        if (milestone.MilestoneStatusID == Convert.ToInt32(Constants.MilestoneStatus.APPROVED_FOR_PAYMENT))
                        {
                            //Set milestone status as "Ready for Calculating"
                            milestone.MilestoneStatusID = Convert.ToInt32(Constants.MilestoneStatus.READY_FOR_CALCULATING);
                            milestone.IsApproved        = false;
                            milestone.LastUpdatedDate   = DateTime.Now;
                            milestone.LastUpdatedBy     = userId;
                        }
                    }
                }
            }

            mdbDataContext.SubmitChanges();
        }
Ejemplo n.º 26
0
        public ActionResult AddMilestone([Bind(Include = "MilestoneID,Text,StartDate,Duration,ProjectNumber,Type,ParentId,Progress,Id,StudentNumber")] Milestone milestone)
        {
            var userID = User.Identity.GetUserId();

            using (var db = new ProgressTrackerEntities())
            {
                if (ModelState.IsValid)
                {
                    milestone.StudentNumber = userID;
                    if (milestone.Progress == 1)
                    {
                        milestone.Status    = "Completed";
                        milestone.Completed = true;
                    }
                    else if (milestone.Progress > 0 && milestone.Progress < 1)
                    {
                        milestone.Status     = "In-Progress";
                        milestone.InProgress = true;
                    }
                    else
                    {
                        milestone.Status = "To-Do";
                        milestone.ToDo   = true;
                    }



                    db.Milestones.Add(milestone);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.MilestoneID = new SelectList(db.Students, "StudentNumber", "Course", milestone.MilestoneID);
            return(View(milestone));
        }
        public void GetChannelData(string citFilePath, long startPos, long endPos, int[] sTQIItemIndex)
        {
            List <double[]> datas = citProcess.GetAllChannelDataInRange(citFilePath, startPos, endPos);

            TQIClass  tqi       = new TQIClass();
            Milestone milestone = citProcess.GetAppointMilestone(citFilePath, startPos);

            tqi.iKM    = Convert.ToInt32(milestone.mKm);
            tqi.iMeter = milestone.mMeter;
            tqi.zgd    = GetTQIValue(datas[sTQIItemIndex[0]]);

            tqi.ygd = GetTQIValue(datas[sTQIItemIndex[1]]);
            tqi.zgx = GetTQIValue(datas[sTQIItemIndex[2]]);
            tqi.ygx = GetTQIValue(datas[sTQIItemIndex[3]]);
            tqi.gj  = GetTQIValue(datas[sTQIItemIndex[4]]);
            tqi.sp  = GetTQIValue(datas[sTQIItemIndex[5]]);
            tqi.sjk = GetTQIValue(datas[sTQIItemIndex[6]]);
            tqi.hj  = GetTQIValue(datas[sTQIItemIndex[7]]);
            tqi.cj  = GetTQIValue(datas[sTQIItemIndex[8]]);

            //tqi.pjsd=

            tqilist.Add(tqi);
        }
Ejemplo n.º 28
0
        public bool Update(IChapterTarget target)
        {
            bool hasBeenUpdated = false;

            if (!Reached)
            {
                switch (Milestone.getType())
                {
                case Completable.Milestone.MilestoneType.SCENE:
                    var isTargetedScene = Milestone.getId() == target.getId();

                    if (isTargetedScene)
                    {
                        Reached        = true;
                        hasBeenUpdated = true;
                    }
                    break;

                case Completable.Milestone.MilestoneType.ENDING:
                    if (target is Cutscene)
                    {
                        if (((Cutscene)target).isEndScene())
                        {
                            Reached        = true;
                            hasBeenUpdated = true;
                        }
                    }
                    break;

                default:
                    break;
                }
            }

            return(hasBeenUpdated);
        }
Ejemplo n.º 29
0
        private Feed ToFeed(Milestone milestone)
        {
            var itemUrl    = "/products/projects/milestones.aspx#project=" + milestone.Project.ID;
            var projectUrl = "/products/projects/tasks.aspx?prjID=" + milestone.Project.ID;

            return(new Feed(milestone.CreateBy, milestone.CreateOn)
            {
                Item = item,
                ItemId = milestone.ID.ToString(CultureInfo.InvariantCulture),
                ItemUrl = CommonLinkUtility.ToAbsolute(itemUrl),
                Product = Product,
                Module = Name,
                Title = milestone.Title,
                Description = Helper.GetHtmlDescription(HttpUtility.HtmlEncode(milestone.Description)),
                ExtraLocation = milestone.Project.Title,
                ExtraLocationUrl = CommonLinkUtility.ToAbsolute(projectUrl),
                AdditionalInfo = Helper.GetUser(milestone.Responsible).DisplayUserName(),
                AdditionalInfo2 = milestone.DeadLine.ToString("MM.dd.yyyy"),
                Keywords = string.Format("{0} {1}", milestone.Title, milestone.Description),
                HasPreview = false,
                CanComment = false,
                GroupId = GetGroupId(item, milestone.CreateBy, milestone.Project.ID.ToString(CultureInfo.InvariantCulture))
            });
        }
        /// <summary>
        /// Generate Invoice GL line VO for grouped billing lines
        /// </summary>
        /// <param name="milestone"></param>
        public InvoiceGLDetailVO(Milestone milestone)
        {
            Fields         = new string[16];
            ContractLineId = milestone.ContractLineID;
            ContractId     = milestone.ContractID;

            RecordType   = "N";
            CostCentre   = Convert.ToString(milestone.ContractLine.OACostCentre.CostCentreID);
            AccountCode  = Convert.ToString(milestone.ContractLine.OAAccountCode.AccountID);
            JobCode      = Convert.ToString(milestone.ContractLine.OAJobCode.JobCodeID);
            JobCodeId    = milestone.ContractLine.JobCodeID;
            ActivityCode = Convert.ToString(milestone.ContractLine.OAActivityCode.ActivityID);
            Value        = 0;
            TaxCode      = string.Empty;
            Field        = String.Join("|", Fields);

            IsGrouped             = milestone.ContractMaintenance.IsGrouped;
            GroupId               = milestone.ContractMaintenance.GroupId;
            PeriodFrequencyId     = milestone.ContractMaintenance.ChargeFrequencyID;
            ContractMaintenanceId = milestone.ContractMaintenance.ID;
            MilestoneId           = milestone.ID;

            InvoiceBillingLines = new List <InvoiceBillingLineVO>();
        }
Ejemplo n.º 31
0
 internal Milestone PutMilestone(Milestone milestone)
 {
     var overrideUrl = _issuesUrl + "milestones/" + milestone.id;
     return _sharpBucketV1.Put(milestone, overrideUrl);
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Updates an existing milestone in an issue tracker. 
 /// You must supply a name value in the form of a string. 
 /// Public and private issue trackers require the caller to authenticate with an account that has appropriate authorisation.
 /// </summary>
 /// <param name="milestone">The milestone.</param>
 /// <returns>The response from the BitBucket API.</returns>
 public Milestone PutMilestone(Milestone milestone)
 {
     return _repositoriesEndPoint.PutMilestone(milestone);
 }
			public Issue()
			{
				Id = 0;
				Number = 0;
				Title = "";
				Body = "";
				State = "";
				User = new User();
				Assignee = new User();
				Url = "";
				Labels = new List<Label>();
				Milestone = new Milestone();
			}
Ejemplo n.º 34
0
        private static void TestIssuesEndPoint(SharpBucketV1 sharpBucket)
        {
            var issuesResource = sharpBucket.RepositoriesEndPoint(accountName, repository).IssuesResource();

            int ISSUE_ID = 5;
            // Issues
            var issues = issuesResource.ListIssues();
            var newIssue = new Issue{title = "Let's add a new issue", content = "Some issue content", status = "new", priority = "trivial", kind = "bug"};
            var newIssueResult = issuesResource.PostIssue(newIssue);
            var issue = issuesResource.GetIssue(newIssueResult.local_id);
            var changedIssue = new Issue{title = "Completely new title", content = "Hi!", status = "new", local_id = issue.local_id};
            var changedIssueResult = issuesResource.PutIssue(changedIssue);
            issuesResource.DeleteIssue(changedIssueResult.local_id);

            // Issue comments
            var issueResource = issuesResource.IssueResource(ISSUE_ID);
            var issueComments = issueResource.ListComments();
            var newComment = new Comment{content = "This bug is really annoying!"};
            var newCommentResult = issueResource.PostComment(newComment);
            var comment = issueResource.GetIssueComment(newCommentResult.comment_id);
            comment.content = "The bug is still annoying";
            var updatedCommentRes = issueResource.PutIssueComment(comment);
            issueResource.DeleteIssueComment(updatedCommentRes.comment_id);

            // Issue followers
            var issueFollowers = issueResource.ListFollowers();

            // Components
            var components = issuesResource.ListComponents();
            var newComponent = new Component{name = "Awesome component"};
            var newComponentRes = issuesResource.PostComponent(newComponent);
            var component = issuesResource.GetComponent(newComponentRes.id);
            component.name = "Even more awesome component";
            var updatedComponent = issuesResource.PutComponent(component);
            issuesResource.DeleteComponent(updatedComponent.id);

            // Milestones
            var milestones = issuesResource.ListMilestones();
            var newMilestone = new Milestone{name = "Awesome milestone"};
            var newMilestoneRes = issuesResource.PostMilestone(newMilestone);
            var milestone = issuesResource.GetMilestone(newMilestoneRes.id);
            milestone.name = "Even more awesome milestone";
            var updatedMilestone = issuesResource.PutMilestone(milestone);
            issuesResource.DeleteMilestone(updatedMilestone.id);

            // Versions
            var versions = issuesResource.ListVersions();
            var newVersion = new Version{name = "Awesome version"};
            var newVersionRes = issuesResource.PostVersion(newVersion);
            var version = issuesResource.GetVersion(newVersionRes.id);
            version.name = "Even more awesome version";
            var updatedversion = issuesResource.PutVersion(version);
            issuesResource.DeleteVersion(updatedversion.id);
        }
Ejemplo n.º 35
0
 private Milestone GetMilestone(Milestone milestone)
 {
     var overrideUrl = _issuesUrl + "milestones/" + milestone.id;
     return _sharpBucketV1.Get(milestone, overrideUrl);
 }
Ejemplo n.º 36
0
    // Generate a List of Tasks with random Weights
    private void GenerateTaskList()
    {
        /*
            How Tasks are Generated

            - First, we assume that a project is percent based, meaning 100% is completed.
            - Then, we divide 100% into chunks of 5%-15%, meaning there will be between 7 to 20 Tasks.
            - When a task is created, we pass it's weight into it. Then we divid this weight by deadlineMax(the length of the game)
                 to find how many secs it will take to complete.
        */
        float totalCompletion = 100;
        float currentPos = 0;
        while(totalCompletion > 0)
        {
            // 5-15 at 360 secs means 18-54secs for a task, that is a max, so youd need to complete each task before that amount of time
            float weight = Random.Range(5,15);				// Get Random TaskWeight, this is a percentage of total work, not an amount of time
            float difference = totalCompletion - weight;	// Find Difference

            if(difference < 0) weight = totalCompletion;	// If taskweight is greater than total completion, weight = total completion
            totalCompletion -= weight;

            Task task = new Task(weight);

            taskList.Add(task);

            // Generate Milestones
            if(currentPos > 0)
            {
                Milestone milestone = new Milestone(currentPos);
                milestones.Add(milestone);
            }

            currentPos += weight;
            //Debug.Log("GenerateTaskList -> Task" + taskList.Count + " weight is " + weight);
        }

        //Debug.Log("GenerateTaskList -> Count is " + taskList.Count + ", with " + milestones.Count + "milestones");
    }