Esempio n. 1
0
 public void OnFilterFinishedCommand(bool aShowFinished, bool aShowUnfinished)
 {
     FilterPlanList.Clear();
     for (int pos = 0; pos < PlanList.Count; pos++)
     {
         PlanEntity item = PlanList[pos];
         if ((aShowFinished && item.AccomplishDate.HasValue) ||
             (aShowUnfinished && !item.AccomplishDate.HasValue))
         {
             FilterPlanList.Add(item);
         }
     }
 }
Esempio n. 2
0
        public void OnFilterFinishedCommand(bool aDateFilter, Nullable <DateTime> aStart, Nullable <DateTime> aEnd)
        {
            FilterPlanList.Clear();
            for (int pos = 0; pos < PlanList.Count; pos++)
            {
                PlanEntity item           = PlanList[pos];
                DateTime   targetDateTime = item.TargetDateAdjustment2.HasValue ? item.TargetDateAdjustment2.Value :
                                            (item.TargetDateAdjustment1.HasValue ? item.TargetDateAdjustment1.Value : item.TargetDate);

                do
                {
                    if (aDateFilter)
                    {
                        if (aStart.HasValue && aEnd.HasValue)
                        {
                            if (!((targetDateTime >= aStart && targetDateTime <= aEnd) ||
                                  (item.AccomplishDate.HasValue && item.AccomplishDate.Value >= aStart && item.AccomplishDate.Value <= aEnd)))
                            {
                                break;
                            }
                        }
                        else if (aStart.HasValue)
                        {
                            if (!(targetDateTime >= aStart || (item.AccomplishDate.HasValue && item.AccomplishDate.Value >= aStart)))
                            {
                                break;
                            }
                        }
                        else if (aEnd.HasValue)
                        {
                            if (!(targetDateTime <= aEnd || (item.AccomplishDate.HasValue && item.AccomplishDate.Value <= aEnd)))
                            {
                                break;
                            }
                        }
                    }
                    FilterPlanList.Add(item);
                } while (false);
            }
        }
Esempio n. 3
0
        public void OnFilterCommand(string projectName, string manufactureNumber, bool showFinished, bool showUnfinished,
                                    Nullable <DateTime> startTargetDate, Nullable <DateTime> endTargetDate,
                                    Nullable <DateTime> startAccomplishDate, Nullable <DateTime> endAccomplishDate,
                                    bool showOvertime)
        {
            FilterPlanList.Clear();
            for (int pos = 0; pos < PlanList.Count; pos++)
            {
                PlanEntity item           = PlanList[pos];
                DateTime   targetDateTime = item.TargetDateAdjustment2.HasValue ? item.TargetDateAdjustment2.Value :
                                            (item.TargetDateAdjustment1.HasValue ? item.TargetDateAdjustment1.Value : item.TargetDate);
                if (null != projectName && string.Empty != projectName && projectName != item.ProjectName)
                {
                    continue;
                }

                if (null != manufactureNumber && string.Empty != manufactureNumber && manufactureNumber != item.ManufactureNumber)
                {
                    continue;
                }

                if (null != startTargetDate && targetDateTime < startTargetDate)
                {
                    continue;
                }

                if (null != endTargetDate && targetDateTime > endTargetDate)
                {
                    continue;
                }

                if (!showFinished && item.AccomplishDate.HasValue)
                {
                    continue;
                }

                if (!showUnfinished && !item.AccomplishDate.HasValue)
                {
                    continue;
                }

                if (null != startAccomplishDate &&
                    (!item.AccomplishDate.HasValue || item.AccomplishDate.Value < startAccomplishDate))
                {
                    continue;
                }

                if (null != endAccomplishDate &&
                    (!item.AccomplishDate.HasValue || item.AccomplishDate.Value > endAccomplishDate))
                {
                    continue;
                }

                if (showOvertime)
                {
                    DateTime today = DateTime.Now;
                    if (item.AccomplishDate.HasValue)
                    {
                        if (item.AccomplishDate.Value <= today)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (targetDateTime >= today)
                        {
                            continue;
                        }
                    }
                }

//                 if (totalValueDictionary.ContainsKey(item.SheetName))
//                 {
//                     totalValueDictionary[item.SheetName] += item.Weight;
//                     if (item.AccomplishDate.HasValue && item.Score.HasValue)
//                     {
//                         accomplishValueDictionary[item.SheetName] += item.Score.Value;
//                     }
//                 }
//                 else
//                 {
//                     totalValueDictionary.Add(item.SheetName, item.Weight);
//                     accomplishValueDictionary.Add(item.SheetName, item.Score.HasValue ? item.Score.Value : 0);
//                 }
                FilterPlanList.Add(item);
            }

//             Dictionary<string, int> currentAccomplishRateDictionary = new Dictionary<string, int>();
//             foreach (KeyValuePair<string, decimal> kv in totalValueDictionary)
//             {
//                 decimal resultValue = (0 == kv.Value) ? 0 : accomplishValueDictionary[kv.Key] / kv.Value;
//                 int resultInt = Convert.ToInt16(Convert.ToDouble(resultValue) * 100);
//                 currentAccomplishRateDictionary.Add(kv.Key, resultInt);
//             }
//             AccomplishRateDictionary = currentAccomplishRateDictionary;
        }