Exemple #1
0
 public static List<CJSITE_MODULE> ToClass(DataTable data)
 {
     List<CJSITE_MODULE> list = new List<CJSITE_MODULE>();
      for (int i = 0; i < data.Rows.Count; i++) {
      CJSITE_MODULE cjsite_module = new CJSITE_MODULE();
     cjsite_module.ID =  data.Rows[i]["ID"]==DBNull.Value?"":Convert.ToString(data.Rows[i]["ID"]);
     cjsite_module.GROUPID =  data.Rows[i]["GROUPID"]==DBNull.Value?"":Convert.ToString(data.Rows[i]["GROUPID"]);
     cjsite_module.MODULENAME =  data.Rows[i]["MODULENAME"]==DBNull.Value?"":Convert.ToString(data.Rows[i]["MODULENAME"]);
     list.Add(cjsite_module);
      	}
     return list;
 }
Exemple #2
0
        private void queryModules()
        {
            string sql = "select * from CJSITE_MODULE order by MODULENAME desc";
            DBManager.ConnectCGDB();
            DataTable data = DBManager.DBHelperCG.ExcuteSql(sql);
            listModules = CJSITE_MODULE.ToClass(data);
            CJSITE_MODULE nolimit = new CJSITE_MODULE();
            nolimit.ID = "0";
            nolimit.MODULENAME = "不限";
            listModules.Add(nolimit);
            listModules.Reverse(0, listModules.Count);

            cbModule.ItemsSource = listModules;
        }