예제 #1
0
        protected void btnReject_Click(object sender, EventArgs e)
        {
            if (CurrentNewUser != null)
            {
                CommunityProfileApproval cma = new CommunityProfileApproval(CurrentNewUser.Username, CurrentUserSession.Username);
                cma.Save();

                determineProfileState();
                loadNewUser(true);
            }
        }
        /// <summary>
        /// Fetches community profile approval by specified parameters.
        /// It returns an empty array if there are no community profile approval in DB by specified arguments.
        /// If these arguments are null it returns all community profile approval from DB.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="username">The username.</param>
        /// <param name="approvedBy">The approved by.</param>
        /// <param name="fromDate">From date.</param>
        /// <param name="toDate">To date.</param>
        /// <param name="sortColumn">The sort column.</param>
        /// <returns></returns>
        private static CommunityProfileApproval[] Fetch(int? id, string username, string approvedBy,
                                                        DateTime? fromDate, DateTime? toDate, eSortColumn sortColumn)
        {
            using (SqlConnection conn = Config.DB.Open())
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(conn, "FetchCommunityProfileApproval",
                                                               id, username, approvedBy, fromDate, toDate,
                                                               sortColumn);

                List<CommunityProfileApproval> lApprovals = new List<CommunityProfileApproval>();

                while (reader.Read())
                {
                    CommunityProfileApproval communityProfileApproval = new CommunityProfileApproval();

                    communityProfileApproval.id = (int)reader["ID"];
                    communityProfileApproval.username = (string)reader["Username"];
                    communityProfileApproval.approvedBy = (string)reader["ApprovedBy"];
                    communityProfileApproval.date = (DateTime)reader["Date"];
                    communityProfileApproval.approved = (bool)reader["Approved"];

                    lApprovals.Add(communityProfileApproval);
                }

                return lApprovals.ToArray();
            }
        }