protected void btnLogIn_Click(object sender, EventArgs e) { Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context(); User user = dbContext.Users.FirstOrDefault(x => x.Email_Address == txtLIUserName.Text); if (user != null) { if (user.LockedDateTime <= DateTime.Now) { UnlockedTheUser(user); } if (user.IsLocked == false) { if (user.Password == EncryptedPassword(txtLIPassword.Text)) { UnlockedTheUser(user); //Authenticate User and redirect to admin Page FormsAuthentication.RedirectFromLoginPage(user.Email_Address, false); ErrorMessageLogIn("Welcome", true); } else { if (user.Retry_Attempts == 3) { user.IsLocked = true; user.Retry_Attempts = 0; user.LockedDateTime = DateTime.Now.AddMinutes(1); ErrorMessageLogIn("You have been locked by Admin till " + user.LockedDateTime, true); } else { ErrorMessageLogIn("Password Doesn't Match You have left (0" + (3 - user.Retry_Attempts) + ") Attempt(s)", true); } user.Retry_Attempts += 1; } } else { ErrorMessageLogIn("You have been locked by Admin till " + user.LockedDateTime, true); } } else { ErrorMessageLogIn("User Name / Password Doesn't Match", true); } dbContext.SaveChanges(); }
protected void btnDownload_Click(object sender, EventArgs e) { NameValueCollection nvc = Request.QueryString; if (!string.IsNullOrEmpty(nvc["Game"])) { string GameName = nvc["Game"]; Games_Arena_DB_Context dbcontext = new Games_Arena_DB_Context(); int fileExsist = dbcontext.Specifications_Technical.Where(x => x.Game_File_Name == GameName).Count(); if (fileExsist > 0) { Response.Clear(); Response.ContentType = "application/octect-stream"; Response.AppendHeader("content-disposition", "filename=" + GameName); Response.TransmitFile(Server.MapPath("~/Games/") + GameName); } } }
protected void btnFPVerify_Click(object sender, EventArgs e) { Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context(); User user = dbContext.Users.FirstOrDefault(x => x.Email_Address == txtFPUserName.Text); if (user != null) { if (user.LockedDateTime <= DateTime.Now) { UnlockedTheUser(user); } if (user.IsLocked == false) { if (ddlFPSecretQuestion.SelectedValue == "Select Option") { //SendRestPasswordEmails(user.Gmail, user.First_Name + " " + user.Last_Name, user.) ErrorMessageForgetPassword("The Email has been Sent to your Email Address", true); } else { if (user.Secret_Question == ddlFPSecretQuestion.SelectedValue && user.Secret_Answer == EncryptedPassword(txtFPSecretAnswer.Text)) { Random random = new Random(); int randomNumber = random.Next(DateTime.Now.Second); user.Password = EncryptedPassword(randomNumber + " Pakistan"); ErrorMessageForgetPassword("Your New Password is \"" + randomNumber + " Pakistan\"", true); dbContext.SaveChanges(); } else { ErrorMessageForgetPassword("Email and Secret Question / Answer Doesn't Match", true); } } } else { ErrorMessageForgetPassword("You have been locked by Admin till " + user.LockedDateTime, true); } } else { ErrorMessageForgetPassword("Email and Secret Question / Answer Doesn't Match", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NameValueCollection nvc = Request.QueryString; if (!string.IsNullOrEmpty(nvc["Game"])) { string GameName = nvc["Game"]; Games_Arena_DB_Context dbcontext = new Games_Arena_DB_Context(); int fileExsist = dbcontext.Specifications_Technical.Where(x => x.Game_File_Name == GameName).Count(); if (fileExsist == 0) { Response.Redirect("~/Category.aspx"); } } else { Response.Redirect("~/Category.aspx"); } } }
public bool initializeFields() { bool result = false; try { NameValueCollection nameValueCollection = Request.QueryString; if (!string.IsNullOrEmpty(nameValueCollection["Game_ID"])) { int ID = 0; if (int.TryParse(nameValueCollection["Game_ID"], out ID)) { Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context(); Game game = dbContext.Games.FirstOrDefault(x => x.Game_ID == ID); if (game != null) { litGameName1.Text = game.Game_Full_Name; litGameName2.Text = game.Game_Short_Name; litGameName3.Text = game.Game_Full_Name; litGameName4.Text = game.Game_Full_Name; litGameName5.Text = game.Game_Short_Name; litGameName6.Text = game.Game_Full_Name; litGameName7.Text = game.Game_Short_Name; litGameYear.Text = game.Release_Date.Value.ToString("yyyy"); litPrimaryComment.Text = game.Primary_Comment; litDevComment1.Text = game.Developer_Comment_1; litDevComment2.Text = game.Developer_Comment_2; litWarning.Text = game.Warnings; //Tech Specification litTechGameVersion.Text = game.Tech_Spc.Game_Version; litTechInterfaceLanguage.Text = game.Tech_Spc.Interface_Language; litTechAudioLanguage.Text = game.Tech_Spc.Audio_Language; litTechUploader.Text = game.Tech_Spc.Uploader; litTechGameFileName.Text = game.Tech_Spc.Game_File_Name; btnDownload.PostBackUrl = "~/DownLoad.aspx?Game=" + game.Tech_Spc.Game_File_Name; litTechGameSize.Text = game.Tech_Spc.Game_Download_Size; litTechMDSSUM.Text = game.Tech_Spc.MDSSUM; //Minimum Specificaiton litMinOS.Text = game.Min_Spc.OS; litMinProcessor.Text = game.Min_Spc.Processor; litMinMemory.Text = game.Min_Spc.Memory; litMinGraphics.Text = game.Min_Spc.Graphics; litMinDirectX.Text = game.Min_Spc.DirectX; litMinStorage.Text = game.Min_Spc.Storage; litMinSoundCard.Text = game.Min_Spc.Sound_Card; //Recomended Specificaiton litRecOS.Text = game.Rec_Spc.OS; litRecProcessor.Text = game.Rec_Spc.Processor; litRecMemory.Text = game.Rec_Spc.Memory; litRecGraphics.Text = game.Rec_Spc.Graphics; litRecDirectX.Text = game.Rec_Spc.DirectX; litRecStorage.Text = game.Rec_Spc.Storage; litRecSoundCard.Text = game.Rec_Spc.Sound_Card; //Images if (game.Game_Images.Large_Image_1 != null) { ImgCurrentGame1.ImageUrl = "data:Image/jpg;base64," + Convert.ToBase64String(game.Game_Images.Large_Image_1); } if (game.Game_Images.Large_Image_2 != null) { ImgCurrentGame2.ImageUrl = "data:Image/jpg;base64," + Convert.ToBase64String(game.Game_Images.Large_Image_2); } if (game.Game_Images.Large_Image_3 != null) { imgCurrentGame3.ImageUrl = "data:Image/jpg;base64," + Convert.ToBase64String(game.Game_Images.Large_Image_3); } if (game.Game_Images.Small_Image != null) { imgCurrentGame4.ImageUrl = "data:Image/jpg;base64," + Convert.ToBase64String(game.Game_Images.Large_Image_4); } //Related Links string currentType = game.Game_Type.Split(",".ToCharArray().First()).First(); ViewState["CurrentType"] = currentType; IQueryable <Game> relatedgame = dbContext.Games.Where(x => x.Game_Type.Contains(currentType)).Take(6); rptrRelatedLinks.DataSource = relatedgame.ToList(); rptrRelatedLinks.DataBind(); result = true; } } } } catch { result = false; } return(result); }