public bool insertSale() { string eventIdStr = Request.Form["eventId"]; string ssi = Request.Form["ssi"]; string amount = Request.Form["amount"]; string ssiDec = UseKardoEncryption.getDecipherString(ssi); if (ssiDec == "KardoEncryptionError") { return(false); } int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); int eventId, ssId, amountInt; int kpId = (int)theUser["kardoPassoId"]; bool isNumeric = int.TryParse(eventIdStr, out eventId); bool isNumeric2 = int.TryParse(ssiDec, out ssId); bool isNumeric3 = int.TryParse(amount, out amountInt); if (isNumeric && isNumeric2 && isNumeric3) { return(EventDetailModel.insertSale(eventId, ssId, kpId, amountInt, userId)); } return(false); }
public static string getFilteredEvents(string city, string team, string startDate, string endDate) { if (team == "0") { team = "NULL"; } string queryStr = "EXEC procViewEvents " + team + ", "; queryStr += (startDate == "Click to Select") ? "NULL, " : "'" + startDate + "', "; queryStr += (endDate == "Click to Select") ? "NULL, " : "'" + endDate + "', "; queryStr += (city == "0") ? "NULL" : "'" + city + "'"; SqlCommand sc = new SqlCommand(queryStr, con); SqlDataReader sdr; con.Open(); sdr = sc.ExecuteReader(); Dictionary <string, List <Object> > dic = KardoGeneralModel.getDicFromSDR(sdr); con.Close(); if (dic.Count != 0) { for (int curIn = 0; curIn < dic["eventId"].Count; curIn++) { dic["eventId"][curIn] = UseKardoEncryption.getEncryptedString(dic["eventId"][curIn].ToString(), 100); } } return(KardoStaticMethods.getJSONFromDic(dic)); }
public bool updateProfile() { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); string name = Request.Form["name"]; string surname = Request.Form["surname"]; string mail = Request.Form["mail"]; string phone = Request.Form["phone"]; string countryCode = Request.Form["countryCode"]; return(UserProfileModel.updateProfile(userId, name, surname, mail, phone, countryCode)); }
public bool updatePassword() { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); string newPassword = Request.Form["newPassword"]; string passEncrypted = UseKardoEncryption.getEncryptedString(newPassword, 65); if (passEncrypted.Length > 255) { return(false); } return(UserProfileModel.updatePassword(userId, passEncrypted)); }
public bool insertMoney() { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); string moneyStr = Request.Form["money"]; int money; bool isNumeric = int.TryParse(moneyStr, out money); if (isNumeric) { return(UserProfileModel.insertMoney(userId, money)); } return(false); }
public bool deleteUser() { string dataidS = Request.Form["dataid"]; int dataid; bool isNumeric = int.TryParse(dataidS, out dataid); if (!isNumeric) { return(false); } int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); return(PagePanelModel.deleteUser(dataid, userId)); }
// // GET: /EditStadium/ public ActionResult Index(string stadiumId) { if (string.IsNullOrEmpty(stadiumId)) { return(Redirect("/")); } int stadiumIdInt; bool isNumeric = int.TryParse(stadiumId, out stadiumIdInt); if (!isNumeric) { return(Redirect("/")); } if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; if (!(bool)theUser["can_modify_stadium"]) { return(Redirect("/")); } } else { return(Redirect("/")); } Dictionary <string, Object> theStadium = EditStadiumModel.getStadium(stadiumIdInt); ViewBag.theStadium = theStadium; Dictionary <string, List <Object> > theSSections = EditStadiumModel.getSSections(stadiumIdInt); ViewBag.theSSections = theSSections; Dictionary <string, List <Object> > sportTypes = PagePanelModel.getSportTypes(); ViewBag.sportTypes = sportTypes; Dictionary <string, List <Object> > secCategories = EditStadiumModel.getSecCategories(); ViewBag.secCategories = secCategories; return(View()); }
// // GET: /UserProfile/ public ActionResult Index() { if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; ViewBag.userTickets = UserProfileModel.getUserTickets((int)theUser["userId"]); } else { return(Redirect("/")); } return(View()); }
// // GET: /PagePanel/ public ActionResult Index() { if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; if (!(bool)theUser["can_enter_pagePanel"]) { return(Redirect("/")); } if ((bool)theUser["can_modify_users"]) { Dictionary <string, List <Object> > users = PagePanelModel.getUsers(); ViewBag.users = users; } } else { return(Redirect("/")); } Dictionary <string, List <Object> > teams = PagePanelModel.getTeams(); ViewBag.teams = teams; Dictionary <string, List <Object> > stadiums = PagePanelModel.getStadiums(); ViewBag.stadiums = stadiums; Dictionary <string, List <Object> > sportTypes = PagePanelModel.getSportTypes(); ViewBag.sportTypes = sportTypes; Dictionary <string, List <Object> > events = PagePanelModel.getEvents(); ViewBag.events = events; Dictionary <string, List <Object> > roles = PagePanelModel.getRoles(); ViewBag.roles = roles; ViewBag.newUsers = PagePanelModel.countNewUsers(); ViewBag.newKps = PagePanelModel.countNewKps(); return(View()); }
// // GET: /EventDetailAdmin/ public ActionResult Index(string eventId) { if (string.IsNullOrEmpty(eventId)) { return(Redirect("/")); } int eventIdInt; bool isNumeric = int.TryParse(eventId, out eventIdInt); if (!isNumeric) { return(Redirect("/")); } if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; if (!(bool)theUser["can_examine_salesDetails"]) { return(Redirect("/")); } } else { return(Redirect("/")); } Dictionary <string, Object> theEvent = EventDetailModel.getEventInfo(eventIdInt); ViewBag.theEvent = theEvent; Dictionary <string, List <Object> > ticketInfos = EventDetailModel.getEventTicketInfo(eventIdInt); ViewBag.ticketInfos = ticketInfos; return(View()); }
public string getSectionInfo() { string eventIdStr = Request.Form["eventId"]; string ssi = Request.Form["ssi"]; string ssiDec = UseKardoEncryption.getDecipherString(ssi); if (ssiDec == "KardoEncryptionError") { return("{}"); } int eventId, ssId; bool isNumeric = int.TryParse(eventIdStr, out eventId); bool isNumeric2 = int.TryParse(ssiDec, out ssId); if (isNumeric && isNumeric2) { return(EventDetailModel.getSectionInfo(eventId, ssId)); } return("{}"); }
// // GET: /EventDetail/ public ActionResult Index(string eventId) { if (string.IsNullOrEmpty(eventId)) { return(Redirect("/")); } string eventIdStr = UseKardoEncryption.getDecipherString(eventId); if (eventIdStr == "KardoEncryptionError") { return(Redirect("/")); } int eventIdInt; bool isNumeric = int.TryParse(eventIdStr, out eventIdInt); if (!isNumeric) { return(Redirect("/")); } Dictionary <string, Object> theEvent = EventDetailModel.getEventInfo(eventIdInt); Dictionary <string, List <Object> > ticketInfos = EventDetailModel.getEventTicketInfo(eventIdInt); ViewBag.theEvent = theEvent; ViewBag.ticketInfos = ticketInfos; if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; ViewBag.userTickets = UserProfileModel.getUserTickets((int)theUser["userId"]); } return(View()); }
private string runGetOtherAccounts(string[] userIds) { string loginedAccount = ""; if (Session["KardoUserId"] != null) { loginedAccount = UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()); } for (int i = 0; i < userIds.Length; i++) { userIds[i] = UseKardoEncryption.getDecipherString(userIds[i]); if (loginedAccount != "" && loginedAccount == userIds[i]) { userIds[i] = "-1"; } } string str = ""; for (int i = 0; i < userIds.Length; i++) { if (str == "") { str += userIds[i]; } else { str += "," + userIds[i]; } } Dictionary <string, List <Object> > users = LoginModel.getUsersFromUserIds(str); string json = KardoStaticMethods.getJSONFromDic(users); return(json); }
// // GET: /Permissions/ public ActionResult Index() { if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; if (!(bool)theUser["can_edit_permissions"]) { return(Redirect("/")); } } else { return(Redirect("/")); } Dictionary <string, List <Object> > roles = PermissionsModel.getRoles(); ViewBag.roles = roles; return(View()); }
private string runCompleteRegistry(string userName, string eMail, string password, string rName, string sName, string day, string month, string year, string nowDate, string languagePreference) { string date = year + "-" + month + "-" + day; controlRegistryValues(userName, eMail, password, rName, sName, date, nowDate, languagePreference); if (userName == "invalid" || eMail == "invalid" || password == "invalid" || rName == "invalid" || sName == "invalid" || date == "invalid") { return("errorValues"); } bool result = LoginModel.insertUser( userName.ToLower(), eMail.ToLower(), UseKardoEncryption.getEncryptedString(password, 65), KardoStaticMethods.FirstCharToUpper(rName), KardoStaticMethods.FirstCharToUpper(sName), date, languagePreference ); if (!result) { return("False"); } int userId = (int)LoginModel.getUserFromUsernameOrMail(userName)["userId"][0]; string activationKey = UseKardoEncryption.getEncryptedString(userId, 50) + "-" + KardoStaticMethods.creatUniqString(36);//(min)50+1+36 char LoginModel.setAKeyForEMail(userId, activationKey); string verifyAccountLink = "/Login/verifyAccount?activationKey=" + activationKey; return("True"); }
public bool getKardoPasso() { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); return(UserProfileModel.getKardoPasso(userId)); }
// // GET: /Default/ public ActionResult Index() { if (Request.Cookies["KardoLanguagePreference"] == null || Request.Cookies["KardoLanguagePreference"].Value == "" || Request.Cookies["KardoLanguagePreference"].Value == "null") { Session.Add("KardoLanguagePreference", "tr-TR"); if (Request.Cookies["KardoLanguagePreference"] != null) { Response.Cookies["KardoLanguagePreference"].Value = "tr-TR"; Response.Cookies["KardoLanguagePreference"].Expires = DateTime.Now.AddYears(99); } } if ((Session["KardoUserId"] == null && Session["KardoUserName"] == null)) { if (Request.Cookies["KardoUserInfos"] != null) { if (Request.Cookies["KardoUserInfos"]["userId"] != null && Request.Cookies["KardoUserInfos"]["status"] != null) { string[] savedAccounts = Request.Cookies["KardoUserInfos"]["userId"].Split('_'); string[] status = Request.Cookies["KardoUserInfos"]["status"].Split('_'); //string[] priority = Request.Cookies["KardoUserInfos"]["priority"].Split('_'); if (savedAccounts.Length == status.Length) { string tempUserId = null; for (int i = 0; i < savedAccounts.Length; i++) { if (status[i] == "active") { tempUserId = savedAccounts[i]; break; } } if (tempUserId != null) { /*KardoModel kardoModel = new KardoModel("kardo"); * kardoModel.selectOnlyFirstData("users", "*"); * kardoModel.addInnerJoin("users", "profils", "userId");*/ string tempStr = UseKardoEncryption.getDecipherString(Request.Cookies["KardoUserInfos"]["userId"]); if (tempStr == "KardoEncryptionError") { Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1); Response.Redirect("/Default/Index"); } else { int userId = Convert.ToInt32(tempStr); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); string userName = (string)theUser["username"]; Session.Add("KardoUserId", Request.Cookies["KardoUserInfos"]["userId"]); Session.Add("KardoUserName", UseKardoEncryption.getEncryptedString(userName, 50)); Session.Add("KardoLanguagePreference", (string)theUser["languagePreference"]); ViewBag.userInfos = theUser; } } } else { Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1); } } else { Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1); } } /*else if (Request.Cookies["KardoVisitorInfos"] != null && (Session["KardoVisitorId"] == null && Session["KardoVisitorName"] == null)) * { * KardoModel kardoModel = new KardoModel("kardo"); * kardoModel.selectOnlyFirstData("visitors", "*"); * string tempStr = UseKardoEncryption.getDecipherString(Request.Cookies["KardoVisitorInfos"]["visitorId"]); * if (tempStr == "KardoEncryptionError") * { * Response.Cookies["KardoVisitorInfos"].Expires = DateTime.Now.AddDays(-1); * Response.Redirect("/Kardo/Index"); * } * else * { * kardoModel.addWhere("visitorId", Convert.ToInt32(tempStr)); * ArrayList results = kardoModel.selectResults(); * kardoModel.close(); * * string visitorName = KardoModel.getFirstValueFromColumnName(results, "visitorName"); * * Session.Add("KardoVisitorId", Request.Cookies["KardoVisitorInfos"]["visitorId"]); * Session.Add("KardoVisitorName", visitorName); * Session.Add("KardoLanguagePreference", Request.Cookies["KardoLanguagePreference"].Value); * } * }*/ else { // will be creat new visitor // first visit or cookieEnabled is false } } else if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null)) { int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString())); Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId); ViewBag.userInfos = theUser; } //**************************************************** Dictionary <string, List <Object> > events = DefaultModel.getEvents(); ViewBag.Events = events; Dictionary <string, List <Object> > eventsCities = DefaultModel.getEventsCities(); ViewBag.EventsCities = eventsCities; Dictionary <string, List <Object> > eventsTeams = DefaultModel.getEventsTeams(); ViewBag.EventsTeams = eventsTeams; return(View()); }
private ActionResult runVerifyAccount(string activationKey) { if (activationKey == null || activationKey == "") { return(View());//"wrongKey" } string[] splitedKey = activationKey.Split('-'); if (activationKey.Length < 86 || splitedKey.Length != 3 || splitedKey[0].Length < 50) { return(View());//"wrongKey" } else { string tempUserId = UseKardoEncryption.getDecipherString(splitedKey[0]); if (tempUserId == "KardoEncryptionError") { ViewBag.verifyResult = "KardoEncryptionError"; return(View()); } else { int tempUserIdInt; if (!int.TryParse("123", out tempUserIdInt)) { ViewBag.verifyResult = "errorUserId"; return(View()); } Dictionary <string, List <Object> > theUser = LoginModel.getUserFromUserId(tempUserIdInt); if (theUser.Count == 0) { ViewBag.verifyResult = "errorUserId"; return(View()); } if ((int)theUser["activated"][0] == 1) { ViewBag.verifyResult = "verifiedAccount"; return(View()); } if (activationKey == (String)theUser["activationKey"][0]) { //UPDATE mails activationKey -> null & add activationDate & mailStatus -> 0 bool result = LoginModel.verifyEMail((int)theUser["userId"][0]); if (result) { ViewBag.verifyResult = "verified"; return(View()); } else { ViewBag.verifyResult = "wrongKey"; return(View()); } } else { ViewBag.verifyResult = "wrongKey"; return(View()); } } } }
private string runControlLogin(string userLoginKey, string remember_me, string session_checkbox, string password) //, string ipAddress, string country, string city, string loc, string hostname, string nowDate { if (password.Length > 16 && !(password.Equals(userLoginKey + "_doNotControl"))) // add && password.Length < 6 { password = "******"; //spam girdi engelleme return("invalidPassword"); } //controlLoginDatas(ipAddress, country, city, loc, hostname, nowDate); Dictionary <string, List <Object> > theUser = LoginModel.getUserFromUsernameOrMail(userLoginKey); string receivedPassword = ""; if (password.Equals(userLoginKey + "_doNotControl")) // User has changed account. { if (theUser.Count == 0) { return("False"); } receivedPassword = "******"; } else { if (theUser.Count == 0) { return("False"); } receivedPassword = UseKardoEncryption.getDecipherString(theUser["password"][0].ToString()); } int userId = (int)theUser["userId"][0]; string cAut = controlAuthentications(userId); if (cAut == "banned30Min") { return("banned30Min"); } if (password.Equals(receivedPassword) || (password.Equals(userLoginKey + "_doNotControl"))) { setAuthentication(userId, UseKardoEncryption.getEncryptedString(password, 65), true); if (Session["KardoVisitorId"] != null && Session["KardoVisitorName"] != null) { Session["KardoVisitorId"] = null; Session["KardoVisitorName"] = null; } if (Session["KardoUserId"] != null && Session["KardoUserName"] != null && Session["KardoLanguage"] != null) { //There is a account that is logined Session["KardoUserId"] = null; Session["KardoUserName"] = null; Session["KardoLanguage"] = null; } Session.Add("KardoUserId", UseKardoEncryption.getEncryptedString(userId, 50));//*UUID Session.Add("KardoUserName", UseKardoEncryption.getEncryptedString(userLoginKey, 50)); Session.Add("KardoLanguage", theUser["languagePreference"][0].ToString()); if (Request.Cookies["KardoUserInfos"] != null) { //KardoUserInfos cookie bir veya daha fazla userId içerebilir. status açık bırakılmak istenen hesaba ulaşmamızı sağlar. //Ayrı userId'ler birbirinden '_' ile ayrılı string[] savedAccounts = Request.Cookies["KardoUserInfos"]["userId"].Split('_'); string[] status = Request.Cookies["KardoUserInfos"]["status"].Split('_'); string[] priorities = Request.Cookies["KardoUserInfos"]["priority"].Split('_'); int tempUserId = -1; for (int i = 0; i < savedAccounts.Length; i++) { //Giriş yapımaya çalışan hesaba daha önce giriş yapıldığını anlamak için kontrol yapılır. string receviedId = UseKardoEncryption.getDecipherString(savedAccounts[i]); if (receviedId == "KardoEncryptionError") { Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1); Response.Redirect("/Kardo/Index"); break; } if (receviedId != "") { if (Convert.ToInt32(receviedId) == userId)//*UUID { tempUserId = i; //status[i] = "active"; //priorities[i] = "1"; break; } } } if (tempUserId == -1) { //Daha önceden hesap mevcut fakat yeni bir hesap ekleniyor. if (remember_me == "checked") { string statusString = "", priorityString = ""; if (session_checkbox == "checked") { for (int i = 0; i < status.Length; i++) { statusString += (i == 0) ? "passive" : "_passive"; } } for (int i = 0; i < priorities.Length; i++) { priorityString += (i == 0) ? "0" : "_0"; } Response.Cookies["KardoUserInfos"]["userId"] = Request.Cookies["KardoUserInfos"]["userId"] + "_" + UseKardoEncryption.getEncryptedString(userId.ToString(), 50);//*UUID Response.Cookies["KardoUserInfos"]["status"] = (session_checkbox == "checked") ? statusString + "_active" : Request.Cookies["KardoUserInfos"]["status"] + "_passive"; Response.Cookies["KardoUserInfos"]["priority"] = priorityString + "_1"; Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddYears(99); Response.Cookies["KardoLanguagePreference"].Value = theUser["languagePreference"][0].ToString(); Response.Cookies["KardoLanguagePreference"].Expires = DateTime.Now.AddYears(99); } } else { //Daha önce giriş yapılmış hesaba tekrar geçiş yapılıyor. string userIdString = "", statusString = "", priorityString = ""; for (int i = 0; i < savedAccounts.Length; i++) { userIdString += (i == 0) ? savedAccounts[i] : "_" + savedAccounts[i]; statusString += (i == 0) ? ((i == tempUserId) ? ((session_checkbox == "checked") ? "active" : "passive") : "passive") : ((i == tempUserId) ? ((session_checkbox == "checked") ? "_active" : "_passive") : "_passive"); priorityString += (i == 0) ? ((i == tempUserId) ? "1" : "0") : ((i == tempUserId) ? "_1" : "_0"); } Response.Cookies["KardoUserInfos"]["userId"] = userIdString; Response.Cookies["KardoUserInfos"]["status"] = statusString; Response.Cookies["KardoUserInfos"]["priority"] = priorityString; Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddYears(99); Response.Cookies["KardoLanguagePreference"].Value = theUser["languagePreference"][0].ToString(); Response.Cookies["KardoLanguagePreference"].Expires = DateTime.Now.AddYears(99); } } else { //İlkkez giriş yapılıyor veya kullanıcı cookie oluşturulmasına izin vermiyor. if (remember_me == "checked") { Response.Cookies["KardoUserInfos"]["userId"] = UseKardoEncryption.getEncryptedString(userId.ToString(), 50);//*UUID Response.Cookies["KardoUserInfos"]["status"] = (session_checkbox == "checked") ? "active" : "passive"; Response.Cookies["KardoUserInfos"]["priority"] = "1"; Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddYears(99); Response.Cookies["KardoLanguagePreference"].Value = theUser["languagePreference"][0].ToString(); Response.Cookies["KardoLanguagePreference"].Expires = DateTime.Now.AddYears(99); } } return("True"); } else { setAuthentication(userId, UseKardoEncryption.getEncryptedString(password, 65), false); return(controlAuthentications(userId)); } }