示例#1
0
        //Game Information Specification
        private void GameInfo_Select(int Game_ID)
        {
            Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
            Game game = dbContext.Games.FirstOrDefault(x => x.Game_ID == Game_ID);

            if (game != null)
            {
                txtGameFullName.Text       = game.Game_Full_Name;
                txtGameShortName.Text      = game.Game_Short_Name;
                txtGameCompany.Text        = game.Company;
                dateRelease.Value          = Convert.ToDateTime(game.Release_Date).ToString("yyyy-MM-dd");
                dateUploaded.Value         = Convert.ToDateTime(game.Upload_Date).ToString("yyyy-MM-dd");
                txtGameMinSpecID.Text      = game.Min_Spc_ID.ToString();
                txtGameRecSpecID.Text      = game.Rec_Spc.Specification_ID.ToString();
                txtGamePrimaryComment.Text = game.Primary_Comment;
                txtGameWarning.Text        = game.Warnings;
                txtGameComment1.Text       = game.Developer_Comment_1;
                txtGameComment2.Text       = game.Developer_Comment_2;
                string[] gamesTypes = game.Game_Type.Split(",".ToCharArray().FirstOrDefault());
                SettingRepeaterControl(gamesTypes);
                ErrorMessageGameInfo("", false);
            }
            else
            {
                ErrorMessageGameInfo("ID = " + Game_ID + " Does not Exsist !", true);
            }
        }
示例#2
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);
            }
        }
示例#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
        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);
            }
        }
示例#5
0
 //Create New Account
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string currentuser = CurrentUserEmail();
         Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
         User user = dbContext.Users.FirstOrDefault(x => x.Email_Address == currentuser);
         if (currentuser == "Administrator")
         {
             showHideControls(true);
         }
         else
         {
             showHideControls(false);
         }
         AssigningValuesToControls(user);
     }
 }
示例#6
0
        private void TechSpc_Select(int Game_ID)
        {
            Games_Arena_DB_Context   dbContext = new Games_Arena_DB_Context();
            Specifications_Technical Tech_spc  = dbContext.Specifications_Technical.FirstOrDefault(x => x.Game_ID == Game_ID);

            if (Tech_spc != null)
            {
                txtTSAudioLanguage.Text     = Tech_spc.Audio_Language;
                txtTSGameSize.Text          = Tech_spc.Game_Download_Size;
                txtTSGameVersion.Text       = Tech_spc.Game_Version;
                txtTSInterfaceLanguage.Text = Tech_spc.Interface_Language;
                txtTSMDSSUM.Text            = Tech_spc.MDSSUM;
                txtTSUploader.Text          = Tech_spc.Uploader;
                ErrorMessageTechSpc("", false);
            }
            else
            {
                ErrorMessageTechSpc("ID = " + Game_ID + " Does not Exsist !", true);
            }
        }
示例#7
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);
            }
        }
示例#8
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);
            }
        }
示例#9
0
        private void MinSpc_Select(int Spc_ID)
        {
            Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
            Specification          spc       = dbContext.Specifications.FirstOrDefault(x => x.Specification_ID == Spc_ID);

            if (spc != null)
            {
                txtMinRecSpcDirectX.Text   = spc.DirectX;
                txtMinRecSpcGraphics.Text  = spc.Graphics;
                txtMinRecSpcMemory.Text    = spc.Memory;
                txtMinRecSpcOS.Text        = spc.OS;
                txtMinRecSpcProcessor.Text = spc.Processor;
                txtMinRecSpcSoundCard.Text = spc.Sound_Card;
                txtMinRecSpcStorage.Text   = spc.Storage;
                ErrorMessageMinRecSpc("", false);
            }
            else
            {
                ErrorMessageMinRecSpc("ID = " + Spc_ID + " Does not Exsist !", true);
            }
        }
示例#10
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);
     }
 }
示例#11
0
        private void GameImages_Select(int Game_ID)
        {
            Games_Arena_DB_Context dbContext   = new Games_Arena_DB_Context();
            Game_Images            game_Images = dbContext.Game_Images.FirstOrDefault(x => x.Game_ID == Game_ID);

            if (game_Images != null)
            {
                Image1.ImageUrl = "";
                Image2.ImageUrl = "";
                Image3.ImageUrl = "";
                Image4.ImageUrl = "";
                Image5.ImageUrl = "";
                if (game_Images.Large_Image_1 != null)
                {
                    Image1.ImageUrl = ConvertBytesToImage(game_Images.Large_Image_1);
                }
                if (game_Images.Large_Image_2 != null)
                {
                    Image2.ImageUrl = ConvertBytesToImage(game_Images.Large_Image_2);
                }
                if (game_Images.Large_Image_3 != null)
                {
                    Image3.ImageUrl = ConvertBytesToImage(game_Images.Large_Image_3);
                }
                if (game_Images.Large_Image_4 != null)
                {
                    Image4.ImageUrl = ConvertBytesToImage(game_Images.Large_Image_4);
                }
                if (game_Images.Small_Image != null)
                {
                    Image5.ImageUrl = ConvertBytesToImage(game_Images.Small_Image);
                }
                ErrorMessageImageUploads("", false);
            }
            else
            {
                ErrorMessageImageUploads("ID = " + Game_ID + " Does not Exsist !", true);
            }
        }
示例#12
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();
                }
            }
        }
示例#13
0
        protected void btnSearchID_Click(object sender, EventArgs e)
        {
            ErrorMessageCreateAccount("", false);
            int id = 0;

            if (int.TryParse(txtUserID.Text, out id))
            {
                Games_Arena_DB_Context dbContext = new Games_Arena_DB_Context();
                User user = dbContext.Users.FirstOrDefault(x => x.User_ID == id);
                if (user != null)
                {
                    AssigningValuesToControls(user);
                }
                else
                {
                    ErrorMessageCreateAccount(txtUserID.Text + " ID not Found", true);
                }
            }
            else
            {
                ErrorMessageCreateAccount(txtUserID.Text + " is not Valid", true);
            }
        }