// Смещаем время проекта
        void btnCom_New_Time_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;

            if (btn == null || !(btn.Tag is Project))
            {
                return;
            }

            var win = new ChangeDateWindow(((Project)btn.Tag).TimeBegin)
            {
                Owner = Window.GetWindow(this)
            };

            if (win.ShowDialog() != true)
            {
                return;
            }

            ProjectManager.ChangeProjectPropety(((Project)btn.Tag).ProjectID, ProjectPropertyType.Com_New_Time, win.NewDate);
            ProjectManager.AddComment(((Project)btn.Tag).ProjectID, win.NewComment);
        }
Esempio n. 2
0
        /// <summary>Установка планируемой даты</summary>
        public static void SetPlanDate(ProjectPropertyType type, Project p, Window owner)
        {
            if (!p.IsManagerSetPlanDate)
            {
                return;
            }

            var  time  = DateTime.Now.Date.AddDays(-1);
            bool isNew = true;
            var  title = string.Format("Изменение времени '{0}'", Project.GetDescription(type));

            switch (type)
            {
                #region ITO_G_Time_Plan
            case ProjectPropertyType.ITO_G_Time_Plan:
            {
                if (p.Time_ITO_G_Plan.HasValue)
                {
                    time  = p.Time_ITO_G_Plan.Value;
                    isNew = false;
                }

                break;
            }

                #endregion
                #region ITO_E_Time_Plan
            case ProjectPropertyType.ITO_E_Time_Plan:
            {
                if (p.Time_ITO_E_Plan.HasValue)
                {
                    time  = p.Time_ITO_E_Plan.Value;
                    isNew = false;
                }

                break;
            }

                #endregion
                #region ITO_R_Time_Plan
            case ProjectPropertyType.ITO_R_Time_Plan:
            {
                if (p.Time_ITO_R_Plan.HasValue)
                {
                    time  = p.Time_ITO_R_Plan.Value;
                    isNew = false;
                }

                break;
            }
                #endregion

                #region WH_G_Time_Plan
            case ProjectPropertyType.WH_G_Time_Plan:
            {
                if (p.Time_WH_G_Plan.HasValue)
                {
                    time  = p.Time_WH_G_Plan.Value;
                    isNew = false;
                }

                break;
            }

                #endregion
                #region WH_E_Time_Plan
            case ProjectPropertyType.WH_E_Time_Plan:
            {
                if (p.Time_WH_E_Plan.HasValue)
                {
                    time  = p.Time_WH_E_Plan.Value;
                    isNew = false;
                }

                break;
            }

                #endregion
                #region WH_R_Time_Plan
            case ProjectPropertyType.WH_R_Time_Plan:
            {
                if (p.Time_WH_R_Plan.HasValue)
                {
                    time  = p.Time_WH_R_Plan.Value;
                    isNew = false;
                }

                break;
            }
                #endregion

                #region OMTS_G_Time_Plan
            case ProjectPropertyType.OMTS_G_Time_Plan:
            {
                if (p.Time_OMTS_G_Plan.HasValue)
                {
                    time  = p.Time_OMTS_G_Plan.Value;
                    isNew = false;
                }

                break;
            }

                #endregion
                #region OMTS_E_Time_Plan
            case ProjectPropertyType.OMTS_E_Time_Plan:
            {
                if (p.Time_OMTS_E_Plan.HasValue)
                {
                    time  = p.Time_OMTS_E_Plan.Value;
                    isNew = false;
                }

                break;
            }
                #endregion

                #region OTK_Time_Plan
            case ProjectPropertyType.OTK_Time_Plan:
            {
                if (p.Time_OTK_Plan.HasValue)
                {
                    time  = p.Time_OTK_Plan.Value;
                    isNew = false;
                }

                break;
            }
                #endregion
            }

            var win = new ChangeDateWindow(time, false)
            {
                Owner = owner, Title = title
            };
            if (win.ShowDialog() != true || !win.NewDate.HasValue)
            {
                return;
            }

            ChangeProjectPropety(p.ProjectID, type, win.NewDate);

            // коментарий в зависимости от
            if (isNew)
            {
                AddComment(p.ProjectID, string.Format("Задали: '{0}' на: {1} - {2}", Project.GetDescription(type), win.NewDate.Value.ToString("dd/MM/yyyy"), win.NewComment));
            }
            else
            {
                AddComment(p.ProjectID, string.Format("Изменили: '{0}' c: {1} на: {2} - {3}", Project.GetDescription(type), time.ToString("dd/MM/yyyy"), win.NewDate.Value.ToString("dd/MM/yyyy"), win.NewComment));
            }
        }