예제 #1
0
        private string BuildStaffingTable(string key)
        {
            StringBuilder  builder = new StringBuilder();
            ContentUtility utility = new ContentUtility();

            STAFF_TYPE sType;

            switch (key)
            {
            case "Volunteer":
                sType = STAFF_TYPE.Volunteer;
                break;

            case "PartTime":
                sType = STAFF_TYPE.PartTimeStaff;
                break;

            case "Fulltime":
                sType = STAFF_TYPE.FullTimeStaff;
                break;

            default:
                sType = STAFF_TYPE.All;
                break;
            }

            var staff = utility.GetStaff(sType);

            builder.Append("<table class=\"table-striped\" id=\"staffTable\">");
            builder.Append("<tr><th style=\"width: 15%\">Staff Name</th><th style=\"width: 15%\">Type</th>" +
                           "<th style=\"width: 15%\">Role</th><th style=\"width: 25%\">Bio</th><th>Picture</th></tr>");

            foreach (StaffEntity member in staff)
            {
                string typeDesc = string.Empty;
                switch (member.Category)
                {
                case STAFF_TYPE.FullTimeStaff:
                    typeDesc = "Full-time Staff";
                    break;

                case STAFF_TYPE.PartTimeStaff:
                    typeDesc = "Part-time Staff";
                    break;

                case STAFF_TYPE.Volunteer:
                    typeDesc = "Volunteer";
                    break;

                default:
                    break;
                }


                string fullName = member.FirstName + " " + member.LastName;
                builder.Append("<tr><td>" + fullName + "</td><td>" + typeDesc + "</td><td>" + member.Role + "</td><td>" +
                               member.Bio + "</td><td><img class=\"profile\" src=\"" + member.ImgUrl + "\", alt=\"" + fullName + "\"</td>");
            }

            builder.Append("</table>");

            return(builder.ToString());
        }