Example #1
0
        public static List <NameType> GetNameListByTypeId(int processtype)
        {
            List <Process>  list   = GetDataList();
            List <NameType> result = new List <NameType>();

            foreach (Process p in list)
            {
                if (p.TypeId == processtype && p.Status > 0)
                {
                    NameType nt = new NameType();
                    nt.Id   = p.ProcessId;
                    nt.Name = p.ProcessName;
                    result.Add(nt);
                }
            }
            if (result.Count > 0)
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
 public static List <NameType> GetNameTypeListDataTable(DataTable dt, int IdIndex, int NameIndex)
 {
     if (dt == null)
     {
         return(null);
     }
     if (IdIndex >= 0 && IdIndex < dt.Columns.Count)
     {
         if (NameIndex >= 0 && NameIndex < dt.Columns.Count)
         {
             List <NameType> result = new List <NameType>();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 NameType nt = new NameType()
                 {
                     Id = int.Parse(dt.Rows[i][IdIndex].ToString()), Name = dt.Rows[i][NameIndex].ToString()
                 };
                 result.Add(nt);
             }
             return(result);
         }
     }
     return(null);
 }
Example #3
0
        public static List <NameType> GetDataNameList()
        {
            DataTable dt = GetDataTable("1=1");

            return(NameType.GetNameTypeListDataTable(dt, 0, 2));
        }
Example #4
0
        public static List <NameType> GetNameListByTable(DataTable dt)
        {
            List <NameType> list = NameType.GetNameTypeListDataTable(dt, 0, 1);

            return(list);
        }