IList <ManagerUserPicture> IManagerUserPictureManager.GetManagerUserPictureList(
            IManagerUserPictureStorage pStorage,
            QueryManagerUserPicture pQueryManagerUserPicture)
        {
            IList <ManagerUserPicture> response = null;

            try
            {
                #region Verify argument

                Verify.ArgumentNotNull(pStorage, "pStorage");
                Verify.ArgumentNotNull(pQueryManagerUserPicture, "pQueryManagerUserPicture");

                #endregion

                response =
                    pStorage.ListManagerUserPicture(pQueryManagerUserPicture);
            }
            catch (Exception ex)
            {
                ExceptionHandler.DealWithException(ex);
            }

            return(response);
        }
        IList <ManagerUserPicture> IManagerUserPictureStorage.ListManagerUserPicture(
            QueryManagerUserPicture pQueryManagerUserPicture)
        {
            List <ManagerUserPicture> managerUserPictureList = null;
            SqlConnection             conn;
            IDataReader reader;

            try
            {
                Verify.ArgumentNotNull(pQueryManagerUserPicture, "pQueryManagerUserPicture");

                conn = new SqlConnection(
                    ConfigurationManager
                    .ConnectionStrings["DEFAULT"].ToString());

                conn.Open();

                reader = ManagerUserPictureSelectWrapper.ExecuteReader(
                    conn,
                    pQueryManagerUserPicture);

                if (reader != null)
                {
                    managerUserPictureList = new List <ManagerUserPicture>();

                    while (reader.Read())
                    {
                        ManagerUserPicture myManagerUserPicture = DAUtil.ReadManagerUserPicture(
                            reader);

                        managerUserPictureList.Add(myManagerUserPicture);
                    }
                }

                conn.Close();
            }
            catch (Exception ex)
            {
                switch (ex.GetType().FullName)
                {
                case "System.ArgumentNullException":
                {
                    throw new ArgumentNullException(ex.Message);
                }

                case "System.ArgumentException":
                {
                    throw new ArgumentException(ex.Message);
                }

                default:
                    throw new Exception(ex.Message);
                }
            }

            return(managerUserPictureList);
        }
        public static SqlDataReader ExecuteReader(
            SqlConnection connection,
            QueryManagerUserPicture pQueryManagerUserPicture)
        {
            SqlDataReader reader;
            SqlCommand    cmd = null;
            SqlParameter  p;

            try
            {
                cmd = new SqlCommand();

                cmd.CommandText = "spManagerUserPictureSelect";

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = connection;

                //*******     UserPicID     *******
                object val;
                if (pQueryManagerUserPicture.UserPicID == null)
                {
                    val = DBNull.Value;
                }
                else
                {
                    val = pQueryManagerUserPicture.UserPicID;
                }

                p           = new SqlParameter("@pUserPicID", SqlDbType.Int);
                p.Direction = ParameterDirection.Input;
                p.Value     = val;
                cmd.Parameters.Add(p);

                //*******     UserID     *******
                if (pQueryManagerUserPicture.UserID == null)
                {
                    val = DBNull.Value;
                }
                else
                {
                    val = pQueryManagerUserPicture.UserID;
                }

                p           = new SqlParameter("@pUserID", SqlDbType.Int);
                p.Direction = ParameterDirection.Input;
                p.Value     = val;
                cmd.Parameters.Add(p);


                reader = cmd.ExecuteReader();
            }

            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(reader);
        }