Example #1
0
        }// End FetchCLSPackDetails(.)

        public static List <CLSEmployee> FetchCLSEmployees(SqlConnection myConnection)
        {
            List <CLSEmployee> employees = new List <CLSEmployee>();
            SqlConnection      conn      = myConnection;

            try
            {
                conn.Open();
                SqlCommand sqlCmd = new SqlCommand("proc_GetCLSEmployees", conn);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader reader = sqlCmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var employee = new CLSEmployee(reader.GetInt32(0))
                        {
                            roleID    = reader.GetInt32(1),
                            title     = reader.GetString(2),
                            firstName = reader.GetString(3),
                            lastName  = reader.GetString(4)
                        };
                        employees.Add(employee);
                    }
                }
                reader.Close();
            }
            catch (DataException ex)
            {
                Console.WriteLine(ex.Message);
                throw new ApplicationException(Messeges.GetMessage("DatabaseException"), ex);
            }
            catch (SqlException ex)
            {
                Console.WriteLine(ex.Message);
                throw new ApplicationException(Messeges.GetMessage("SqlException"), ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw new ApplicationException(Messeges.GetMessage("Exception"), ex);
            }
            finally
            {
                conn.Close();
            }
            return(employees);
        }//End FetchEmployees(.)
Example #2
0
 public static bool AssignRole(CLSEmployee employee, Role role)
 {
     //TODO
     return(false);
 }