Пример #1
0
        public IEnumerable <SelectListItem> GetCodeData()
        {
            var cvctl = new CodeValueModel();

            switch (fieldMap.Type)
            {
            case FieldType.Bit:
            case FieldType.NullBit:
                return(ConvertToSelect(BitCodes, fieldMap.DataValueField));

            case FieldType.Code:
            case FieldType.NullCode:
            case FieldType.CodeStr:
                if (fieldMap.DataSource == "ExtraValues")
                {
                    return(StandardExtraValues.ExtraValueCodes());
                }
                if (fieldMap.DataSource == "Campuses")
                {
                    return(Campuses());
                }
                return(ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField));

            case FieldType.DateField:
                return(ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField));
            }
            return(null);
        }
Пример #2
0
        public void SetVisibility()
        {
            RightPanelVisible   = true;
            TextVisible         = false;
            NumberVisible       = false;
            CodeVisible         = false;
            CodesVisible        = false;
            DateVisible         = false;
            CodeData            = null;
            ConditionName       = ConditionName;
            CompareData         = Comparisons().ToList();
            DivisionVisible     = fieldMap.HasParam("Division");
            ProgramVisible      = fieldMap.HasParam("Program");
            OrganizationVisible = fieldMap.HasParam("Organization");
            ScheduleVisible     = fieldMap.HasParam("Schedule");
            CampusVisible       = fieldMap.HasParam("Campus");
            OrgTypeVisible      = fieldMap.HasParam("OrgType");
            DaysVisible         = fieldMap.HasParam("Days");
            AgeVisible          = fieldMap.HasParam("Age");
            SavedQueryVisible   = fieldMap.HasParam("SavedQueryIdDesc");
            MinistryVisible     = fieldMap.HasParam("Ministry");
            QuartersVisible     = fieldMap.HasParam("Quarters");
            if (QuartersVisible)
            {
                QuartersLabel = fieldMap.QuartersTitle;
            }
            TagsVisible = fieldMap.HasParam("Tags");
            if (TagsVisible)
            {
                var cv = new CodeValueModel();
                TagData = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Code");
            }
            PmmLabelsVisible = fieldMap.HasParam("PmmLabels");
            if (PmmLabelsVisible)
            {
                var cv = new CodeValueModel();
                PmmLabelData = CodeValueModel.ConvertToSelect(cv.PmmLabels(), "Code");
            }
            StartDateVisible = fieldMap.HasParam("StartDate");
            EndDateVisible   = fieldMap.HasParam("EndDate");

            var cvctl = new CodeValueModel();

            switch (fieldMap.Type)
            {
            case FieldType.Bit:
            case FieldType.NullBit:
                CodeVisible = true;
                CodeData    = CodeValueModel.ConvertToSelect(BitCodes, fieldMap.DataValueField);
                break;

            case FieldType.String:
            case FieldType.StringEqual:
            case FieldType.StringEqualOrStartsWith:
                TextVisible = true;
                break;

            case FieldType.NullNumber:
            case FieldType.Number:
                NumberVisible = true;
                break;

            case FieldType.NullInteger:
            case FieldType.Integer:
            case FieldType.IntegerSimple:
            case FieldType.IntegerEqual:
                IntegerVisible = true;
                break;

            case FieldType.NullCode:
            case FieldType.Code:
            case FieldType.CodeStr:
                CodeVisible = true;
                if (fieldMap.DataSource == "ExtraValues")
                {
                    CodeData = StandardExtraValues.ExtraValueCodes();
                }
                else if (fieldMap.DataSource == "Campuses")
                {
                    CodeData = Campuses();
                }
                else
                {
                    CodeData = CodeValueModel.ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField);
                }
                break;

            case FieldType.Date:
            case FieldType.DateSimple:
                DateVisible = true;
                break;

            case FieldType.DateField:
                CodeVisible = true;
                CodeData    = CodeValueModel.ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField);
                break;
            }
            var cc = Db.LoadQueryById(SelectedId);

            if (cc == null)
            {
                return;
            }

            if (fieldMap.Type == FieldType.Group)
            {
                CompareData       = Comparisons().ToList();
                RightPanelVisible = false;
                UpdateEnabled     = cc.IsGroup;
                return;
            }
            UpdateEnabled     = !cc.IsGroup && !cc.IsFirst;
            AddToGroupEnabled = cc.IsGroup;
            AddEnabled        = !cc.IsFirst;
            RemoveEnabled     = !cc.IsFirst;
        }