Example #1
0
        public int CompareTo(object obj)
        {
            UserIssue orderToCompare = obj as UserIssue;

            if ((orderToCompare.issue.DueDate == null) & (issue.DueDate == null))
            {
                return(0);
            }
            else if ((orderToCompare.issue.DueDate == null) & (issue.DueDate != null))
            {
                return(1);
            }
            else if ((orderToCompare.issue.DueDate != null) & (issue.DueDate == null))
            {
                return(-1);
            }
            else if ((orderToCompare.issue.DueDate != null) & (issue.DueDate != null))
            {
                if (orderToCompare.issue.DueDate < issue.DueDate)
                {
                    return(1);
                }
                if (orderToCompare.issue.DueDate > issue.DueDate)
                {
                    return(-1);
                }
            }
            return(0);
        }
Example #2
0
        private void SetMessage(UserIssue userIssue, int type, float planPercent = 0)
        {
            if (userIssue.message == "")
            {
                if (userIssue.issue.DueDate != null)
                {
                    userIssue.message += "Проект: " + userIssue.issue.Project.Name + "-> задание № " + userIssue.issue.Id + ": " + userIssue.issue.Subject.Trim() + "\n" + "->" +
                                         " дата начала: " + userIssue.issue.StartDate.Value.ToShortDateString() + " -> дата завершения: " + userIssue.issue.DueDate.Value.ToShortDateString() + "\n";
                }
                else
                if (userIssue.issue.StartDate != null)
                {
                    userIssue.message += "Проект: " + userIssue.issue.Project.Name + "-> задание № " + userIssue.issue.Id + ": " + userIssue.issue.Subject.Trim() + "\n" + "->" +
                                         " дата начала: " + userIssue.issue.StartDate.Value.ToShortDateString() + " -> дата завершения: -" + "\n";
                }
            }


            switch (type)
            {
            case 1:
                userIssue.message += "Дата завершения задачи просрочена на текущую дату." + "\n";
                break;

            case 2:
                userIssue.message += "Текущий процент выполнения по задаче не соответствует плановому " + "\n" + "-> плановый % выполнения = " + planPercent.ToString("0") + "%" + " -> текущий % выполнения = " + userIssue.issue.DoneRatio + "%" + "\n";
                break;
            }
        }
Example #3
0
        public void GetUserOpenIssue()
        {
            listUserRedmine.Clear();

            try
            {
                NameValueCollection param = new NameValueCollection {
                    { "Id", "*" }
                };
                foreach (var user in redmineManager.GetObjects <User>(param))
                {
                    UserRedmine userRedmine = new UserRedmine();
                    userRedmine.Value = user;
                    listUserRedmine.Add(userRedmine);

                    if (userRedmine.Value.LastName.Equals("Чамин"))
                    {
                        userRedmine.EmailAddress = "*****@*****.**";
                    }
                }

                param = new NameValueCollection {
                    { "status_id", "open" }
                };
                foreach (var issue in redmineManager.GetObjects <Issue>(param))
                {
                    UserRedmine userRedmine = null;

                    if (issue.AssignedTo == null)
                    {
                        userRedmine = listUserRedmine.Find(x => x.Value.Id == issue.Author.Id);
                    }
                    else
                    {
                        userRedmine = listUserRedmine.Find(x => x.Value.Id == issue.AssignedTo.Id);
                    }

                    UserIssue userIssue = new UserIssue();
                    userIssue.issue = issue;

                    userRedmine.ListUserIssue.Add(userIssue);
                }

                this.Sort();
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.Now.ToString() + " Error in GetUserOpenIssue: {0}", ex);
                SaveError.SaveMessage(ex.ToString());
            }
        }
Example #4
0
        private bool IsOutPercent(UserIssue userIssue, out float planPercent)
        {
            bool result = false;

            planPercent = 0;
            float    curPercent = (float)userIssue.issue.DoneRatio;
            DateTime curDate = DateTime.Now;
            TimeSpan dt1, dt2;

            if ((userIssue.issue.DueDate != null) && ((curDate < userIssue.issue.DueDate) & (curDate > userIssue.issue.StartDate)))
            {
                dt1 = curDate - (DateTime)userIssue.issue.StartDate;
                dt2 = (DateTime)userIssue.issue.DueDate - (DateTime)userIssue.issue.StartDate;

                if (dt2.TotalSeconds != 0)
                {
                    planPercent = 100 * (float)(dt1.TotalSeconds / dt2.TotalSeconds);
                }
                else
                {
                    planPercent = 0;
                }
            }
            else if (curDate >= userIssue.issue.DueDate)
            {
                planPercent = 100;
            }
            else
            {
                planPercent = 0;
            }


            if ((planPercent - curPercent) > 10)
            {
                result = true;
            }

            return(result);
        }