예제 #1
0
 public static bool LoadDepartments()
 {
     try
     {
         string connection = ConnectionStr(); bool rst = false;
         using (OracleConnection con = new OracleConnection(connection))
         {
             con.Open();
             string        sql = "select distinct unit, directorate from amcon_master_all order by unit";
             OracleCommand cmd = new OracleCommand(sql);
             cmd.Connection = con;
             OracleDataReader  reader   = cmd.ExecuteReader();
             List <Department> DeptList = new List <Department>();
             if (reader.HasRows)
             {
                 while (reader.Read())
                 {
                     Department dp = new Department();
                     dp.Name        = reader["unit"].ToString();
                     dp.Directorate = reader["directorate"].ToString();
                     DepartmentBLL.AddDepartment(dp);
                     rst = true;
                     //DeptList.Add(dp);
                 }
             }
             return(rst);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }