public ActionResult AuthorizeCallback(string code, string userCode) { var redirectUri = "http://" + Request.Url.Authority + this.Url.Action("AuthorizeCallback", new { userCode = userCode }); var sharpSquare = new SharpSquare(clientID, clientSecret); var accessToken = sharpSquare.GetAccessToken(redirectUri, code); // need this in order to make calls to API // it's redundant because token is already set in GetAccessToken() call but it helps to understand the workflow better. UserLoginInfo u1 = new UserLoginInfo(); using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { var UserLogID = (from p in db.UserLoginInfo where p.USERNAME == User.Identity.Name select p.USERLOGINID).FirstOrDefault(); string token = accessToken; db.Token.Add(new Token() { TOKENACID = token, USERLOGINID = UserLogID }); db.SaveChanges(); } //CheckinOperations.insertUSerLoginInfo(u1); return(RedirectToAction("Index", "Home")); }
public static void HobiEkle(HobiView h, string userName) { try { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { var UserLogID = (from p in db.UserLoginInfo where p.USERNAME == userName select p.USERLOGINID).FirstOrDefault(); besPuanEkle(h.besPuan, UserLogID); dortPuanEkle(h.dortPuan, UserLogID); ucPuanEkle(h.ucPuan, UserLogID); ikiPuanEkle(h.ikiPuan, UserLogID); birPuanEkle(h.birPuan, UserLogID); sifirPuanEkle(h.sifirPuan, UserLogID); } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException raise = new InvalidOperationException(message, raise); } } throw raise; } }
public JsonResult IsUserMailExists(string eMail) { using (CheckinDatasetEntities4 DB = new CheckinDatasetEntities4()) { //check if any of the UserName matches the UserName specified in the Parameter using the ANY extension method. return(Json(!DB.UserLoginInfo.Any(x => x.EMAIL == eMail), JsonRequestBehavior.AllowGet)); } }
public override string[] GetRolesForUser(string username) { using (CheckinDatasetEntities4 DB = new CheckinDatasetEntities4()) { string s = DB.UserLoginInfo.Where(x => x.USERNAME == username).FirstOrDefault().ROLE.ToString(); string[] resultS = { s }; return(resultS); } }
public static void mekanEkle(TRIPADVISORPLACESVIEWMODEL tm) { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { TRIPADVISORPLACES yeni = new TRIPADVISORPLACES() { LOCATION = tm.LOCATION, PLACENAME = tm.PLACENAME, ID = tm.ID }; db.TRIPADVISORPLACES.Add(yeni); db.SaveChanges(); } }
public static TRIPADVISORPLACESVIEWMODEL mekanGetir(int id) { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { var mekanBilgi = (from p in db.TRIPADVISORPLACES where (p.ID == id) select p).SingleOrDefault(); TRIPADVISORPLACESVIEWMODEL dataModel = new TRIPADVISORPLACESVIEWMODEL() { LOCATION = mekanBilgi.LOCATION, PLACENAME = mekanBilgi.PLACENAME, ID = mekanBilgi.ID }; return(dataModel); } }
public ActionResult Login(ACCOUNTVİEWMODEL a) { using (CheckinDatasetEntities4 DB = new CheckinDatasetEntities4()) { var count = DB.UserLoginInfo.Where(x => x.USERNAME == a.USERNAME && x.PASSWORD == a.PASSWORD).Count(); if (count == 0) { ViewBag.Msg = "Invalid User"; return(View()); } else { FormsAuthentication.SetAuthCookie(a.USERNAME, false); return(RedirectToAction("AccountHome", "Account")); } } }
public static void birPuanEkle(int[] dizi, int id) { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { if (dizi.Count() > 1) { foreach (int deger in dizi) { UserLikes yeni = new UserLikes() { USERLOGINID = id, LIKEID = deger, VALUE = 1 }; db.UserLikes.Add(yeni); db.SaveChanges(); } } } }
public static void Kayit(UserLoginInfoViewModel s) { try { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { UserLoginInfo yeni = new UserLoginInfo() { CITY = s.CITY, COUNTRY = s.COUNTRY, EMAIL = s.EMAIL, ISACTIVE = true, NAME = s.NAME, PASSWORD = s.PASSWORD, ROLE = 0, SURNAME = s.SURNAME, USERNAME = s.USERNAME, USERID = s.USERID }; db.UserLoginInfo.Add(yeni); db.SaveChanges(); } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException raise = new InvalidOperationException(message, raise); } } throw raise; } }
public static List <UserLikes> HobiListele(int id) { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { List <UserLikes> liste = new List <UserLikes>(); foreach (var kayit in db.UserLikes) { if (kayit.USERLOGINID == id) { liste.Add(new UserLikes() { LIKEID = kayit.LIKEID, USERLIKEID = kayit.USERLIKEID, USERLOGINID = kayit.USERLOGINID, VALUE = kayit.VALUE }); } } return(liste); } }
public static void placesEkle(PlaceModelList m) { using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { Place yeni = new Place() { ADDRESS = m.PlaceM.ADDRESS, CHECKINSCOUNT = m.PlaceM.CHECKINSCOUNT, CITY = m.PlaceM.CITY, COUNTRY = m.PlaceM.COUNTRY, CREATEDDATE = System.DateTime.Now, LAT = m.PlaceM.LAT, LNG = m.PlaceM.LNG, NAME = m.PlaceM.NAME, PLACEID = m.PlaceM.PLACEID, SWARMID = m.PlaceM.SWARMID, TIPCOUNT = m.PlaceM.TIPCOUNT, USERSCOUNT = m.PlaceM.USERSCOUNT }; db.Place.Add(yeni); db.SaveChanges(); var kayit = (from p in db.Place where (p.SWARMID == yeni.SWARMID) select p).SingleOrDefault(); PlaceCategories yeniC = new PlaceCategories() { CATEGORIEID = m.PlaceCateM.CATEGORIEID, PLACEID = kayit.PLACEID }; db.PlaceCategories.Add(yeniC); db.SaveChanges(); } }
public ActionResult mekanKesfet() { List <UserLikes> userLikes; List <FourSquare.SharpSquare.Entities.VenueHistory> Checkins; string token; using (CheckinDatasetEntities4 db = new CheckinDatasetEntities4()) { var UserLogID = (from p in db.UserLoginInfo where p.USERNAME == User.Identity.Name select p.USERLOGINID).FirstOrDefault(); userLikes = web2.BL.BL.HobiListele(UserLogID); token = (from p in db.Token where p.USERLOGINID == UserLogID select p.TOKENACID).FirstOrDefault(); } var sharpSquare = new FourSquare.SharpSquare.Core.SharpSquare(clientID, clientSecret); sharpSquare.SetAccessToken(token); venues = sharpSquare.GetUserVenueHistory(); Checkins = venues; GoturBeniIstedigimYere.RecommendationEngine rEng = new GoturBeniIstedigimYere.RecommendationEngine(); List <PlaceAndImages> result = rEng.DifferentCategoryRecommendVenues(userLikes, Checkins); for (int i = 0; i < 5; i++) { result[i].Place.LAT = result[i].Place.LAT.Replace(",", "."); result[i].Place.LNG = result[i].Place.LNG.Replace(",", "."); } MekanModelList a = new MekanModelList(); a.mekan1.LAT = result[0].Place.LAT; a.mekan1.LNG = result[0].Place.LNG; a.mekan1.mekanAd = result[0].Place.NAME; a.mekan1.mekanIl = result[0].Place.CITY; a.mekan1.mekanIlce = result[0].Place.ADDRESS; a.mekan2.LAT = result[1].Place.LAT; a.mekan2.LNG = result[1].Place.LNG; a.mekan2.mekanAd = result[1].Place.NAME; a.mekan2.mekanIl = result[1].Place.CITY; a.mekan2.mekanIlce = result[1].Place.ADDRESS; a.mekan3.LAT = result[2].Place.LAT; a.mekan3.LNG = result[2].Place.LNG; a.mekan3.mekanAd = result[2].Place.NAME; a.mekan3.mekanIl = result[2].Place.CITY; a.mekan3.mekanIlce = result[2].Place.ADDRESS; a.mekan4.LAT = result[3].Place.LAT; a.mekan4.LNG = result[3].Place.LNG; a.mekan4.mekanAd = result[3].Place.NAME; a.mekan4.mekanIl = result[3].Place.CITY; a.mekan4.mekanIlce = result[3].Place.ADDRESS; a.mekan5.LAT = result[4].Place.LAT; a.mekan5.LNG = result[4].Place.LNG; a.mekan5.mekanAd = result[4].Place.NAME; a.mekan5.mekanIl = result[4].Place.CITY; a.mekan5.mekanIlce = result[4].Place.ADDRESS; return(View("AnalizSonuc", a)); }