Ejemplo n.º 1
0
        public PlanListHistoryWindow(string aTitle, ObservableCollection <PlanListViewModel> aPlanListViewModelList,
                                     PlanExtraEntity aPlanExtraEntity, PlanTraceViewModel aPlanTraceViewModel, ProjectEntity aProjectEntity,
                                     string aLastPlanVersiontId)
        {
            InitializeComponent();
            this.Title = aTitle;
            this.planListViewModelList             = aPlanListViewModelList;
            this.planExtraEntity                   = aPlanExtraEntity;
            this.PlanTraceViewModel                = aPlanTraceViewModel;
            this.projectEntity                     = aProjectEntity;
            this.versionComboBox.ItemsSource       = projectEntity.PlanVersionDictionary;
            this.versionComboBox.IsEnabled         = projectEntity.HasHistory;
            this.versionComboBox.SelectedValuePath = "Key";
            this.versionComboBox.DisplayMemberPath = "Key";
            this.versionComboBox.SelectedValue     = aLastPlanVersiontId;
            this.LastPlanVersiontId                = aLastPlanVersiontId;
            this.SelectVersionId                   = aLastPlanVersiontId;

            if (null == aPlanExtraEntity)
            {
                this.planListTabControl.Margin = new Thickness(2, 2, 2, 2);
                this.planListTabControl.SetValue(Canvas.ZIndexProperty, 3);
                this.planExtraGrid.SetValue(Canvas.ZIndexProperty, 1);
            }
            else
            {
                this.planExtraGrid.DataContext = planExtraEntity;
            }

            Dictionary <string, int> accomplishRateDictionary = new Dictionary <string, int>();

            foreach (PlanListViewModel item in planListViewModelList)
            {
                PlanListTraceDataGrid planListDataGrid = new PlanListTraceDataGrid(item, null != planExtraEntity);
                AddTabItem(item.Title, planListDataGrid as UserControl);

                decimal tatal      = 0;
                decimal accomplish = 0;
                foreach (PlanEntity planEntity in item.PlanList)
                {
                    tatal += planEntity.Weight;
                    if (planEntity.AccomplishDate.HasValue && planEntity.Score.HasValue)
                    {
                        accomplish += planEntity.Score.Value;
                    }
                }
                decimal resultValue = (0 == tatal) ? 0 : accomplish / tatal;
                int     resultInt   = Convert.ToInt16(Convert.ToDouble(resultValue) * 100);
                accomplishRateDictionary.Add(item.Title, resultInt);
            }


            PlanListEvaluateResultChart planListEvaluateResultChart = new PlanListEvaluateResultChart(accomplishRateDictionary);

            AddTabItem("完成率", planListEvaluateResultChart as UserControl);
        }
        public PlanListHistoryWindow(string aTitle, ObservableCollection<PlanListViewModel> aPlanListViewModelList,
            PlanExtraEntity aPlanExtraEntity, PlanTraceViewModel aPlanTraceViewModel, ProjectEntity aProjectEntity,
            string aLastPlanVersiontId)
        {
            InitializeComponent();
            this.Title = aTitle;
            this.planListViewModelList = aPlanListViewModelList;
            this.planExtraEntity = aPlanExtraEntity;
            this.PlanTraceViewModel = aPlanTraceViewModel;
            this.projectEntity = aProjectEntity;
            this.versionComboBox.ItemsSource = projectEntity.PlanVersionDictionary;
            this.versionComboBox.IsEnabled = projectEntity.HasHistory;
            this.versionComboBox.SelectedValuePath = "Key";
            this.versionComboBox.DisplayMemberPath = "Key";
            this.versionComboBox.SelectedValue = aLastPlanVersiontId;
            this.LastPlanVersiontId = aLastPlanVersiontId;
            this.SelectVersionId = aLastPlanVersiontId;

            if (null == aPlanExtraEntity)
            {
                this.planListTabControl.Margin = new Thickness(2, 2, 2, 2);
                this.planListTabControl.SetValue(Canvas.ZIndexProperty, 3);
                this.planExtraGrid.SetValue(Canvas.ZIndexProperty, 1);
            }
            else
            {
                this.planExtraGrid.DataContext = planExtraEntity;
            }

            Dictionary<string, int> accomplishRateDictionary = new Dictionary<string, int>();
            foreach (PlanListViewModel item in planListViewModelList)
            {
                PlanListTraceDataGrid planListDataGrid = new PlanListTraceDataGrid(item, null != planExtraEntity);
                AddTabItem(item.Title, planListDataGrid as UserControl);

                decimal tatal = 0;
                decimal accomplish = 0;
                foreach (PlanEntity planEntity in item.PlanList)
                {
                    tatal += planEntity.Weight;
                    if (planEntity.AccomplishDate.HasValue && planEntity.Score.HasValue)
                    {
                        accomplish += planEntity.Score.Value;
                    }
                }
                decimal resultValue = (0 == tatal) ? 0 : accomplish / tatal;
                int resultInt = Convert.ToInt16(Convert.ToDouble(resultValue) * 100);
                accomplishRateDictionary.Add(item.Title, resultInt);
            }

            PlanListEvaluateResultChart planListEvaluateResultChart = new PlanListEvaluateResultChart(accomplishRateDictionary);
            AddTabItem("完成率", planListEvaluateResultChart as UserControl);
        }
        public PlanListTraceWindow(string aTitle, ObservableCollection <PlanListViewModel> aPlanListViewModelList,
                                   PlanExtraEntity aPlanExtraEntity, PlanTraceViewModel aPlanTraceViewModel)
        {
            InitializeComponent();
            this.Title = aTitle;
            this.planListViewModelList = aPlanListViewModelList;
            this.planExtraEntity       = aPlanExtraEntity;
            this.PlanTraceViewModel    = aPlanTraceViewModel;


            if (null == aPlanExtraEntity)
            {
                this.planListTabControl.Margin = new Thickness(2, 2, 2, 2);
                this.planListTabControl.SetValue(Canvas.ZIndexProperty, 3);
                this.planExtraGrid.SetValue(Canvas.ZIndexProperty, 1);
                this.QuestionButton.IsEnabled = false;
            }
            else
            {
                this.planExtraGrid.DataContext = planExtraEntity;
                ManufactureNumber             = aPlanExtraEntity.ManufactureNumber;
                this.QuestionButton.IsEnabled = true;
            }

            Dictionary <string, int> accomplishRateDictionary = new Dictionary <string, int>();

            foreach (PlanListViewModel item in planListViewModelList)
            {
                PlanListTraceDataGrid planListDataGrid = new PlanListTraceDataGrid(item, null != planExtraEntity);
                AddTabItem(item.Title, planListDataGrid as UserControl);

                decimal tatal      = 0;
                decimal accomplish = 0;
                foreach (PlanEntity planEntity in item.PlanList)
                {
                    tatal += planEntity.Weight;
                    if (planEntity.AccomplishDate.HasValue && planEntity.Score.HasValue)
                    {
                        accomplish += planEntity.Score.Value;
                    }
                }
                decimal resultValue = (0 == tatal) ? 0 : accomplish / tatal;
                int     resultInt   = Convert.ToInt16(Convert.ToDouble(resultValue) * 100);
                accomplishRateDictionary.Add(item.Title, resultInt);
            }


            PlanListEvaluateResultChart planListEvaluateResultChart = new PlanListEvaluateResultChart(accomplishRateDictionary);

            AddTabItem("完成率", planListEvaluateResultChart as UserControl);
        }
        public PlanListTraceWindow(string aTitle, ObservableCollection<PlanListViewModel> aPlanListViewModelList,
            PlanExtraEntity aPlanExtraEntity, PlanTraceViewModel aPlanTraceViewModel)
        {
            InitializeComponent();
            this.Title = aTitle;
            this.planListViewModelList = aPlanListViewModelList;
            this.planExtraEntity = aPlanExtraEntity;
            this.PlanTraceViewModel = aPlanTraceViewModel;

            if (null == aPlanExtraEntity)
            {
                this.planListTabControl.Margin = new Thickness(2, 2, 2, 2);
                this.planListTabControl.SetValue(Canvas.ZIndexProperty, 3);
                this.planExtraGrid.SetValue(Canvas.ZIndexProperty, 1);
                this.QuestionButton.IsEnabled = false;
            }
            else
            {
                this.planExtraGrid.DataContext = planExtraEntity;
                ManufactureNumber = aPlanExtraEntity.ManufactureNumber;
                this.QuestionButton.IsEnabled = true;
            }

            Dictionary<string, int> accomplishRateDictionary = new Dictionary<string, int>();
            foreach (PlanListViewModel item in planListViewModelList)
            {
                PlanListTraceDataGrid planListDataGrid = new PlanListTraceDataGrid(item, null != planExtraEntity);
                AddTabItem(item.Title, planListDataGrid as UserControl);

                decimal tatal = 0;
                decimal accomplish = 0;
                foreach (PlanEntity planEntity in item.PlanList)
                {
                    tatal += planEntity.Weight;
                    if (planEntity.AccomplishDate.HasValue && planEntity.Score.HasValue)
                    {
                        accomplish += planEntity.Score.Value;
                    }
                }
                decimal resultValue = (0 == tatal) ? 0 : accomplish / tatal;
                int resultInt = Convert.ToInt16(Convert.ToDouble(resultValue) * 100);
                accomplishRateDictionary.Add(item.Title, resultInt);
            }

            PlanListEvaluateResultChart planListEvaluateResultChart = new PlanListEvaluateResultChart(accomplishRateDictionary);
            AddTabItem("完成率", planListEvaluateResultChart as UserControl);
        }
        public PlanListEvaluateWindow(string aTitle, ObservableCollection<PlanListViewModel> aPlanListViewModelList, 
            Dictionary<string, int> aPlanEvaluateResultDictionary, PlanExtraEntity aPlanExtraEntity)
        {
            InitializeComponent();
            this.Title = aTitle;
            this.planListViewModelList = aPlanListViewModelList;
            this.planEvaluateResultDictionary = aPlanEvaluateResultDictionary;
            this.planExtraEntity = aPlanExtraEntity;

            foreach (PlanListViewModel planListViewModel in this.planListViewModelList)
            {
                PlanListEvaluateDataGrid planListDataGrid = new PlanListEvaluateDataGrid(planListViewModel, null == this.planExtraEntity);
                AddTabItem(planListViewModel.Title, planListDataGrid as UserControl);
            }

            PlanListEvaluateResultChart planListEvaluateResultChart = new PlanListEvaluateResultChart(aPlanEvaluateResultDictionary);
            AddTabItem("完成率", planListEvaluateResultChart as UserControl);
        }
        public PlanListEvaluateWindow(string aTitle, ObservableCollection <PlanListViewModel> aPlanListViewModelList,
                                      Dictionary <string, int> aPlanEvaluateResultDictionary, PlanExtraEntity aPlanExtraEntity)
        {
            InitializeComponent();
            this.Title = aTitle;
            this.planListViewModelList        = aPlanListViewModelList;
            this.planEvaluateResultDictionary = aPlanEvaluateResultDictionary;
            this.planExtraEntity = aPlanExtraEntity;

            foreach (PlanListViewModel planListViewModel in this.planListViewModelList)
            {
                PlanListEvaluateDataGrid planListDataGrid = new PlanListEvaluateDataGrid(planListViewModel, null == this.planExtraEntity);
                AddTabItem(planListViewModel.Title, planListDataGrid as UserControl);
            }

            PlanListEvaluateResultChart planListEvaluateResultChart = new PlanListEvaluateResultChart(aPlanEvaluateResultDictionary);

            AddTabItem("完成率", planListEvaluateResultChart as UserControl);
        }