public TeachingCountGroup(TeachingStatisticTypeEnum statisticType, string teacherID, List <ClassInfoForTeacherModel> details,
                                  DateTime startDate, DateTime endDate, bool isSortByMonth, RegularClassManagement regularClass, BlockClassManagement blocks)
        {
            StatisticType = statisticType;
            TeacherID     = teacherID;
            TeacherName   = TeacherManagementBussiness.Instance.Teachers.Where(t => t.TeacherID == teacherID).First().TeacherName;
            List <DateTime> spans = PublicMathods.GetDateSpan(startDate, endDate, isSortByMonth);

            ClassCountGroup = new Dictionary <DateTime, int>();
            DetailsGroup    = new Dictionary <DateTime, List <ClassInfoForTeacherModel> >();
            foreach (DateTime span in spans)
            {
                ClassCountGroup.Add(span, details == null ?
                                    0 :
                                    details.Count(d => d.ClassDate >= span && d.ClassDate < (isSortByMonth ? span.AddMonths(1) : span.AddYears(1))));
                DetailsGroup.Add(span,
                                 details == null ?
                                 null :
                                 details.Where(d => d.ClassDate >= span && d.ClassDate < (isSortByMonth ? span.AddMonths(1) : span.AddYears(1))).ToList());
                if (DetailsGroup[span] != null)
                {
                    foreach (ClassInfoForTeacherModel item in DetailsGroup[span])
                    {
                        item.ClassName = item.ClassType == 0 ?
                                         regularClass.GetClassNameInHis(item.ClassID, item.ClassDate) :
                                         blocks.BlockClassCollection.Where(b => b.ClassID == item.ClassID).First().ClassName;
                    }
                }
            }
        }
Example #2
0
 public AccountItemViewModel(ItemInfoModel item)
 {
     _item    = item;
     ItemImg  = PublicMathods.GetImage(item.IconName);
     ItemName = item.ItemName;
     ChangeSelecState(false);
 }
        public void ChangeSelectState(bool isSelected)
        {
            ImgBkg      = isSelected ? _recordColor : GlobalVariables.MainBackColor;
            FontColor   = isSelected ? GlobalVariables.MainBackColor : Colors.Black;
            AmountColor = isSelected ? GlobalVariables.MainBackColor : _recordColor;
            string iconPath;

            switch (_statisticType)
            {
            case StatisticTypeEnum.ClassFee:
                iconPath = isSelected ? GlobalVariables.ClassPaymentIconPressed : GlobalVariables.ClassPaymentIcon;
                break;

            case StatisticTypeEnum.TeacherFee:
                iconPath = isSelected ? GlobalVariables.TeacherFeeIconPressed : GlobalVariables.TeacherFeeIcon;
                break;

            default:
                iconPath = isSelected ?
                           ItemManagementBussiness.Instance.Items.Where(i => i.ItemID == _normalAccount.ItemID).First().IconNamePressed :
                           ItemManagementBussiness.Instance.Items.Where(i => i.ItemID == _normalAccount.ItemID).First().IconName;
                break;
            }
            Img          = PublicMathods.GetImage(iconPath);
            VisOperation = isSelected ? Visibility.Visible : Visibility.Hidden;
        }
 public void Enable(List <ClassInfoForTeacherModel> details)
 {
     AccountRecordsCollection.Clear();
     foreach (ClassInfoForTeacherModel item in details)
     {
         AccountRecordsCollection.Add(new TeachingCountViewModel(item.ClassName, item.ClassDate));
     }
     PublicMathods.Sort(AccountRecordsCollection);
 }
Example #5
0
        public void Enable(List <AccountInfoModel> normalStatistic,
                           List <TeacherFeeModel> teacherFeeStatistic, List <ClassPaymentModel> classpaymentStatistic, Color statisticColor)
        {
            AccountRecordsCollection.Clear();
            if (normalStatistic != null)
            {
                foreach (AccountInfoModel item in normalStatistic)
                {
                    AccountRecordsCollection.Add(new FinanceRecordViewModel(item, statisticColor));
                    AccountRecordsCollection.Last().FinanceRecordSelectedEvent += OnFinanceRecordSelected;
                    AccountRecordsCollection.Last().DeleteRecordEvent          += OnDeleteRecord;
                }
            }

            if (teacherFeeStatistic != null)
            {
                foreach (TeacherFeeModel item in teacherFeeStatistic)
                {
                    AccountRecordsCollection.Add(new FinanceRecordViewModel(item, statisticColor, _bussiness));
                    AccountRecordsCollection.Last().FinanceRecordSelectedEvent += OnFinanceRecordSelected;
                    AccountRecordsCollection.Last().DeleteRecordEvent          += OnDeleteRecord;
                }
            }

            if (classpaymentStatistic != null)
            {
                foreach (ClassPaymentModel item in classpaymentStatistic)
                {
                    AccountRecordsCollection.Add(new FinanceRecordViewModel(item, statisticColor, _bussiness));
                    AccountRecordsCollection.Last().FinanceRecordSelectedEvent += OnFinanceRecordSelected;
                    AccountRecordsCollection.Last().DeleteRecordEvent          += OnDeleteRecord;
                }
            }

            PublicMathods.Sort(AccountRecordsCollection);
        }
Example #6
0
 public void ChangeSelecState(bool isSelected)
 {
     ItemColor     = isSelected ? (_item.IsIncome ? GlobalVariables.IncomeColor : GlobalVariables.ExpenseColor) : GlobalVariables.MainBackColor;
     ItemForeColor = isSelected ? GlobalVariables.MainBackColor : (_item.IsIncome ? GlobalVariables.IncomeColor : GlobalVariables.ExpenseColor);
     ItemImg       = PublicMathods.GetImage(isSelected ? _item.IconNamePressed : _item.IconName);
 }