protected void radSendTestMessage_Click(object sender, EventArgs e) { int currentUserID = Convert.ToInt32(Context.Items["UserID"]); qPtl_User user = new qPtl_User(Convert.ToInt32(Request.QueryString["userID"])); qPtl_UserProfile profile = new qPtl_UserProfile(Convert.ToInt32(Request.QueryString["userID"])); string userMobile = string.Empty; string smsMessage = string.Empty; string smsMessageURI = string.Empty; userMobile = txtMobileNumber.Text; // create object string smsMode = System.Configuration.ConfigurationManager.AppSettings["SMSMode"]; Guid authToken = new Guid(System.Configuration.ConfigurationManager.AppSettings["SMSLicenseKey"]); Quartz.Communication.qCom_SMSMessageLog sendLong = new Quartz.Communication.qCom_SMSMessageLog(); // send message + add log if (smsMode == "did") { // use custom number + key string did = System.Configuration.ConfigurationManager.AppSettings["SMSDid"]; Quartz.Communication.CDYNE.SMSResponse[] response = Quartz.Communication.qCom_SMSMessage.SendSMSAdvancedSendMessage(userMobile, smsMessage, authToken, did, 0, false); sendLong.Insert(1, DateTime.Now, user.UserID, 0, smsMessageURI, userMobile, did, smsMessage, "sent", Convert.ToString(response[0].MessageID), 0, 0, "", false, false, 0, false, false, 0, string.Empty); } lblMessage.Text += "Finished sending text message to " + userMobile + "<br>"; lblMessage.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { qPtl_User user = new qPtl_User(user_id); lblUserID.Text = Convert.ToString(user_id); litEmail.Text = user.Email; litUsername.Text = user.UserName; litFullName.Text = user.FirstName + " " + user.LastName; var u_campaign = qSoc_UserCampaign_View.GetUserCampaign(user_id, campaign_id); string enrolled_date = string.Empty; if (!String.IsNullOrEmpty(Convert.ToString(u_campaign.CampaignStart))) litEnrolled.Text = String.Format("{0:d}", u_campaign.CampaignStart); else litEnrolled.Text = ""; if (u_campaign.CampaignStatus == "Completed") litGroupRole.Text = "<span class=\"label label-lightred\">Finished</span>"; if (u_campaign.CampaignStatus == "Not Started") litGroupRole.Text = "<span class=\"label label-lightred\">Not Started</span>"; else litGroupRole.Text = "<span class=\"label label-satgreen\">In Progress</span>"; } }
protected static void AddRoleAction(int role_id, int scope_id, qPtl_User user) { var role_actions = qPtl_RoleAction.GetAvailableRoleActionsByRole(role_id, scope_id); DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now; foreach (var a in role_actions) { qPtl_UserAction action = new qPtl_UserAction(); qPtl_Action act = new qPtl_Action(a.ActionID); action.ScopeID = scope_id; action.Available = "Yes"; action.Created = DateTime.Now; action.CreatedBy = user.UserID; action.LastModified = DateTime.Now; action.LastModifiedBy = user.UserID; action.MarkAsDelete = 0; action.UserID = user.UserID; action.ActionID = a.ActionID; startTime = startTime.AddDays(a.StartDaysFromNow); endTime = endTime.AddDays(a.EndDaysFromNow); action.AvailableFrom = startTime; action.AvailableTo = endTime; action.AfterNumLogins = a.AfterNumLogins; action.Priority = a.Priority; action.SkipAllowed = a.SkipAllowed; action.NumberSkipsAllowed = a.NumberSkipsAllowed; action.Required = a.Required; action.OptionalOptOut = a.OptionOptOut; action.RedirectSkipURL = a.RedirectSkipURL; action.RedirectURL = a.RedirectURL; action.ReferenceID = act.ReferenceID; action.Insert(); } }
public void Insert() { NotificationID = Convert.ToInt32(container.Insert()); //if email notification enabled, send an email string send_notification_email = System.Configuration.ConfigurationManager.AppSettings["Email_SendNotificationEmail"]; if (!String.IsNullOrEmpty(send_notification_email)) { if (send_notification_email == "true") { qPtl_Notification notification = new qPtl_Notification(NotificationID); qPtl_User owner = new qPtl_User(notification.OwnerID); qPtl_User actor = new qPtl_User(notification.ActorID); int notification_email_id = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Email_NotificationEmailID"]); if (!String.IsNullOrEmpty(Convert.ToString(notification_email_id))) { if (notification_email_id > 0) { try { qCom_EmailTool email = new qCom_EmailTool(notification_email_id); email.SendDatabaseMail(owner.Email, notification_email_id, owner.UserID, notification.Text, actor.UserName, "", "", "", false); } catch { // do nothing } } } } } }
protected void loadControls(int space_id, int reference_id) { string list_html = string.Empty; qSoc_Contest contest = new qSoc_Contest(reference_id); litSubtitle.Text = "Submissions for " + contest.Name; var list = qSoc_ContestEntry.GetContestEntriesByContest(reference_id); if (list != null) { foreach (var l in list) { qPtl_User user = new qPtl_User(l.UserID); string submission_html = "Submitted by " + user.UserName + " at: " + l.Created; if (l.ContentTypeID == (int)qSoc_ContentType.Types.Picture) { qSoc_Image image = new qSoc_Image(l.ReferenceID); submission_html += "<br><a href=\"/user_data/" + user.UserName + "/" + image.FileName +"\" target=\"_blank\"><img src=\"/user_data/" + user.UserName + "/" + image.FileName + ".ashx?maxwidth=400\"><br>Click to view full size in a new tab/window</a>"; } list_html += "<li>" + submission_html + "</li>"; } litSubmissionList.Text = list_html; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { TrainingID = Convert.ToInt32 (Request.QueryString ["TrainingID"]); qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); lblName.Text = user.FirstName + " " + user.LastName; string signature = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Learning_certSignature1"]) + "<br>" + Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Learning_certSignature2"]); lblSignature.Text = signature; imgCertBgImage.ImageUrl = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Resources_URL"]) + "/learning/certs/" + Context.Items["ScopeID"] + "/cert_bg.png"; qLrn_UserTraining_View u_training = new qLrn_UserTraining_View(user.UserID, TrainingID); if (u_training != null) { lblTrainingTitle.Text = u_training.Title; lblCompletionDate.Text = "Completed: " + String.Format("{0:M/d/yyyy}", u_training.Completed); if (u_training.EstMinutesToComplete > 0) { float num_hours = u_training.EstMinutesToComplete / 60; lblCompletionHours.Text = " for a total of " + num_hours + " contact hours"; } } else { lblTrainingTitle.Text = "Training title not available"; lblCompletionDate.Text = "Training completion date not available"; } } }
protected void btnResetPassword_Click(object sender, EventArgs e) { int user_id = Convert.ToInt32(Context.Items["UserID"]); if (txtPassword.Text == "") { lblMsgReset.Text = "<br><br>New password cannot be blank"; } else if (txtPassword.Text.Length < 6) { lblMsgReset.Text = "<br><br>New password cannot be less than 6 characters"; } else if (txtPassword.Text.Length > 15) { lblMsgReset.Text = "<br><br>New password cannot be longer than 15 characters"; } else if (txtPassword.Text == txtPasswordConfirm.Text) { lblMsgReset.Text = ""; qPtl_User user = new qPtl_User(user_id); user.PasswordResetCode = ""; string password_for_storing = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "sha1"); user.Password = password_for_storing; user.Update(); lblMsgReset.Text = "Your password has been successfully reset.<br><br>"; } else { lblMsgReset.Text = "<br><br>Passwords did not match"; } }
protected void AddUserCampaign(int campaign_id, int scope_id, qPtl_User user) { DateTime start_date = new DateTime(); start_date = DateTime.Now; qSoc_UserCampaign new_campaign = qSoc_UserCampaign.EnrollUserInCampaign(user.UserID, campaign_id, "controlled", start_date, Convert.ToInt32(Context.Items["ScopeID"]), "role", "Yes", "Yes", "Yes", "Yes"); }
protected string AddCampaignUserPreference(qSoc_Campaign campaign, qPtl_User user, int scope_id) { string return_did = string.Empty; int campaign_did = qCom_CampaignDID.GetNextAvailableCampaignPhoneNumber(campaign.CampaignID); if (campaign_did > 0) { qCom_CampaignDID did = new qCom_CampaignDID(campaign_did); if (did != null) { if (did.CampaignDID > 0) { qCom_UserCampaignPreference u_pref = new qCom_UserCampaignPreference(); u_pref.DID = did.DID; u_pref.UserID = user.UserID; u_pref.Available = "Yes"; u_pref.ScopeID = scope_id; u_pref.Created = DateTime.Now; u_pref.CreatedBy = user.UserID; u_pref.LastModified = DateTime.Now; u_pref.LastModifiedBy = user.UserID; u_pref.MarkAsDelete = 0; u_pref.CampaignID = campaign.CampaignID; u_pref.Insert(); return_did = did.DID; } } } return return_did; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int emailID = Convert.ToInt32(Request.QueryString["emailID"]); // create object qCom_EmailTool email = new qCom_EmailTool(emailID); qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); txtEmail.Text = user.Email; lblSubject.Text = email.emailSubject; // get headers and footers string query = "SELECT TOP(1) * FROM qCom_EmailPreferences WHERE Available = 'Yes'"; qDbs_SQLcode sql = new qDbs_SQLcode(); SqlDataReader eReader = sql.GetDataReader(query); eReader.Read(); string header = Convert.ToString(eReader["Header"]); string footer = Convert.ToString(eReader["Footer"]); string unsubscribe = Convert.ToString(eReader["Unsubscribe"]); eReader.Close(); // if email type is bulk, then add footer string completeMessage = header + email.emailDraft + footer; if (email.emailType == "bulk") { completeMessage += unsubscribe; } lblBody.Text = completeMessage; } }
protected void AddRoleAction(int role_id, int scope_id, qPtl_User user) { var role_actions = qPtl_RoleAction.GetAvailableRoleActionsByRole(role_id, scope_id); DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now; foreach (var a in role_actions) { qPtl_UserAction action = new qPtl_UserAction(); qPtl_Action act = new qPtl_Action(a.ActionID); action.ScopeID = scope_id; action.Available = "Yes"; action.Created = DateTime.Now; action.CreatedBy = user.UserID; action.LastModified = DateTime.Now; action.LastModifiedBy = user.UserID; action.MarkAsDelete = 0; action.UserID = user.UserID; action.ActionID = a.ActionID; startTime = startTime.AddDays(a.StartDaysFromNow); endTime = endTime.AddDays(a.EndDaysFromNow); action.AvailableFrom = startTime; action.AvailableTo = endTime; action.AfterNumLogins = a.AfterNumLogins; action.Priority = a.Priority; action.SkipAllowed = a.SkipAllowed; action.NumberSkipsAllowed = a.NumberSkipsAllowed; action.Required = a.Required; action.OptionalOptOut = a.OptionOptOut; action.RedirectSkipURL = a.RedirectSkipURL; action.RedirectURL = a.RedirectURL; action.ReferenceID = act.ReferenceID; action.Insert(); } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Convert.ToString(Context.Items["SessionID"]))) { qPtl_Sessions session = new qPtl_Sessions(Convert.ToInt32(Context.Items["SessionID"])); if (session.SessionID > 0) { session.StopTime = DateTime.Now; session.Update(); } qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); if (user.UserID > 0) { DateTime last_time = new DateTime(); last_time = Convert.ToDateTime(user.LastTimeSeen); if (!String.IsNullOrEmpty(Convert.ToString(user.LastTimeSeen))) user.LastTimeSeen = last_time.AddMinutes(-16); user.Update(); } } Session.Abandon(); FormsAuthentication.SignOut(); Response.Redirect("~/default.aspx", true); }
public void UpdateUserPassword(int user_id, string password) { string password_for_storing = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "sha1"); qPtl_User user = new qPtl_User(user_id); user.Password = password_for_storing; user.Update(); }
protected void Page_Load(object sender, EventArgs e) { int userID = Convert.ToInt32(Request.QueryString["userID"]); qPtl_User user = new qPtl_User(userID); string wwwURL = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["CmsBasePath"]); string key = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["automation_key"]); Response.Redirect(wwwURL + "public/upload-training-cert.aspx?userID=" + user.UserID + "&key=" + key + "&redirectURL=" + Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["public_url"]) + "qLrn/member-training-certs.aspx?userID=" + user.UserID); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["htmlSource"]) && !string.IsNullOrEmpty(Request.QueryString["pdfOutput"])) { string host_url = Request.QueryString["htmlSource"]; string file_out = string.Format("{0}{1}", Server.MapPath(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Site_PdfOutput"])), Request.QueryString["pdfOutput"]); var authentication_cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; var sb_parameters = new StringBuilder(); HtmlToPdfConverter converter = new HtmlToPdfConverter(); converter.ConvertFromUrl(host_url, file_out, new HtmlToPdfConverterOptions { Orientation = "portrait", CookieName = authentication_cookie.Name, CookieValue = authentication_cookie.Value }); // EMAIL PDF int email_id = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Members_InvitationEmailID"]); string email_address = Convert.ToString(Request.QueryString["emailAddress"]); Quartz.Communication.qCom_EmailTool email = new Quartz.Communication.qCom_EmailTool(email_id); qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); email.SendDatabaseMailWithAttachment(email_address, email_id, user.UserID, "", "", "", file_out); string message = "* Email Successfully Sent"; // DELETE FILE //File.Delete(file_out); // REDIRECT if (!String.IsNullOrEmpty(Request.QueryString["returnURL"])) { //Session.Abandon(); //FormsAuthentication.SignOut(); Response.Redirect(Request.QueryString["returnURL"]); } else Response.Redirect("~/qPtl/invitation-email.aspx?message=" + message + "&file=" + file_out); /* Response.ContentType = string.Format("application/{0}", Path.GetExtension(file_out).Trim('.')); Response.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\"", Path.GetFileName(file_out))); Response.TransmitFile(file_out); Response.Flush(); File.Delete(file_out); */ } }
protected void btnAddMember_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(rblNewMemberRole.SelectedValue) && !String.IsNullOrEmpty(txtMemberUserName.Text)) { // make sure user exists qPtl_User new_member = new qPtl_User(txtMemberUserName.Text); if (new_member.UserID > 0) { var existing_space_id = qSoc_UserSpace.GetMostRecentAddedUserSpace(new_member.UserID); if (existing_space_id == 0) { // member can now be added qSoc_UserSpace u_space = new qSoc_UserSpace(); u_space.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]); u_space.Available = "Yes"; u_space.Created = DateTime.Now; u_space.CreatedBy = Convert.ToInt32(Context.Items["UserID"]); u_space.LastModified = DateTime.Now; u_space.LastModifiedBy = Convert.ToInt32(Context.Items["UserID"]); u_space.MarkAsDelete = 0; u_space.UserID = new_member.UserID; u_space.SpaceID = Convert.ToInt32(Request.QueryString["spaceID"]); if (rblNewMemberRole.SelectedValue == "Advisor") { u_space.SpaceRole = "Moderator"; qPtl_SpaceAdmin admin = new qPtl_SpaceAdmin(); admin.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]); admin.Available = "Yes"; admin.Created = DateTime.Now; admin.CreatedBy = Convert.ToInt32(Context.Items["UserID"]); admin.LastModified = DateTime.Now; admin.LastModifiedBy = Convert.ToInt32(Context.Items["UserID"]); admin.MarkAsDelete = 0; admin.UserID = new_member.UserID; admin.SpaceID = Convert.ToInt32(Request.QueryString["spaceID"]); admin.Insert(); } u_space.Insert(); Response.Redirect("/manage/members/space-edit.aspx?spaceID=" + Request.QueryString["spaceID"]); } else { qSoc_Space e_space = new qSoc_Space(existing_space_id); lblMessageMember.Text = " <strong>***ERROR***</strong> This member is already a member of the group: <strong>" + e_space.SpaceShortName + "</strong>. The member must first be removed from this group."; } } else { lblMessageMember.Text = " <strong>***ERROR***</strong> This member does not exist; please enter another username"; } } else lblMessageMember.Text = " <strong>***ERROR***</strong> You need to enter a username and select a role"; }
public void PerformRedirect_BeginRequest(object sender, System.EventArgs args) { // see if current URL matches any redirects System.Web.HttpApplication application = (System.Web.HttpApplication)sender; string url = application.Request.Path; //get the url path -- want to grab the "/folder" from the URL and compare this to char last = url[url.Length - 1]; // make sure ends is "/" if (Convert.ToString(last) != "/") { url += "/"; } qPtl_Redirect redirect = new qPtl_Redirect(url); if (redirect.RedirectID > 0) { if (!String.IsNullOrEmpty(redirect.RedirectURL)) { // add log int curr_user_id = 0; string email = application.Context.Request.QueryString["email"]; string campaign = application.Context.Request.QueryString["campaign"]; int curr_campaign_id = 0; // try and find a user with this email address if (!String.IsNullOrEmpty(email)) { qPtl_User user = new qPtl_User(email); if (user.UserID > 0) { curr_user_id = user.UserID; } } qPtl_LogAction logAction = new qPtl_LogAction("View"); qPtl_Log log = new qPtl_Log(); log.ActorID = curr_user_id; log.Created = DateTime.Now; log.CreatedBy = curr_user_id; log.LastModified = DateTime.Now; log.LastModifiedBy = curr_user_id; log.ScopeID = 1; log.LogActionID = logAction.LogActionID; log.CampaignID = curr_campaign_id; log.ReferenceID = redirect.RedirectID; log.ReferenceData = "Email=" + email + ", Entry URL=" + redirect.EntryURL + ", RedirectURL=" + redirect.RedirectURL + ", CampaignID=" + campaign; log.IPAddress = LogUtilities.GetIPAddress(); log.Insert(); // redirect to URL (sender as HttpApplication).Response.Redirect(redirect.RedirectURL, true); } } }
protected void Page_Load(object sender, EventArgs e) { int curr_user_id = Convert.ToInt32(Context.Items["UserID"]); qPtl_User user = new qPtl_User(curr_user_id); if (!Page.IsPostBack) { } }
public static DataTable GetUsersByFilters(int num_returned, int requester_user_id, string order_by) { // see if solution has a limit by type of user int limit_by_space_id = 0; qPtl_User user = new qPtl_User(requester_user_id); string sql = string.Empty; if (limit_by_space_id > 0) { if (num_returned > 0) { sql = "SELECT TOP(" + num_returned + ")* FROM qSoc_UserSpaces_View WHERE Available = 'Yes' AND MarkAsDelete = 0 AND AccountStatus = 'Active' AND SpaceID = " + limit_by_space_id; } else { sql = "SELECT * FROM qSoc_UserSpaces_View WHERE Available = 'Yes' AND MarkAsDelete = 0 AND AccountStatus = 'Active' AND SpaceID = " + limit_by_space_id; } } else { if (num_returned > 0) { sql = "SELECT TOP(" + num_returned + ")* FROM qPtl_Users_View WHERE Available = 'Yes' AND MarkAsDelete = 0 AND AccountStatus = 'Active'"; } else { sql = "SELECT * FROM qPtl_Users_View WHERE Available = 'Yes' AND MarkAsDelete = 0 AND AccountStatus = 'Active'"; } } if (!String.IsNullOrEmpty(order_by)) { switch (order_by) { case "alpha": sql += " ORDER BY Username ASC"; break; case "newest-to-oldest": sql += " ORDER BY Created DESC"; break; case "oldest-to-newest": sql += " ORDER BY Created ASC"; break; default: sql += " ORDER BY Username ASC"; break; } } return(SqlQuery.execute_sql(sql)); }
protected void btnChangeGroup_Click(object sender, EventArgs e) { // delete existing group if (!String.IsNullOrEmpty(ddlSpaces.SelectedValue)) { int curr_user_id = Convert.ToInt32(Context.Items["UserID"]); int profile_id = Convert.ToInt32(Request.QueryString["userID"]); var user_space = qSoc_UserSpace_View.GetMostRecentUserspace(profile_id); if (user_space != null) { //DeleteSpaceItems(user_space); // no longer do this so we can support multiple groups } // create new group based on selected items qSoc_Space space = new qSoc_Space(Convert.ToInt32(ddlSpaces.SelectedValue)); qPtl_User user = new qPtl_User(profile_id); qSoc_UserSpace u_space = new qSoc_UserSpace(); u_space.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]); u_space.Available = "Yes"; u_space.Created = DateTime.Now; u_space.CreatedBy = curr_user_id; u_space.LastModified = DateTime.Now; u_space.LastModifiedBy = curr_user_id; u_space.MarkAsDelete = 0; u_space.UserID = profile_id; u_space.SpaceID = space.SpaceID; if (user.HighestRole == "Advisor") u_space.SpaceRole = "Moderator"; u_space.Insert(); // create new school if (space.SchoolID > 0) { qOrg_UserSchool u_school = new qOrg_UserSchool(); u_school.Available = "Yes"; u_school.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]); u_school.MarkAsDelete = 0; u_school.Created = DateTime.Now; u_school.CreatedBy = curr_user_id; u_school.LastModified = DateTime.Now; u_school.LastModifiedBy = curr_user_id; u_school.MarkAsDelete = 0; u_school.UserID = profile_id; u_school.SchoolID = space.SchoolID; u_school.Insert(); } Response.Redirect("/manage/members/member-profile.aspx?userID=" + profile_id + "&currTab=group&message=successfully updated user group"); } else lblGroupMessage.Text = "*** You must first select a group ***"; }
public static qPtl_User GetUserByEmail(String email) { var user = new qPtl_User(); user.container.Select(user.container.GetSelectColumns(), "", "Email = @Email AND MarkAsDelete = 0", new SqlQueryParameter[] { new SqlQueryParameter("@Email", email) }); return(user.UserID > 0 ? user : null); }
protected void btnUpdateAccountStatus_Click(object sender, EventArgs e) { // update user record qPtl_User user = new qPtl_User(Convert.ToInt32(Request.QueryString["userID"])); user.AccountStatus = ddlAccountStatus.SelectedValue; user.Update(); string message = "Member account status updated"; Response.Redirect("member-admin-tools.aspx?currTab=3&message=" + message + "&userID=" + user.UserID); }
protected void btnDeleteAccount_Click(object sender, EventArgs e) { // delete user qPtl_User user = new qPtl_User(Convert.ToInt32(Request.QueryString["userID"])); user.AccountStatus = "Deleted"; user.Available = "No"; user.MarkAsDelete = 1; user.Update(); Response.Redirect("member-list.aspx"); }
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); string curr_tab = string.Empty; curr_tab = Request.QueryString["currTab"]; lit1Class.Text = ""; lit2Class.Text = ""; lit3Class.Text = ""; lit4Class.Text = ""; litTab1Class.Text = "class=\"tab-pane\""; litTab2Class.Text = "class=\"tab-pane\""; litTab3Class.Text = "class=\"tab-pane\""; litTab4Class.Text = "class=\"tab-pane\""; if (curr_tab == "1") { 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 == "2") { 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 == "3") { 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 == "4") { lit4Class.Text = "class='active'"; litTab4Class.Text = "class=\"tab-pane active\""; if (!String.IsNullOrEmpty(Request.QueryString["message"])) lblTab4Message.Text = " *** " + Request.QueryString["message"] + "***"; } else { lit1Class.Text = "class='active'"; litTab1Class.Text = "class=\"tab-pane active\""; } } }
protected void Page_Load(object sender, EventArgs e) { int curr_user_id = Convert.ToInt32(Context.Items["UserID"]); qPtl_User user = new qPtl_User(curr_user_id); siteQuestionCategories.SelectCommand = "SELECT * FROM qLrn_QuestionCategories WHERE MarkAsDelete = 0 ORDER BY Name ASC"; if (!Page.IsPostBack) { } }
protected void Page_Load(object sender, EventArgs e) { int curr_user_id = Convert.ToInt32(Context.Items["UserID"]); qPtl_User user = new qPtl_User(curr_user_id); siteForums.SelectCommand = "SELECT * FROM qCom_ForumTopics WHERE MarkAsDelete = 0 ORDER BY Created DESC, Name ASC"; if (!Page.IsPostBack) { } }
protected void Page_Load(object sender, EventArgs e) { int curr_user_id = Convert.ToInt32(Context.Items["UserID"]); qPtl_User user = new qPtl_User(curr_user_id); // could add "tyk" if site is using Test Your Knowledge assessments siteAssessments.SelectCommand = "SELECT * FROM qLrn_Assessments WHERE MarkAsDelete = 0 AND AssessmentType = 'general' ORDER BY Name ASC"; if (!Page.IsPostBack) { } }
public static qPtl_User UserLogon(String user_name, String password) { string hashed_password = string.Join("", SHA1CryptoServiceProvider.Create().ComputeHash(Encoding.UTF8.GetBytes(password)).Select(x => x.ToString("X2"))).ToLower(); var user = new qPtl_User(); user.container.Select(user.container.GetSelectColumns(), "", "Available = 'Yes' AND AccountStatus <> 'Deleted' AND MarkAsDelete = 0 AND UserName = @UserName AND Password = @Password", new SqlQueryParameter[] { new SqlQueryParameter("@UserName", user_name), new SqlQueryParameter("@Password", hashed_password) }); return(user.UserID > 0 ? user : null); }
protected void btnUpdatePassword_Click(object sender, EventArgs e) { if (Page.IsValid) { int inviteUserID = Convert.ToInt32(Request.QueryString["userID"]); qPtl_User user = new qPtl_User(); user.UpdateUserPassword(inviteUserID, txtPassword.Text); lblMessage.Text = " <i class=\"icon-check\"></i> Password successfully updated"; Response.Redirect("member-admin-tools.aspx?currTab=1&message=Password successfully updated&userID=" + inviteUserID); } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Request.QueryString["resetCode"])) { int user_id = 0; if (!String.IsNullOrEmpty(Request.QueryString["userID"])) { user_id = Convert.ToInt32(Request.QueryString["userID"]); qPtl_User user = new qPtl_User(user_id); lblResetInstructions.Text = "Welcome, " + user.UserName + ". Enter a password below<br><br />"; } } }
protected void btnResetPassword_Click(object sender, EventArgs e) { int user_id = 0; if (!String.IsNullOrEmpty(Request.QueryString["userID"])) { user_id = Convert.ToInt32(Request.QueryString["userID"]); if (txtPassword.Text == "") { lblMsgReset.Text = "<br><br>New password cannot be blank"; } else if (txtPassword.Text.Length < 6) { lblMsgReset.Text = "<br><br>New password cannot be less than 6 characters"; } else if (txtPassword.Text.Length > 15) { lblMsgReset.Text = "<br><br>New password cannot be longer than 15 characters"; } else if (txtPassword.Text == txtPasswordConfirm.Text) { lblMsgReset.Text = ""; qPtl_User user = new qPtl_User(user_id); if (user.PasswordResetCode == Request.QueryString["resetCode"]) { user.PasswordResetCode = ""; string password_for_storing = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "sha1"); user.Password = password_for_storing; user.Update(); txtPassword.Visible = false; txtPasswordConfirm.Visible = false; btnResetPassword.Visible = false; hplCancelReset.Visible = false; lblMsgReset.Text = "Your password has been successfully reset.<br><br> <a href=\"/logon.aspx\" class=\"btn\">Sign in now</a>"; } else lblMsgReset.Text = "<br><br>This password reset code is no longer valid. Please request another one or contact support"; } else { lblMsgReset.Text = "<br><br>Passwords did not match"; } } else { Response.Redirect("/default.aspx"); } }
protected void sendNow() { int emailID = Convert.ToInt32(Request.QueryString["emailID"]); // create object qCom_EmailTool email = new qCom_EmailTool(emailID); qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); email.SendDatabaseMail(txtEmail.Text, Convert.ToInt32(Request.QueryString["emailID"]), user.UserID, user.UserName, txtValue1.Text, txtValue2.Text, txtValue3.Text, txtValue4.Text, false); lblMessage.Text = "* Email Successfully Sent"; lblMessage.Visible = true; }
public static qPtl_User GetUserByPhone(string mobile_phone_number, int scopeID) { string sql = string.Format("SELECT * FROM qPtl_Users_View WHERE (Phone1 = '{0}' OR Phone2 = '{0}') AND ScopeID = {1}", mobile_phone_number, scopeID); DataTable dt = SqlQuery.execute_sql(sql); int curr_user_id = 0; if (dt.Rows.Count > 0) { curr_user_id = Convert.ToInt32(dt.Rows[0]["UserID"]); } qPtl_User user = new qPtl_User(curr_user_id); return(user); }
protected void Page_Load(object sender, EventArgs e) { qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); string roles = Convert.ToString(Context.Items["UserRoles"]); // currently support three types of users for main redirection (manage everything, manage insurance, manage space, manage campaign // once the user is at the current pages there will be additional filtering of features by -- if (user.HighestRole == "Site Admin" || user.HighestRole == "Site Host" || user.HighestRole == "Site Reports") Response.Redirect("/manage/site/default.aspx"); else if (user.HighestRole == "Insurer Admin" || user.HighestRole == "Insurer Reports") Response.Redirect("/manage/insurer/default.aspx"); else if (user.HighestRole == "Advisor" || user.HighestRole == "Space Admin" || user.HighestRole == "Space Reports" || roles.Contains("Space Admin") || roles.Contains("Space Reports")) Response.Redirect("/manage/spaces/default.aspx"); else if (user.HighestRole == "Campaign Admin" || user.HighestRole == "Campaign Reports") Response.Redirect("/manage/campaigns/default.aspx"); }
public static int UserLogoff(int user_id, int session_id) { qPtl_Sessions session = new qPtl_Sessions(session_id); session.StopTime = DateTime.Now; session.Update(); qPtl_User user = new qPtl_User(Convert.ToInt32(user_id)); DateTime last_time = new DateTime(); last_time = Convert.ToDateTime(user.LastTimeSeen); user.LastTimeSeen = last_time.AddMinutes(-16); user.Update(); return(user_id); }
public static qPtl_Sessions AddSession(qPtl_User user, int temp_session_id, string host_address, string browser, string platform) { qPtl_Sessions session = new qPtl_Sessions(); session.Created = DateTime.Now; session.StartTime = DateTime.Now; session.LastTimeSeen = DateTime.Now; session.TempSessionID = temp_session_id; session.ScopeID = user.ScopeID; session.UserID = user.UserID; session.IPAddress = host_address; session.BrowserType = browser; session.ComputerType = platform; session.Insert(); return(session); }
protected void Page_Load(object sender, EventArgs e) { int curr_user_id = Convert.ToInt32(Context.Items["UserID"]); qPtl_User user = new qPtl_User(curr_user_id); if (user.HighestRole == "Space Admin") { } siteMedicationGroups.SelectCommand = "SELECT * FROM qSoc_MedicationGroups WHERE MarkAsDelete = 0 ORDER BY MedicationGroupName ASC"; if (!Page.IsPostBack) { } }
protected void btnApproveRequest_Click(object sender, EventArgs e) { qOrg_GroupRequests request = new qOrg_GroupRequests(Convert.ToInt32(Request.QueryString["groupRequestID"])); qPtl_User user = new qPtl_User(Convert.ToInt32(Context.Items["UserID"])); request.ApprovedBy = user.UserName; request.WhenApproved = DateTime.Now; request.Status = "Pending-WaitingPrincipalApproval"; request.Update(); // send email to principal int principal_email_id = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["GroupRequest_principal_EmailID"]); qCom_EmailTool email = new qCom_EmailTool(principal_email_id); string principal_name = request.PrincipalRole + " " + request.PrincipalLastName; email.SendDatabaseMail(request.PrincipalEmail, principal_email_id, 0, request.GroupShortName, request.GroupShortName, request.WhyJoin, Convert.ToString(request.GroupRequestID), principal_name, false); Response.Redirect(Request.Url.ToString()); }
protected void btnSave_Click(object sender, EventArgs e) { int n = 0; string selectedItems = string.Empty; string strMessage = string.Empty; int userID = Convert.ToInt32(Request.QueryString["userID"]); qPtl_User user = new qPtl_User(userID); int daysBetweenTrainings = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["learning_daysbetweentrainings"]); int daysTillUnavailable = 0; DateTime seedDate = DateTime.Now; string action = ddlAction.SelectedValue; string trainingMode = "controlled"; string surveyRequired = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Learning_SurveyRequired"]); if (action == "reset") { daysTillUnavailable = Convert.ToInt32(txtDaysAvailable.Text); seedDate = Convert.ToDateTime(dpkStartDate.SelectedDate); trainingMode = Convert.ToString(ddlTrainingMode.SelectedValue); } foreach (ListItem item in cblUserTrainings.Items) { if (item.Selected) { if (action == "reset") strMessage += qLrn_UserTraining.manageUserTrainings(userID, daysBetweenTrainings, daysTillUnavailable, trainingMode, action, Convert.ToInt32(item.Value), seedDate, surveyRequired); else if (action == "delete") { qLrn_UserTraining.Delete(userID, Convert.ToInt32(item.Value)); strMessage += "*** Following Training was deleted: " + item.Text + "<br>"; } n++; } } lblMessage.Text = "*** RESULTS ***<br><br>" + strMessage; plhAction.Visible = false; plhTrainings.Visible = false; plhResetOptions.Visible = false; btnReload.Visible = true; btnSave.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { qPtl_User user = new qPtl_User(user_id); lblUserID.Text = Convert.ToString(user_id); litEmail.Text = user.Email; litUsername.Text = user.UserName; litFullName.Text = user.FirstName + " " + user.LastName; var u_space = qSoc_UserSpace.GetUserSpace(user_id, space_id); if (u_space != null) { litEnrolled.Text = u_space.Created.ToString("d"); if (u_space.SpaceRole == "Moderator") litGroupRole.Text = "<span class=\"label label-lightred\">Advisor</span>"; else litGroupRole.Text = "<span class=\"label label-satgreen\">Teen</span>"; } } }
public bool SetPasswordResetCode(int user_id) { bool ret = false; string password_reset_code = FormsAuthentication.HashPasswordForStoringInConfigFile(DateTime.Now.ToString("s"), "sha1"); qPtl_User user = new qPtl_User(user_id); user.PasswordResetCode = password_reset_code; user.Update(); if (user.UserID > 0) { ret = true; } else { ret = false; } return(ret); }
protected static bool CheckUserName(string username) { bool username_available = false; qPtl_User user = new qPtl_User(username); if (user != null) { if (user.UserID > 0) { username_available = false; } else { username_available = true; } } else { username_available = true; } return(username_available); }
public static qPtl_User RegisterNewUser(RegistrationData data) { int existing_user_id = 0; int new_space_id = 0; string sqlCode = string.Empty; // Redundancy check -- write Highest Level into qPtl_User table in case DB trigger not working qPtl_Role role = new qPtl_Role(data.default_role_id); // add user qPtl_User new_user = new qPtl_User(); new_user.Available = "Yes"; new_user.OrgUnitID = data.scope_id; new_user.ScopeID = data.scope_id; new_user.Created = DateTime.Now; new_user.CreatedBy = 0; new_user.LastModified = DateTime.Now; new_user.LastModifiedBy = 0; new_user.MarkAsDelete = 0; new_user.Status = ""; // used to include a default message for their status, now leave blank new_user.FirstName = data.firstname; new_user.LastName = data.lastname; new_user.Email = data.email; new_user.UserName = data.username; string password_for_storing = FormsAuthentication.HashPasswordForStoringInConfigFile(data.password, "sha1"); new_user.Password = password_for_storing; new_user.AccountStatus = "Active"; new_user.HighestRank = role.RoleRank; new_user.HighestRole = role.RoleName; new_user.Insert(); existing_user_id = new_user.UserID; DateTime DOB; try { DOB = Convert.ToDateTime(data.dob); } catch { // no valid date so use default value DOB = Convert.ToDateTime("1/1/1900"); } // add user profile qPtl_UserProfile new_profile = new qPtl_UserProfile(); new_profile.UserID = existing_user_id; new_profile.ScopeID = data.scope_id; new_profile.Available = "Yes"; new_profile.Created = DateTime.Now; new_profile.CreatedBy = existing_user_id; new_profile.LastModified = DateTime.Now; new_profile.LastModifiedBy = existing_user_id; new_profile.MarkAsDelete = 0; new_profile.Style = "default"; new_profile.Visibility = "all"; new_profile.Division = data.division; new_profile.Agency = data.agency; new_profile.Position = data.position; new_profile.Degrees = data.degrees; new_profile.Address1 = data.address; new_profile.Address2 = data.address2; new_profile.City = data.city; new_profile.StateProvince = data.state; new_profile.PostalCode = data.postal_code; new_profile.Country = data.country; new_profile.Gender = data.gender; new_profile.DOB = DOB; new_profile.Race = data.race; new_profile.EmploymentLocation = data.employment_location; new_profile.EmploymentSetting = data.employment_setting; new_profile.WorkSites = data.employment_sites; new_profile.Profession = data.profession; new_profile.Phone1 = data.work_phone; new_profile.Phone1Type = "work"; new_profile.Insert(); qPtl_User user = new qPtl_User(existing_user_id); // add user communication preference if (!String.IsNullOrEmpty(user.Email)) { qCom_UserPreference connect = new qCom_UserPreference(); connect.UserID = user.UserID; connect.Created = DateTime.Now; connect.CreatedBy = user.UserID; connect.LastModified = DateTime.Now; connect.LastModifiedBy = user.UserID; connect.Available = "Yes"; connect.ScopeID = 1; connect.MarkAsDelete = 0; connect.OkBulkEmail = "Yes"; connect.OkEmail = "Yes"; connect.OkSms = "Yes"; connect.LanguageID = 1; connect.Insert(); } // **************************************************** // STEP 5: Add User Role & Supporting Role Structures // Add role /* * qPtl_UserRole role = new qPtl_UserRole(); * role.UserID = user.UserID; * role.RoleID = role_id; * role.Insert(); */ qDbs_SQLcode sql = new qDbs_SQLcode(); sqlCode = "INSERT INTO qPtl_UserRoles ([UserID],[RoleID]) VALUES(" + user.UserID + "," + data.default_role_id + ")"; sql.ExecuteSQL(sqlCode); // Add possible role actions for the new user role AddRoleAction(data.default_role_id, data.scope_id, user); // add folder for user_data string rootLocation = HttpContext.Current.Server.MapPath("~/") + "user_data\\"; if (!Directory.Exists(rootLocation + user.UserName)) { Directory.CreateDirectory(rootLocation + user.UserName); } if (new_user.UserID > 0) { return(new_user); } else { return(null); } }
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 } } } }