public void GetTranslationFromSQL() { string[] keywords = langDic.Keys.ToArray(); string keywordString = null; foreach (string keyword in keywords) { keyword.Replace("|", "\\|"); if (keywordString == null) { keywordString = keyword; } else { keywordString = keywordString + "|" + keyword; } } SqlStoredProcedures sqlSP = new SqlStoredProcedures(); string contextString = sqlSP.LangGetTranslation(langID, "SL_MVC", keywordString); contextString = contextString.Replace("\\|", "\\"); //TODO: Add FULL support for \| escape string[] context = contextString.Split('|'); for (int i = 0; i < keywords.Length; i++) { langDic[keywords[i]] = context[i]; } taskAddKeyword.SetResult(true); }
public static int CreateUser(string username, string displayName, string password, string emailAddress, string langName, string ip, string reCapResponse) { ValidateUsername(username); ValidateDisplayName(displayName); ValidatePassword(password); ValidateEmail(emailAddress); ValidateLangName(langName); ValidateIP(ip); ValidateReCapResponse(reCapResponse, ip); string passwordSalt = Hash.GenerateSalt(64); string passwordHash = Hash.HashString(password, passwordSalt, new SHA3.SHA3Managed(512)); SqlStoredProcedures sqlSP = new SqlStoredProcedures(); try { int userID = sqlSP.UserCreateUser(username, displayName, passwordSalt, passwordHash, emailAddress, langName, ip); string verifyString = sqlSP.UserGetEmailVerifyString(emailAddress); Email.SendVerifyEmail(emailAddress, verifyString, langName); return userID; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return -1; } }
public string GetLangCode() { if (langCode == null) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); this.langCode = sqlSP.LangGetLangCode(this.langID); } return langCode; }
public void AddTicket() { TicketTitleCheck(); TicketCategoryIDCheck(); TicketRatingCheck(); TicketCommentCheck(); TicketNameCheck(); TicketPhoneNumberCheck(); TicketEmailCheck(); SqlStoredProcedures sp = new SqlStoredProcedures(); sp.SupportAddTicket(this.ticketTitle, this.ticketCategoryID, this.rating, this.comment, this.email, this.phoneNumber, this.name); }
public SLUser(int userID, string username, string password, string ip, string sessionToken) { if (username != null) { ValidateUsername(username); SqlStoredProcedures sqlSP = new SqlStoredProcedures(); this.userID = sqlSP.UserGetUserID(username); if (this.userID < 0) { return; } } else { ValidateUserID(userID); this.userID = userID; } this.sessionToken = Login(this.userID, password, ip, sessionToken); this.displayName = GetDisplayName(this.userID); }
public int GetLangID() { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); return sqlSP.UserGetMainLang(this.userID); }
public static Dictionary<int, string> GetAllTicketCategoryies() { SqlStoredProcedures sp = new SqlStoredProcedures(); return sp.SupportSelectTicketCategories(); }
public static string Login(int userID, string password, string ip, string sessionToken) { ValidateUserID(userID); SqlStoredProcedures sqlSP = new SqlStoredProcedures(); string outputSessionToken; if (sessionToken != null) { ValidateSessionToken(sessionToken); try { outputSessionToken = sqlSP.UserLogin(userID, null, ip, sessionToken); } catch { return null; } } else { ValidatePassword(password); string passwordSalt = sqlSP.UserGetPasswordSalt(userID); string passwordHash = Hash.HashString(password, passwordSalt, new SHA3.SHA3Managed(512)); try { outputSessionToken = sqlSP.UserLogin(userID, passwordHash, ip, null); } catch { return null; } } return outputSessionToken; }
public static bool VerifyEmail(string emailAddress, string verifyString) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); return sqlSP.UserVerifyEmail(emailAddress, verifyString); }
public ActionResult VerifyEmail() { string title = "VerifyEmail"; Load(title); if (ids != null) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); ViewBag.verified = sqlSP.UserVerifyEmail(ids["emailAddress"], ids["verifyString"]); return View(title); } return RedirectToAction("SignUp"); }
private void EmailSub() { bool sub = Convert.ToBoolean(postData["sub"]); SqlStoredProcedures sqlSP = new SqlStoredProcedures(); if (sub) { sqlSP.UserAddEmailSub(user.userID); } else { sqlSP.UserDelEmailSub(user.userID); } }
private ActionResult SendMassEmail() { if (postData.ContainsKey("subject") && postData.ContainsKey("body")) { try { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); string subject = postData["subject"]; string body = postData["body"]; string logo = "<img src=\"http://unsolvedcrime.ca/Resources/Shared/Images/Logo/Logo.png\" height=\"141\" width=\"141\">"; string title = "<font size=\"6\">Unsolved Crime</font>"; body = HttpUtility.HtmlDecode(body); body = "<tr><td>"+ title + "</td><td>" + logo + "</td></tr>" + body; body = "<div>" + body.Replace("\n", "</div><div>") + "</div>"; body = body.Replace("<div></div>", "<br />"); body = "<font size=\"3\">" + body + "</font>"; Dictionary<string, string> subs = sqlSP.SupportSelectSubscription(); foreach (KeyValuePair<string, string> sub in subs) { string unSub = "<div><a href=\"//unsolvedcrime.ca/Unsubscribe/emailAddress=" + sub.Key + "/\">Unsubscribe</a></div>"; Email.SendAdminEmail(sub.Key, subject, body + unSub); System.Diagnostics.Debug.WriteLine("Sent to:" + sub.Key); } return Content("true"); } catch(Exception e) { return Content("false"); } } else { return Content("false"); } }
public ActionResult SignUpCheck() { LoadIds(); string checkName = ids["checkName"]; switch (checkName) { case "emailExist": { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); return Content(Convert.ToString(sqlSP.UserEmailExist(ids["email"]))); } case "usernameExist": { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); return Content(Convert.ToString(sqlSP.UserUsernameExist(ids["username"]))); } default: { return Content("null"); } } }
public ActionResult Home() { string title = "Home"; Load(title); if (postData != null && postData.ContainsKey("emailAddress") && postData.ContainsKey("zip")) { try { string emailAddress = postData["emailAddress"]; string zip = postData["zip"]; zip = zip.Replace(" ", ""); if(emailAddress.Length < 3 || !emailAddress.Contains("@") || zip.Length != 6){ throw new ArgumentException(); } SqlStoredProcedures sqlSP = new SqlStoredProcedures(); sqlSP.SupportAddSubscription(emailAddress, zip); return Content("true"); } catch (Exception) { return Content("false"); } } else { return View(title); } }
public static string GetLangNameNative(string langName) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); return sqlSP.LangGetLangNameNative(langName); }
public static Dictionary<string, string> GetLangListNative() { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); return sqlSP.LangSelectLangListNative(); }
public Lang(string langName) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); this.langName = langName; this.langID = sqlSP.LangGetLangID(this.langName); }
private Dictionary<string, string> langDic = new Dictionary<string, string>(); //Best property name 2014 public Lang(int langID) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); this.langID = langID; this.langName = sqlSP.LangGetLangName(this.langID); }
public static string GetDisplayName(int userID) { SqlStoredProcedures sqlSP = new SqlStoredProcedures(); string displayName = sqlSP.UserGetDisplayName(userID); return displayName; }
public ActionResult Unsubscribe() { string title = "Unsubscribe"; Load(title); if (ids != null && ids.ContainsKey("emailAddress")) { string emailAddress = ids["emailAddress"]; SqlStoredProcedures sqlSP = new SqlStoredProcedures(); sqlSP.SupportDelSubscription(emailAddress); ViewBag.emailAddress = emailAddress; return View(title); } return RedirectToAction("Home"); }