public ActionResult Register(clsPlayerViewModel objPlayerEntity) { int intRegistrationCount = 0; bool blnCoach = false; intRegistrationCount = objPlayerService.GetTotalRegistation(); blnCoach = objPlayerService.IsCoachAdded(); ViewBag.RegistationCount = intRegistrationCount; ViewBag.CoachAdded = blnCoach; try { if (objPlayerEntity != null) { objPlayerService.InserPlayerDetails(objPlayerEntity); } } catch (Exception) { } ModelState.Clear(); return(View()); }
public bool AuthenticatePlayerDetails(clsPlayerViewModel objPlayerEntity) { bool blnResponce = false; string strEmail = objPlayerEntity.email; string strPassword = clsEncryptDecrypt.Encrypt(objPlayerEntity.password); clsPlayerViewModel objPlayerDetails = new clsPlayerViewModel(); objPlayerDetails = objPlayer.ValidatePlayerForLogin(strEmail, strPassword); if (objPlayerDetails != null) { blnResponce = true; HttpContext.Current.Session["playerid"] = objPlayerDetails.playerid; HttpContext.Current.Session["playerdetails"] = objPlayerDetails; } else { blnResponce = false; } return(blnResponce); }
public clsPlayerViewModel ValidatePlayerForLogin(string strEmail, string strPassword) { clsPlayerViewModel objplayerDetail = new clsPlayerViewModel(); objSqlParameter = new List <SqlParameter>(); objSqlParameter.Add(new SqlParameter("email", strEmail)); objSqlParameter.Add(new SqlParameter("password", strPassword)); strQuery = @"SELECT playerid, firstname, lastname, email, contactnumber, role FROM player WHERE email = @email AND password = @password AND ISNULL(flagdeleted, 0) = 0" ; objplayerDetail = base.ExecuteScalarQuery <clsPlayerViewModel>(strQuery, objSqlParameter, "ValidatePlayerForLogin"); return(objplayerDetail); }
public int InsertPlayerDetails(clsPlayerViewModel objPlayerEntity) { int intPlayerId = 0; objSqlParameter = new List <SqlParameter>(); objSqlParameter.Add(new SqlParameter("firstname", objPlayerEntity.firstname ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("lastname", objPlayerEntity.lastname ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("totalmatchesplayed", objPlayerEntity.totalmatchesplayed ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("contactnumber", objPlayerEntity.contactnumber ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("email", objPlayerEntity.email ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("password", objPlayerEntity.password ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("dateofBirth", objPlayerEntity.dateofBirth ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("playerheight", objPlayerEntity.playerheight ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("playerweight", objPlayerEntity.playerweight ?? (object)DBNull.Value)); objSqlParameter.Add(new SqlParameter("role", objPlayerEntity.role ?? (object)DBNull.Value)); strQuery = @"INSERT INTO player (firstname, lastname, totalmatchesplayed, contactnumber, email, password, dateofBirth, playerheight, playerweight, role) values(@firstname, @lastname, @totalmatchesplayed, @contactnumber, @email, @password, @dateofBirth, @playerheight, @playerweight, @role)"; intPlayerId = base.ExecuteStoreCommand(strQuery, objSqlParameter, "InsertPlayerDetails", 'Y'); return(intPlayerId); }
public void InserPlayerDetails(clsPlayerViewModel objPlayerEntity) { if (objPlayerEntity != null) { objPlayerEntity.password = clsEncryptDecrypt.Encrypt("team1234"); objPlayer.InsertPlayerDetails(objPlayerEntity); } }
public ActionResult Login(clsPlayerViewModel objPlayerEntity) { if (objPlayerEntity != null && !string.IsNullOrEmpty(objPlayerEntity.email) && !string.IsNullOrEmpty(objPlayerEntity.password)) { if (objPlayerService.AuthenticatePlayerDetails(objPlayerEntity)) { return(RedirectToAction("Index", "Player")); } else { return(View()); } } else { return(View()); } }
public ActionResult Index() { if (!objCommonFunction.CheckPlayerSession()) { return(RedirectToAction("Index", "Home")); } else { List <clsPlayerViewModel> lstPlayer = new List <clsPlayerViewModel>(); lstPlayer = objPlayerService.GetAllPlayers(); int LogiPlayerRole = 0; bool blnPlayerSelected = false; clsPlayerViewModel objPlayerDetails = (clsPlayerViewModel)HttpContext.Session["playerdetails"]; LogiPlayerRole = objPlayerDetails != null ? objPlayerDetails.role.Value : 0; blnPlayerSelected = lstPlayer != null?lstPlayer.Where(x => x.playerid == objPlayerDetails.playerid).FirstOrDefault().isselected.Value : false; string strMsg = ""; switch (LogiPlayerRole) { case 1: lstPlayer = lstPlayer.Where(x => x.role != LogiPlayerRole).ToList(); break; case 2: lstPlayer = lstPlayer.Where(x => x.role != LogiPlayerRole && x.role != 1).ToList(); break; case 3: strMsg = blnPlayerSelected == true ? "You are selected" : "You are not selected"; break; } ViewBag.PlayerDetails = objPlayerDetails; ViewBag.PlayerMessage = strMsg; return(View(lstPlayer)); } }