Exemple #1
0
        public static List <TypeList> GetCodeList(int[] codes)
        {
            List <TypeList> list = new List <TypeList>();

            using (pm2Entities entities = new pm2Entities())
            {
                foreach (int code in codes)
                {
                    TypeList item = (from m in entities.Basic_CodeList
                                     where (m.ItemCode == code) && (m.TypeCode == "ProjectState")
                                     select new TypeList {
                        _Value = m.ItemCode, Text = m.ItemName
                    }).FirstOrDefault <TypeList>();
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Exemple #2
0
        public static void BindDrop(DropDownList drop, bool isProject, string definedText, int?definedValue, List <int> displayCode)
        {
            List <TypeList> prjState = GetPrjState(isProject);
            List <TypeList> list2    = new List <TypeList>();

            if (displayCode != null)
            {
                foreach (TypeList list3 in prjState)
                {
                    if (displayCode.Contains(list3._Value.Value))
                    {
                        list2.Add(list3);
                    }
                }
            }
            TypeList item = AddExtraType(definedText, definedValue);

            list2.Insert(0, item);
            drop.DataSource     = list2;
            drop.DataValueField = "Value";
            drop.DataTextField  = "Text";
            drop.DataBind();
        }