示例#1
0
        private void fillNameAndType(BAGlobalObject planBase, OutputItem checkItem)
        {
            TrainingPlan      plan  = planBase as TrainingPlan;
            TrainingPlanEntry entry = planBase as TrainingPlanEntry;
            TrainingPlanDay   day   = planBase as TrainingPlanDay;
            TrainingPlanSerie set   = planBase as TrainingPlanSerie;

            checkItem.Item = planBase;

            if (plan != null)
            {
                checkItem.Object = plan.Name;
                checkItem.Type   = StrengthTrainingEntryStrings.TrainingPlan_Object;
            }
            else if (entry != null)
            {
                checkItem.Object = entry.Exercise != null?entry.Exercise.GetLocalizedName() : "";

                checkItem.Type = StrengthTrainingEntryStrings.TrainingPlanDayEntry_Object;
            }
            if (day != null)
            {
                checkItem.Object = day.Name;
                checkItem.Type   = StrengthTrainingEntryStrings.TrainingPlanDay_Object;
            }
            if (set != null)
            {
                checkItem.Object = set.ToString();
                checkItem.Type   = StrengthTrainingEntryStrings.TrainingPlanSerie_Object;
            }
        }
        private string[] getNameAndType(TrainingPlanBase planBase)
        {
            TrainingPlan      plan  = planBase as TrainingPlan;
            TrainingPlanEntry entry = planBase as TrainingPlanEntry;
            TrainingPlanDay   day   = planBase as TrainingPlanDay;
            TrainingPlanSerie set   = planBase as TrainingPlanSerie;

            if (plan != null)
            {
                return(new string[] { plan.Name, LocalizedPropertyGridStrings.TrainingPlan_Object });
            }
            else if (entry != null)
            {
                return(new string[] { ObjectsReposidory.GetExercise(entry.ExerciseId).GetLocalizedName(), LocalizedPropertyGridStrings.TrainingPlanDayEntry_Object });
            }
            if (day != null)
            {
                return(new string[] { day.Name, LocalizedPropertyGridStrings.TrainingPlanDay_Object });
            }
            if (set != null)
            {
                return(new string[] { set.ToString(), LocalizedPropertyGridStrings.TrainingPlanSerie_Object });
            }
            return(null);
        }