Пример #1
0
        public static List <SelectListItem> GetCapabilityGroup(int?defaultValue)
        {
            List <SelectListItem> list = new List <SelectListItem>();

            var data = new CapabilityRepository().GetCapabilityGroup();

            foreach (var item in data)
            {
                SelectListItem select = new SelectListItem();
                select.Value    = item.CapGID.ToString();
                select.Text     = item.CapGName;
                select.Selected = defaultValue.HasValue ? (item.CapGID == defaultValue ? true : false) : false;
                list.Add(select);
            }
            return(list);
        }
Пример #2
0
        public static List <SelectListItem> GetCapabilityGroupType(int?capgid, int?defaultValue)
        {
            List <SelectListItem> list = new List <SelectListItem>();

            var data = new CapabilityRepository().GetCapabilityGroup();

            var group = data.Where(w => w.CapGID == capgid).FirstOrDefault();

            string table = string.Empty;

            if (group != null)
            {
                table = group.TableName;
            }

            if (table == "tb_Division")
            {
                list = GetDivision(defaultValue, false);
            }
            else if (table == "tb_Department")
            {
                list = GetDepartmentFull(null, defaultValue, false);
            }
            else if (table == "tb_Section")
            {
                list = GetSectionFull(null, null, defaultValue, false);
            }
            else if (table == "tb_Position")
            {
                list = GetPosition(defaultValue, null, false);
            }
            else if (table == "tb_Level")
            {
                list = GetLevel(defaultValue);
            }
            else if (table == "tb_Discipline")
            {
                list = GetDiscipline(defaultValue, false);
            }

            return(list);
        }