Exemplo n.º 1
0
 public IEnumerable<SelectListItem> Tags()
 {
     var cv = new CodeValueModel();
     var tg = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Id").ToList();
     tg.Insert(0, new SelectListItem { Value = "0", Text = "(not specified)" });
     return tg;
 }
Exemplo n.º 2
0
        public static IEnumerable <SelectListItem> Tags()
        {
            var cv = new CodeValueModel();
            var tg = ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Id").ToList();

            if (HttpContextFactory.Current.User.IsInRole("Edit"))
            {
                tg.Insert(0, new SelectListItem {
                    Value = "-1", Text = "(last query)"
                });
            }
            tg.Insert(0, new SelectListItem {
                Value = "0", Text = "(not specified)"
            });
            return(tg);
        }
Exemplo n.º 3
0
 public SelectList Tags()
 {
     var cv = new CodeValueModel();
     var tg = cv.UserTags(Util.UserPeopleId);
     tg = tg.Select(tt => new CodeValueItem {Value = $"tag: {tt.Id}:{tt.Value}"}).ToList();
     var q = from e in DbUtil.Db.PeopleExtras
             where e.StrValue != null
             group e by e.FieldValue
             into g
             select new CodeValueItem {Value = "exval: " + g.Key};
     tg.AddRange(q);
     if (HttpContext.Current.User.IsInRole("Admin"))
         tg.Insert(0, new CodeValueItem {Value = "last query"});
     tg.Insert(0, new CodeValueItem {Value = "(not specified)"});
     var list = tg.ToSelect("Value");
     var sel = list.SingleOrDefault(mm => mm.Value == Tag);
     if (sel != null)
         sel.Selected = true;
     return list;
 }
Exemplo n.º 4
0
 public static IEnumerable<SelectListItem> Tags()
 {
     var cv = new CodeValueModel();
     var tg = ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Id").ToList();
     if (HttpContext.Current.User.IsInRole("Edit"))
         tg.Insert(0, new SelectListItem {Value = "-1", Text = "(last query)"});
     tg.Insert(0, new SelectListItem {Value = "0", Text = "(not specified)"});
     return tg;
 }
Exemplo n.º 5
0
 public IEnumerable<CodeValueItem> Tags()
 {
     var up = DbUtil.Db.CurrentUserPerson;
     if (up == null)
         return new List<CodeValueItem>();
     var ctl = new CodeValueModel();
     var pid = DbUtil.Db.CurrentUser.PeopleId;
     var list = ctl.UserTags(pid);
     return list;
 }
Exemplo n.º 6
0
 public IEnumerable<CodeValueItem> Tags()
 {
     if (Util.UserPeopleId == null)
         return new List<CodeValueItem>();
     var ctl = new CodeValueModel();
     var list = ctl.UserTags(Util.UserPeopleId);
     return list;
 }
Exemplo n.º 7
0
        public void SetVisibility()
        {
            CodeData = null;
            ConditionName = ConditionName;
            CompareData = Comparisons().ToList();
            if (QuartersVisible)
                QuartersLabel = fieldMap.QuartersTitle;
            if (TagsVisible)
            {
                var cv = new CodeValueModel();
                TagData = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Code");
            }
            if (PmmLabelsVisible)
            {
                var cv = new CodeValueModel();
                PmmLabelData = CodeValueModel.ConvertToSelect(CodeValueModel.PmmLabels(), "Code");
            }

            var cvctl = new CodeValueModel();
            switch (fieldMap.Type)
            {
                case FieldType.Bit:
                case FieldType.NullBit:
                    CodeData = CodeValueModel.ConvertToSelect(BitCodes, fieldMap.DataValueField);
                    break;
                case FieldType.NullCode:
                case FieldType.Code:
                case FieldType.CodeStr:
                    if (fieldMap.DataSource == "ExtraValues")
                        CodeData = StandardExtraValues.ExtraValueCodes();
                    else if (fieldMap.DataSource == "Campuses")
                        CodeData = Campuses();
                          else if( fieldMap.DataSource == "Activities" )
                          {
                              var ret = ( from e in DbUtil.Db.CheckInActivities select e.Activity ).Distinct();
                              CodeData = from e in ret
                                  select new SelectListItem() {Text = e, Value = e};
                          }
                          else
                              CodeData = CodeValueModel.ConvertToSelect( Util.CallMethod( cvctl, fieldMap.DataSource ), fieldMap.DataValueField );
                    break;
                case FieldType.DateField:
                    CodeData = CodeValueModel.ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField);
                    break;
            }
            var cc = Selected;
            if (cc == null)
                return;

            if (fieldMap.Type == FieldType.Group)
            {
                CompareData = Comparisons().ToList();
                UpdateEnabled = cc.IsGroup;
                return;
            }
            UpdateEnabled = !cc.IsGroup && !cc.IsFirst;
            AddToGroupEnabled = cc.IsGroup;
            AddEnabled = !cc.IsFirst;
            RemoveEnabled = !cc.IsFirst;
        }
Exemplo n.º 8
0
        public void EditCondition()
        {
            var c = Selected;
            if (c == null)
                return;
            SetVisibility();

            ConditionName = c.FieldInfo.Name;
            CompareData = Comparisons().ToList();
            Comparison = c.Comparison;

            if (QuartersVisible)
                QuartersLabel = fieldMap.QuartersTitle;
            if (TagsVisible)
            {
                var cv = new CodeValueModel();
                TagData = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Code");
            }
            if (PmmLabelsVisible)
            {
                PmmLabelData = CodeValueModel.ConvertToSelect(CodeValueModel.PmmLabels(), "Code");
            }

            var cvctl = new CodeValueModel();
            switch (fieldMap.Type)
            {
                case FieldType.Bit:
                case FieldType.NullBit:
                    CodeData = CodeValueModel.ConvertToSelect(BitCodes, fieldMap.DataValueField);
                    break;
                case FieldType.NullCode:
                case FieldType.Code:
                case FieldType.CodeStr:
                    if (fieldMap.DataSource == "ExtraValues")
                    {
                        CodeData = StandardExtraValues.ExtraValueCodes();
                    }
                    else if (fieldMap.DataSource == "FamilyExtraValues")
                        CodeData = StandardExtraValues.FamilyExtraValueCodes();
                    else if (fieldMap.DataSource == "Campuses")
                        CodeData = Campuses();
                    else if (fieldMap.DataSource == "Activities")
                    {
                        var ret = (from e in DbUtil.Db.CheckInActivities select e.Activity).Distinct();
                        CodeData = from e in ret
                                   select new SelectListItem() { Text = e, Value = e };
                    }
                    else
                        CodeData = CodeValueModel.ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField);
                    break;
                case FieldType.DateField:
                    CodeData = CodeValueModel.ConvertToSelect(Util.CallMethod(cvctl, fieldMap.DataSource), fieldMap.DataValueField);
                    break;
            }

            if (fieldMap.Type == FieldType.Group)
            {
                CompareData = Comparisons().ToList();
                UpdateEnabled = c.IsGroup;
            }
            else
            {
                UpdateEnabled = !c.IsGroup && !c.IsFirst;
                AddToGroupEnabled = c.IsGroup;
                AddEnabled = !c.IsFirst;
                RemoveEnabled = !c.IsFirst;
            }
            switch (c.FieldInfo.Type)
            {
                case FieldType.String:
                case FieldType.StringEqual:
                case FieldType.StringEqualOrStartsWith:
                    TextValue = c.TextValue;
                    break;
                case FieldType.Integer:
                case FieldType.IntegerSimple:
                case FieldType.IntegerEqual:
                case FieldType.NullInteger:
                    IntegerValue = c.TextValue;
                    break;
                case FieldType.Number:
                case FieldType.NumberLG:
                case FieldType.NullNumber:
                    NumberValue = c.TextValue;
                    break;
                case FieldType.Date:
                case FieldType.DateSimple:
                    DateValue = DateString(c.DateValue);
                    break;
                case FieldType.Code:
                case FieldType.NullCode:
                case FieldType.CodeStr:
                case FieldType.DateField:
                case FieldType.Bit:
                case FieldType.NullBit:
                    CodeValue = c.CodeIdValue;
                    if (c.HasMultipleCodes && CodeValue.HasValue())
                    {
                        CodeValues = c.CodeIdValue.Split(';');
                        foreach (var i in CodeData)
                            i.Selected = CodeValues.Contains(i.Value);
                    }
                    break;
            }
            Program = c.Program;
            DivisionData = Divisions(Program).ToList();
            Division = c.Division;
            OrganizationData = Organizations(Division).ToList();
            Organization = c.Organization;
            Schedule = c.Schedule;
            Campus = c.Campus;
            OrgType = c.OrgType;
            StartDate = DateString(c.StartDate);
            EndDate = DateString(c.EndDate);
            AddToGroupEnabled = c.IsGroup;
            AddEnabled = !c.IsFirst;
            RemoveEnabled = !c.IsFirst;
            Days = c.Days.ToString();
            Age = c.Age.ToString();
            Quarters = c.Quarters;
            if (TagsVisible)
            {
                if (c.Tags != null)
                    Tags = c.Tags.Split(';');
                var cv = new CodeValueModel();
                TagData = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Code");
                foreach (var i in TagData)
                    i.Selected = Tags.Contains(i.Value);
            }
            if (PmmLabelsVisible)
            {
                if (c.Tags != null)
                    PmmLabels = c.Tags.Split(',').Select(vv => vv).ToArray();
                var cv = new CodeValueModel();
                PmmLabelData = CodeValueModel.ConvertToSelect(CodeValueModel.PmmLabels(), "Id");
                if (PmmLabels != null)
                    foreach (var i in PmmLabelData)
                        i.Selected = PmmLabels.Contains(i.Value);
            }
            if (MinistryVisible)
                Ministry = c.Program;
            //SavedQueryDesc = c.SavedQueryIdDesc;
        }
Exemplo n.º 9
0
 public void EditCondition()
 {
     var c = Db.LoadQueryById(SelectedId);
     if (c == null)
         return;
     ConditionName = c.FieldInfo.Name;
     SetVisibility();
     Comparison = c.Comparison;
     switch (c.FieldInfo.Type)
     {
         case FieldType.String:
         case FieldType.StringEqual:
         case FieldType.StringEqualOrStartsWith:
             TextValue = c.TextValue;
             break;
         case FieldType.Integer:
         case FieldType.IntegerSimple:
         case FieldType.IntegerEqual:
         case FieldType.NullInteger:
             IntegerValue = c.TextValue;
             break;
         case FieldType.Number:
         case FieldType.NumberLG:
         case FieldType.NullNumber:
             NumberValue = c.TextValue;
             break;
         case FieldType.Date:
         case FieldType.DateSimple:
             DateValue = DateString(c.DateValue);
             break;
         case FieldType.Code:
         case FieldType.NullCode:
         case FieldType.CodeStr:
         case FieldType.DateField:
         case FieldType.Bit:
         case FieldType.NullBit:
             CodeValue = c.CodeIdValue;
             if (c.HasMultipleCodes && CodeValue.HasValue())
             {
                 CodeValues = c.CodeIdValue.Split(';');
                 foreach (var i in CodeData)
                     i.Selected = CodeValues.Contains(i.Value);
             }
             break;
     }
     Program = c.Program;
     DivisionData = Divisions(Program).ToList();
     Division = c.Division;
     OrganizationData = Organizations(Division).ToList();
     Organization = c.Organization;
     Schedule = c.Schedule;
     Campus = c.Campus;
     OrgType = c.OrgType;
     StartDate = DateString(c.StartDate);
     EndDate = DateString(c.EndDate);
     SelectMultiple = c.HasMultipleCodes;
     AddToGroupEnabled = c.IsGroup;
     AddEnabled = !c.IsFirst;
     RemoveEnabled = !c.IsFirst;
     Days = c.Days.ToString();
     Age = c.Age.ToString();
     Quarters = c.Quarters;
     if (TagsVisible)
     {
         if (c.Tags != null)
             Tags = c.Tags.Split(';');
         var cv = new CodeValueModel();
         TagData = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Code");
         foreach (var i in TagData)
             i.Selected = Tags.Contains(i.Value);
     }
     if (PmmLabelsVisible)
     {
         if (c.Tags != null)
             PmmLabels = c.Tags.Split(',').Select(vv => vv).ToArray();
         var cv = new CodeValueModel();
         PmmLabelData = CodeValueModel.ConvertToSelect(cv.PmmLabels(), "Id");
         if(PmmLabels != null)
             foreach (var i in PmmLabelData)
                 i.Selected = PmmLabels.Contains(i.Value);
     }
     if (MinistryVisible)
         Ministry = c.Program;
     SavedQueryDesc = c.SavedQueryIdDesc;
 }
Exemplo n.º 10
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:
                case FieldType.NumberLG:
                    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;
        }
Exemplo n.º 11
0
 public List<SelectListItem> Tags()
 {
     var cv = new CodeValueModel();
     var tg = CodeValueModel.ConvertToSelect(cv.UserTags(Util.UserPeopleId), "Id");
     tg = tg.Select(tt => new SelectListItem { Text = "tag: {0}:{1}".Fmt(tt.Value, tt.Text) }).ToList();
     var q = from e in DbUtil.Db.PeopleExtras
             where e.StrValue != null
             group e by e.FieldValue into g
             select new SelectListItem { Text = "exval: " + g.Key };
     tg.AddRange(q);
     if (HttpContext.Current.User.IsInRole("Admin"))
         tg.Insert(0, new SelectListItem { Text = "last query" });
     tg.Insert(0, new SelectListItem { Text = "(not specified)" });
     var sel = tg.SingleOrDefault(mm => mm.Text == Tag);
     if(sel != null)
         sel.Selected = true;
     return tg.ToList();
 }