Project_Marmelade.WorkPlanFilterData.GetTypeOfEmployee C# (CSharp) Method

GetTypeOfEmployee() public method

public GetTypeOfEmployee ( ) : List
return List
        public List<string> GetTypeOfEmployee()
        {
            List<string> workEmployeeType = new List<string>();
            try
            {
                conn.Open();
                SqlCommand sqlcmd = new SqlCommand("getEmployeeTitle", conn);
                sqlcmd.CommandType = CommandType.StoredProcedure;

                DataTable table = new DataTable();
                SqlDataAdapter adapter = new SqlDataAdapter(sqlcmd);
                adapter.Fill(table);
                SqlDataReader reader = sqlcmd.ExecuteReader();
                reader.Read();
                foreach (DataRow row in table.Rows)
                {
                    string aEmployeeType = row["idEmployeeTitle"].ToString() + "," + row["TitleName"].ToString();
                    workEmployeeType.Add(aEmployeeType);
                }
                conn.Close();
                return workEmployeeType;
            }
            catch (Exception e)
            {
                return workEmployeeType;
                throw e;
            }
        }

Usage Example

 public List<string> GetTypeOfEmployee()
 {
     WorkPlanFilterData newData = new WorkPlanFilterData();
     return newData.GetTypeOfEmployee();
 }