// ----------------------------------------------------------------------------------- // SaveReports //Saves the information provided to the database. // ----------------------------------------------------------------------------------- public void SaveReports(UCE_HelpMember report) { #if _MYSQL && _SERVER ExecuteNonQueryMySql("INSERT INTO UCE_reports VALUES (@senderAcc, @senderCharacter, @readBefore, @title, @message, @solved, @time, @position)", new MySqlParameter("@senderAcc", report.senderAcc), new MySqlParameter("@senderCharacter", report.senderCharacter), new MySqlParameter("@readBefore", report.readBefore ? 1 : 0), new MySqlParameter("@title", report.title), new MySqlParameter("@message", report.message), new MySqlParameter("@solved", report.solved ? 1 : 0), new MySqlParameter("@time", report.time), new MySqlParameter("@position", report.position)); #elif _SQLITE && _SERVER connection.Insert(new UCE_reports { senderAcc = report.senderAcc, senderCharacter = report.senderCharacter, readBefore = report.readBefore, title = report.title, message = report.message, solved = report.solved, time = report.time, position = report.position }); #endif }
public void CmdSendBugReport(string _title, string _message) { UCE_HelpMember report = new UCE_HelpMember(); //Setup the reporting member to be used. if (reports.Count > 0) //If the reports are not empty then continue. { var lastBugReportTime = DateTime.Parse(reports[reports.Count - 1].time); //Set the time the bug has been reported. if (DateTime.UtcNow.Subtract(lastBugReportTime).Minutes < UCE_Help.ReportIntervalMinutes) //Check if enough time has passed from last posting before allowing another post. { //Inform the player in chat that they can't report another ticket for the interval time. TargetHelpResponse(netIdentity, "(Info)", "", "Can't report right now; because you reported a problem less than " + timeToReport.ToString() + " minutes ago.", ""); return; } else { report.readBefore = false; //Set the read option to false. report.senderAcc = account; //Set the account information. report.senderCharacter = name; //Set the character name. report.title = _title; //Set the title information. report.message = _message; //Set the details message information. report.solved = false; //Set the solved option to false. report.time = DateTime.UtcNow.ToString(); //Set the date and time information. report.position = transform.position.ToString(); //Set the position of the player information. Database.singleton.SaveReports(report); //Send the information to the server database. reports.Add(report); //Add the report to our list to view from other addon. TargetHelpResponse(netIdentity, "(Info)", "", "Report sent successfully.", ""); } } else { report.readBefore = false; //Set the read option to false. report.senderAcc = account; //Set the account information. report.senderCharacter = name; //Set the character name. report.title = _title; //Set the title information. report.message = _message; //Set the details message information. report.solved = false; //Set the solved option to false. report.time = DateTime.UtcNow.ToString(); //Set the date and time information. report.position = transform.position.ToString(); //Set the position of the player information. Database.singleton.SaveReports(report); //Send the information to the server database. reports.Add(report); //Add the report to our list to view from other addon. TargetHelpResponse(netIdentity, "(Info)", "", "Report sent successfully.", ""); //Tell the player in chat that the report was successful. } }
private void CharacterLoad_Reports(Player player) { #if _MYSQL && _SERVER var table = ExecuteReaderMySql("SELECT senderCharacter, readBefore, title, message, solved, time, position FROM UCE_reports WHERE senderAcc=@senderAcc;", new MySqlParameter("@senderAcc", player.account)); if (table.Count > 0) //If the table has anything then continue. { for (int i = 0; i < table.Count; i++) //Loop through the table to gather the information. { var row = table[i]; //Grab each row from the table. var report = new UCE_HelpMember(); //Make the report. report.senderAcc = player.account; //Set the account information. report.senderCharacter = player.name; //Set the character name of sender. report.readBefore = ((int)row[1]) != 0; //Set the read option. report.title = (string)row[2]; //Set the title. report.message = (string)row[3]; //Set the details message. report.solved = ((int)row[4]) != 0; //Set the solved or not option. report.time = (string)row[5]; //Set the time and date. report.position = (string)row[6]; //Set the position the player was on the map. player.reports.Add(report); //Add the report to a list to pull with other addon. } } #elif _SQLITE && _SERVER var table = connection.Query <UCE_reports>("SELECT senderCharacter, readBefore, title, message, solved, time, position FROM 'UCE_reports' WHERE senderAcc=?", player.account); if (table.Count > 0) //If the table has anything then continue. { for (int i = 0; i < table.Count; i++) //Loop through the table to gather the information. { var row = table[i]; //Grab each row from the table. var report = new UCE_HelpMember(); //Make the report. report.senderAcc = player.account; //Set the account information. report.senderCharacter = player.name; //Set the character name of sender. report.readBefore = row.readBefore; //Set the read option. report.title = row.time; //Set the title. report.message = row.message; //Set the details message. report.solved = row.solved; //Set the solved or not option. report.time = row.time; //Set the time and date. report.position = row.position; //Set the position the player was on the map. player.reports.Add(report); //Add the report to a list to pull with other addon. } } #endif }
// ----------------------------------------------------------------------------------- // SaveReports //Saves the information provided to the database. // ----------------------------------------------------------------------------------- public void SaveReports(UCE_HelpMember report) { #if _MYSQL ExecuteNonQueryMySql("INSERT INTO UCE_reports VALUES (@senderAcc, @senderCharacter, @readBefore, @title, @message, @solved, @time, @position)", new MySqlParameter("@senderAcc", report.senderAcc), new MySqlParameter("@senderCharacter", report.senderCharacter), new MySqlParameter("@readBefore", report.readBefore ? 1 : 0), new MySqlParameter("@title", report.title), new MySqlParameter("@message", report.message), new MySqlParameter("@solved", report.solved ? 1 : 0), new MySqlParameter("@time", report.time), new MySqlParameter("@position", report.position)); #elif _SQLITE ExecuteNonQuery("INSERT INTO 'UCE_reports' VALUES (@senderAcc, @senderCharacter, @readBefore, @title, @message, @solved, @time, @position)", new SqliteParameter("@senderAcc", report.senderAcc), new SqliteParameter("@senderCharacter", report.senderCharacter), new SqliteParameter("@readBefore", report.readBefore ? 1 : 0), new SqliteParameter("@title", report.title), new SqliteParameter("@message", report.message), new SqliteParameter("@solved", report.solved ? 1 : 0), new SqliteParameter("@time", report.time), new SqliteParameter("@position", report.position)); #endif }