示例#1
0
        protected void btnImgUpdate_Click(object sender, EventArgs e)
        {
            int ID = 0;

            if (int.TryParse(txtGameID.Text, out ID))
            {
                Games_Arena_DB_Context dbContext    = new Games_Arena_DB_Context();
                StringBuilder          errorMessage = new StringBuilder();
                string      message;
                Game_Images game_Images = null;
                try
                {
                    game_Images = dbContext.Game_Images.FirstOrDefault(x => x.Game_ID == ID);
                    if (ValidateFileUpload(fu_Game_Images_1.PostedFile, out message))
                    {
                        game_Images.Large_Image_1 = ConvertImageToByte(fu_Game_Images_1.PostedFile);
                    }
                    errorMessage.Append(message);
                    if (ValidateFileUpload(fu_Game_Images_2.PostedFile, out message))
                    {
                        game_Images.Large_Image_2 = ConvertImageToByte(fu_Game_Images_2.PostedFile);
                    }
                    errorMessage.Append(message);
                    if (ValidateFileUpload(fu_Game_Images_3.PostedFile, out message))
                    {
                        game_Images.Large_Image_3 = ConvertImageToByte(fu_Game_Images_3.PostedFile);
                    }
                    errorMessage.Append(message);
                    if (ValidateFileUpload(fu_Game_Images_4.PostedFile, out message))
                    {
                        game_Images.Large_Image_4 = ConvertImageToByte(fu_Game_Images_4.PostedFile);
                    }
                    errorMessage.Append(message);
                    if (ValidateFileUpload(fu_Game_Images_5.PostedFile, out message))
                    {
                        game_Images.Small_Image = ConvertImageToByte(fu_Game_Images_5.PostedFile);
                    }
                    errorMessage.Append(message);
                    dbContext.SaveChanges();
                    if (errorMessage.Length > 10)
                    {
                        ErrorMessageImageUploads(errorMessage.ToString(), true);
                    }
                    else
                    {
                        ErrorMessageImageUploads("", false);
                    }
                    GameImages_Select(ID);
                }
                catch (Exception ex)
                {
                    ErrorMessageImageUploads(ex.Message, true);
                }
            }
            else
            {
                ErrorMessageImageUploads("ID = " + txtGameID.Text + " Does not Exsist !", true);
            }
        }
示例#2
0
        private void GameInfo_InsertUpdateDelete(int Game_ID, Operation operation)
        {
            Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
            Game game = new Game();

            try
            {
                if (operation.ToString() == "Update" || operation.ToString() == "Delete")
                {
                    game = dbContext.Games.FirstOrDefault(x => x.Game_ID == Game_ID);
                }
                if (operation.ToString() == "Update" || operation.ToString() == "Insert")
                {
                    game.Game_Full_Name      = txtGameFullName.Text;
                    game.Game_Short_Name     = txtGameShortName.Text;
                    game.Company             = txtGameCompany.Text;
                    game.Release_Date        = Convert.ToDateTime(dateRelease.Value);
                    game.Upload_Date         = DateTime.Now;
                    game.Min_Spc_ID          = Convert.ToInt32(txtGameMinSpecID.Text);
                    game.Rec_Spc_ID          = Convert.ToInt32(txtGameRecSpecID.Text);
                    game.Primary_Comment     = txtGamePrimaryComment.Text;
                    game.Warnings            = txtGameWarning.Text;
                    game.Developer_Comment_1 = txtGameComment1.Text;
                    game.Developer_Comment_2 = txtGameComment2.Text;
                    game.Game_Type           = ConvertListOfPagestoString(rptrPages.Items);
                }
                if (operation.ToString() == "Insert")
                {
                    dbContext.Games.Add(game);
                    dbContext.SaveChanges();
                    txtGameID.Text = dbContext.Games.OrderByDescending(x => x.Game_ID).Select(x => x.Game_ID).FirstOrDefault().ToString();
                }
                else if (operation.ToString() == "Delete")
                {
                    dbContext.Games.Remove(game);
                }

                dbContext.SaveChanges();
                ErrorMessageGameInfo("", false);
            }
            catch (Exception ex)
            {
                ErrorMessageGameInfo(ex.Message, true);
            }
        }
示例#3
0
        protected void btnCAADelete_Click(object sender, EventArgs e)
        {
            Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
            User user = dbContext.Users.FirstOrDefault(x => x.Email_Address == txtCAEmail.Text);

            if (user != null)
            {
                dbContext.Users.Remove(user);
                dbContext.SaveChanges();
                ErrorMessageCreateAccount(user.Email_Address + " has Deleted", true);
            }
            else
            {
                ErrorMessageCreateAccount("No User is Deleted", true);
            }
        }
示例#4
0
        protected void btnCAAccount_Click(object sender, EventArgs e)
        {
            Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
            User user = dbContext.Users.FirstOrDefault(x => x.Email_Address == txtCAEmail.Text);

            if (user == null)
            {
                User newUser = new User();
                if (RecivingValuesFromControls(newUser))
                {
                    newUser.Email_Address = txtCAEmail.Text;
                    dbContext.Users.Add(newUser);
                    dbContext.SaveChanges();
                }
            }
            else
            {
                ErrorMessageCreateAccount("Email Address already Exsist, Please try another", true);
            }
        }
示例#5
0
        protected void btnTechSpcUpdate_Click(object sender, EventArgs e)
        {
            int ID = 0;

            if (int.TryParse(txtGameID.Text, out ID))
            {
                Games_Arena_DB_Context   dbContext = new Games_Arena_DB_Context();
                Specifications_Technical Tech_spc  = null;
                try
                {
                    //File Size must be Less than 5 GB
                    if (fuGameFileName.FileContent.Length < 5368709120)
                    {
                        Tech_spc = dbContext.Specifications_Technical.FirstOrDefault(x => x.Game_ID == ID);
                        if (fuGameFileName.HasFile)
                        {
                            string extension = Path.GetExtension(fuGameFileName.FileName);
                            Tech_spc.Game_Download_Size = ComputeFileSize(fuGameFileName.FileContent.Length);
                            fuGameFileName.SaveAs(Server.MapPath("~/Games/" + txtGameID.Text + " - " + txtGameShortName.Text + extension));
                            Tech_spc.Game_File_Name = txtGameID.Text + " - " + txtGameShortName.Text + extension;
                        }
                        Tech_spc.Audio_Language     = txtTSAudioLanguage.Text;
                        Tech_spc.Game_Version       = txtTSGameVersion.Text;
                        Tech_spc.Interface_Language = txtTSInterfaceLanguage.Text;
                        Tech_spc.MDSSUM             = txtTSMDSSUM.Text;
                        Tech_spc.Uploader           = txtTSUploader.Text;
                        dbContext.SaveChanges();
                        TechSpc_Select(ID);
                        ErrorMessageTechSpc("", false);
                    }
                }
                catch (Exception ex)
                {
                    ErrorMessageTechSpc(ex.Message, true);
                }
            }
            else
            {
                ErrorMessageTechSpc("ID = " + txtGameID.Text + " Does not Exsist !", true);
            }
        }
示例#6
0
 private void MinSpc_InsertUpdateDelete(int Spc_ID, Operation operation)
 {
     try
     {
         Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
         Specification          spc       = null;
         if (operation.ToString() == "Update" || operation.ToString() == "Delete")
         {
             spc = dbContext.Specifications.FirstOrDefault(x => x.Specification_ID == Spc_ID);
         }
         else if (operation.ToString() == "Insert")
         {
             spc = new Specification();
         }
         if (operation.ToString() == "Update" || operation.ToString() == "Insert")
         {
             spc.DirectX    = txtMinRecSpcDirectX.Text;
             spc.Graphics   = txtMinRecSpcGraphics.Text;
             spc.Memory     = txtMinRecSpcMemory.Text;
             spc.OS         = txtMinRecSpcOS.Text;
             spc.Processor  = txtMinRecSpcProcessor.Text;
             spc.Sound_Card = txtMinRecSpcSoundCard.Text;
             spc.Storage    = txtMinRecSpcStorage.Text;
         }
         if (operation.ToString() == "Insert")
         {
             dbContext.Specifications.Add(spc);
         }
         else if (operation.ToString() == "Delete")
         {
             dbContext.Specifications.Remove(spc);
         }
         dbContext.SaveChanges();
         ErrorMessageMinRecSpc("", false);
     }
     catch (Exception ex)
     {
         ErrorMessageMinRecSpc(ex.Message, true);
     }
 }
示例#7
0
        protected void btnCAAUpdateAccount_Click(object sender, EventArgs e)
        {
            Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
            string currentuser = CurrentUserEmail();
            User   user        = null;

            if (currentuser == "Administrator")
            {
                user = dbContext.Users.FirstOrDefault(x => x.Email_Address == txtCAEmail.Text);
            }
            else
            {
                user = dbContext.Users.FirstOrDefault(x => x.Email_Address == currentuser);
            }
            if (user != null)
            {
                if (RecivingValuesFromControls(user))
                {
                    dbContext.SaveChanges();
                }
            }
        }