protected void populateTrainings() { int userID = Convert.ToInt32(Request.QueryString["userID"]); string sqlCode = string.Empty; qDbs_SQLcode sql = new qDbs_SQLcode(); q_Helper helper = new q_Helper(); // get roles sqlCode = "SELECT TrainingID, Title FROM qLrn_UserTrainings_View WHERE Available = 'Yes' AND UserID = " + userID + " ORDER BY Title ASC"; DataTable dtRoles; using (dtRoles = sql.GetDataTable(sqlCode)) { cblUserTrainings.DataSource = dtRoles; cblUserTrainings.DataValueField = "TrainingID"; cblUserTrainings.DataTextField = "Title"; cblUserTrainings.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { profile_id = Convert.ToInt32(Request.QueryString["userID"]); qPtl_User profile = new qPtl_User(profile_id); hplManageTrainings.NavigateUrl = "member-learning.aspx?userID=" + profile_id; string nav_mode = System.Configuration.ConfigurationManager.AppSettings["Site_NavMode"]; if (nav_mode == "lms") plhSchoolDisplay.Visible = false; string img_url = string.Empty; string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/"; if (!String.IsNullOrEmpty(profile.ProfilePict)) img_url = baseUrl + "user_data/" + profile.UserName + "/" + profile.ProfilePict + ".ashx?width=84&height=84&mode=crop"; else img_url = baseUrl + "images/mylife_portrait_default.jpg.ashx?width=84&height=84&mode=crop"; litProfilePict.Text = "<img src=\"" + img_url + "\" />"; lblUsername.Text = profile.UserName; lblFullName.Text = profile.FirstName + " " + profile.LastName; lblEmail.Text = profile.Email; lblUserID.Text = Convert.ToString(profile.UserID); lblCreated.Text = Convert.ToString(profile.Created); lblMostRecentLogin.Text = Convert.ToString(profile.LastTimeSeen); lblMostRecentIPAddress.Text = profile.LastIPAddress; lblRoleName.Text = profile.HighestRole; txtFirstName.Text = profile.FirstName; txtLastName.Text = profile.LastName; txtEmail.Text = profile.Email; lblUsernameProfile.Text = profile.UserName; if (profile.HighestRole == "Mobile") { lblMemberTypeProfile.Text = "Mobile Only"; } else { lblMemberTypeProfile.Text = "Social"; required_indicator = " *"; if (race_required == true) race_required_indicator = " *"; } qPtl_UserProfile full_profile = new qPtl_UserProfile(profile_id); DateTime check = new DateTime(); check = Convert.ToDateTime("1/1/1900"); if (full_profile.DOB != check) { try { rdtDOB.SelectedDate = Convert.ToDateTime(full_profile.DOB).Date; } catch { // do nothing } } var user_space = qSoc_UserSpace_View.GetMostRecentUserspace(profile_id); if (user_space != null) { if (user_space.UserSpaceID > 0) { lblSchool.Text = user_space.School; string full_info = string.Empty; full_info = user_space.SpaceShortName; if (!String.IsNullOrEmpty(user_space.CategoryName)) full_info += " [" + user_space.CategoryName + "]"; if (!String.IsNullOrEmpty(user_space.School)) full_info += " at " + user_space.School; lblGroupTabGroupName.Text = "<a href=\"/manage/members/space-edit.aspx?spaceID=" + user_space.SpaceID + "\">" + full_info + " <i class=\"icon-circle-arrow-right\"></i></a>"; string full_group_name = user_space.SpaceShortName; if (!String.IsNullOrEmpty(user_space.CategoryName)) full_group_name += " [" + user_space.CategoryName + "]"; lblGroupName.Text = "<a href=\"/manage/members/space-edit.aspx?spaceID=" + user_space.SpaceID + "\">" + full_group_name + " <i class=\"icon-circle-arrow-right\"></i></a>"; } else { btnChangeGroup.Text = "Add To Group"; } } // profile gender string gender_options = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Register_SupportedGenderValues"]); ddlGender.Items.FindByValue("Intersex").Enabled = false; ddlGender.Items.FindByValue("Transgender").Enabled = false; if (gender_options.Contains("Intersex")) ddlGender.Items.FindByValue("Intersex").Enabled = true; if (gender_options.Contains("Transgender")) ddlGender.Items.FindByValue("Transgender").Enabled = true; ddlGender.SelectedValue = full_profile.Gender; // evaluate race if (!String.IsNullOrEmpty(full_profile.Race)) { if (full_profile.Race.Contains("Asian/SouthAsian")) cblRace.Items.FindByValue("Asian/SouthAsian").Selected = true; if (full_profile.Race.Contains("Biracial")) cblRace.Items.FindByValue("Biracial").Selected = true; if (full_profile.Race.Contains("Black/African American")) cblRace.Items.FindByValue("Black/African American").Selected = true; if (full_profile.Race.Contains("Latino/a")) cblRace.Items.FindByValue("Latino/a").Selected = true; if (full_profile.Race.Contains("Middle Eastern")) cblRace.Items.FindByValue("Middle Eastern").Selected = true; if (full_profile.Race.Contains("Multiracial")) cblRace.Items.FindByValue("Multiracial").Selected = true; if (full_profile.Race.Contains("Pacific Islander")) cblRace.Items.FindByValue("Pacific Islander").Selected = true; if (full_profile.Race.Contains("White/European-American")) cblRace.Items.FindByValue("White/European-American").Selected = true; } // **** PERMISSIONS **** string sqlCode = string.Empty; qDbs_SQLcode sql = new qDbs_SQLcode(); q_Helper helper = new q_Helper(); // get roles sqlCode = "SELECT RoleID, RoleName FROM qPtl_Roles WHERE Available = 'Yes' ORDER BY RoleRank"; DataTable dtRoles; using (dtRoles = sql.GetDataTable(sqlCode)) { cblRoles.DataSource = dtRoles; cblRoles.DataValueField = "RoleID"; cblRoles.DataTextField = "RoleName"; cblRoles.DataBind(); } // mark current permissions sqlCode = "SELECT RoleID FROM qPtl_UserRoles WHERE UserID = " + Request.QueryString["userID"]; SqlDataReader rReader; using (rReader = sql.GetDataReader(sqlCode)) { while (rReader.Read()) { ListItem currentCheckBox = cblRoles.Items.FindByValue(rReader["RoleID"].ToString()); if (currentCheckBox != null) { currentCheckBox.Selected = true; } } } // *** GROUP *** // load group information and all other available groups ddlSpaces.DataSource = qSoc_Space.GetSpaces(); ddlSpaces.DataTextField = "SpaceShortName"; ddlSpaces.DataValueField = "SpaceID"; ddlSpaces.DataBind(); ddlSpaces.Items.Insert(0, new ListItem("", "0")); /* // no longer used since we now want to automatically remove any existing user spaces from the list of options for adding if (user_space != null) { if (user_space.UserSpaceID > 0) { ddlSpaces.SelectedValue = Convert.ToString(user_space.SpaceID); } } */ // get other groups enrolled var u_groups = qSoc_UserSpace_View.GetAllAvailableUserSpacesOrderMostRecent(profile_id); if (u_groups != null) { int j = 0; string group_list = string.Empty; foreach (var g in u_groups) { Quartz.Controls.MemberEnrolledGroup curr_group = (Quartz.Controls.MemberEnrolledGroup)LoadControl("~/manage/members/controls/MemberEnrolledGroup.ascx"); curr_group.UserSpaceID = g.UserSpaceID; curr_group.UserID = g.UserID; curr_group.SpaceID = g.SpaceID; if (g.PrimarySpace == true) curr_group.IsPrimary = true; pnlUserGroups.Controls.Add(curr_group); // remove each of these spaces from the spaces pull down if (ddlSpaces.Items.Count > 0) { try { ddlSpaces.Items.FindByValue(Convert.ToString(g.SpaceID)).Enabled = false; } catch { // do nothing } } j++; } } // *** TAB MANAGEMENT *** string curr_tab = string.Empty; curr_tab = Request.QueryString["currTab"]; litOverviewClass.Text = ""; litProfileClass.Text = ""; litPermissionClass.Text = ""; litGroupClass.Text = ""; litWarningsClass.Text = ""; litTabOverviewClass.Text = "class=\"tab-pane\""; litTabProfileClass.Text = "class=\"tab-pane\""; litTabPermissionsClass.Text = "class=\"tab-pane\""; litTabWarningsClass.Text = "class=\"tab-pane\""; litTabGroupClass.Text = "class=\"tab-pane\""; if (curr_tab == "profile") { litProfileClass.Text = "class='active'"; litTabProfileClass.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblProfileMessage.Text = " *** " + Request.QueryString["message"] + "***"; } else if (curr_tab == "permissions") { litPermissionClass.Text = "class='active'"; litTabPermissionsClass.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblPermissionsMessage.Text = " *** " + Request.QueryString["message"] + "***"; } else if (curr_tab == "group") { litGroupClass.Text = "class='active'"; litTabGroupClass.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblGroupMessage.Text = " *** " + Request.QueryString["message"] + "***<br><br>"; } else if (curr_tab == "warnings") { litWarningsClass.Text = "class='active'"; litTabWarningsClass.Text = "class=\"tab-pane active\""; } else { litOverviewClass.Text = "class='active'"; litTabOverviewClass.Text = "class=\"tab-pane active\""; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { profile_id = Convert.ToInt32(Request.QueryString["userID"]); qPtl_User profile = new qPtl_User(profile_id); username = profile.UserName; string curr_tab = string.Empty; curr_tab = Request.QueryString["currTab"]; lit1Class.Text = ""; lit2Class.Text = ""; lit3Class.Text = ""; lit4Class.Text = ""; lit5Class.Text = ""; litTab1Class.Text = "class=\"tab-pane\""; litTab2Class.Text = "class=\"tab-pane\""; litTab3Class.Text = "class=\"tab-pane\""; litTab4Class.Text = "class=\"tab-pane\""; litTab5Class.Text = "class=\"tab-pane\""; if (curr_tab == "overview") { lit1Class.Text = "class='active'"; litTab1Class.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblTab1Message.Text = " *** " + Request.QueryString["message"] + "***"; } else if (curr_tab == "trainings") { lit2Class.Text = "class='active'"; litTab2Class.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblTab2Message.Text = " *** " + Request.QueryString["message"] + "***"; } else if (curr_tab == "assessments") { lit3Class.Text = "class='active'"; litTab3Class.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblTab3Message.Text = " *** " + Request.QueryString["message"] + "***"; } else if (curr_tab == "certificates") { lit4Class.Text = "class='active'"; litTab4Class.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblTab4Message.Text = " *** " + Request.QueryString["message"] + "***"; } else if (curr_tab == "tools") { lit5Class.Text = "class='active'"; litTab5Class.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblTab5Message.Text = " *** " + Request.QueryString["message"] + "***"; } else { lit1Class.Text = "class='active'"; litTab1Class.Text = "class=\"tab-pane active\""; } // tab 2 - assigned trainings var u_trainings = qLrn_UserTraining_View.GetUserTrainings(profile_id); string u_training_html = string.Empty; if (u_trainings != null) { foreach (var t in u_trainings) { u_training_html += "<strong>" + t.Title + "</strong><br>Status: " + t.Status + "<br><br>"; } litUserTrainingList.Text = u_training_html; } else litUserTrainingList.Text = "No trainings assigned"; // tab 3 - assessments userAssessments.SelectCommand = "SELECT * FROM qLrn_UserAssessments_View WHERE UserID = " + profile_id + " AND Available = 'Yes' AND MarkAsDelete = 0 AND Created > '" + System.Configuration.ConfigurationManager.AppSettings["Solution_StartDate"] + "' ORDER BY Created DESC"; startDate = null; endDate = null; // tab 4 - certificates var certificates = qLrn_UserTrainingCertificates.GetUserTrainingCertificates(profile_id); if (certificates != null) { string cert_html = string.Empty; foreach (var c in certificates) { if (c.UserTrainingCertificateID > 0) { qLrn_UserTraining_View training = new qLrn_UserTraining_View(c.UserTrainingID); cert_html += "<li><i class=\"icon-download-alt\"></i> <a href=\"/user_data/" + profile.UserName + "/" + c.FileName + "\"><strong>" + training.Title + "</strong></a> uploaded at: " + c.Created + "</li>"; } } if (!String.IsNullOrEmpty(cert_html)) litCertificates.Text = cert_html; else litCertificates.Text = "No Certificates."; } else { litCertificates.Text = "No Certificates."; } // tab 5 - tools // TOOL: Add Trainings string sqlCode = string.Empty; qDbs_SQLcode sql = new qDbs_SQLcode(); q_Helper helper = new q_Helper(); // get roles sqlCode = "SELECT TrainingID, Title FROM qLrn_Trainings WHERE Available = 'Yes' ORDER BY TrainingID"; DataTable dtTrainings; using (dtTrainings = sql.GetDataTable(sqlCode)) { cblTrainings.DataSource = dtTrainings; cblTrainings.DataValueField = "TrainingID"; cblTrainings.DataTextField = "Title"; cblTrainings.DataBind(); } // mark current trainings sqlCode = "SELECT TrainingID FROM qLrn_UserTrainings WHERE UserID = " + Request.QueryString["userID"]; SqlDataReader rReader; int i = 0; using (rReader = sql.GetDataReader(sqlCode)) { while (rReader.Read()) { ListItem currentCheckBox = cblTrainings.Items.FindByValue(rReader["TrainingID"].ToString()); if (currentCheckBox != null) { currentCheckBox.Selected = true; } i++; } } litNumTrainings.Text = "Member is enrolled in <strong>" + i + " trainings</strong>"; // TOOL: Reset/Delete Trainings plhTrainings.Visible = false; plhResetOptions.Visible = false; btnProcessTrainings.Visible = false; dpkStartDate.SelectedDate = DateTime.Now.AddDays(-1); txtDaysAvailable.Text = "4000"; var u_assessments = qLrn_UserAssessment.GetUserAssessments(profile_id, ""); int num_assessments = 0; if (u_assessments != null) num_assessments = u_assessments.Count; litNumAssessments.Text = "Member has taken <strong>" + num_assessments + " assessments</strong>"; } }
protected void SendTaskEmail(int task_type_id, int created_by, int reference_id, string description) { string request_task_emails = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["TaskEmailList"]); qCom_EmailPreference preferences = new qCom_EmailPreference(); string system_from = preferences.FromName; string system_email_address = preferences.FromEmailAddress; int curr_email_id = 0; qPtl_User curr_user = new qPtl_User(created_by); if (!String.IsNullOrEmpty(request_task_emails)) { switch (task_type_id) { case 1: // review blog curr_email_id = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["report_blog_EmailID"])); break; case 2: // approve image curr_email_id = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["report_newpic_EmailID"])); break; case 3: // approve video curr_email_id = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["report_video_EmailID"])); break; case 4: // review site report curr_email_id = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["report_issue_EmailID"])); break; case 5: // review reported message curr_email_id = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["report_message_EmailID"])); break; case 6: // review banned word curr_email_id = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["report_banned_word_EmailID"])); break; } qCom_EmailItem email = new qCom_EmailItem(curr_email_id); ArrayList addresses = new ArrayList(); q_Helper helper = new q_Helper(); addresses = helper.optionsToArrayList(request_task_emails); qCom_EmailTool email_send = new qCom_EmailTool(); int sent_email_log_id = 0; foreach (string address in addresses) { try { sent_email_log_id = email_send.SendDatabaseMail(address, curr_email_id, created_by, curr_user.UserName, Convert.ToString(reference_id), description, "", "", false); } catch { // email failure } } } }