public static void Delete(int id) { con = new Connections(); string queryStr = "DELETE FROM [dbo].[Answer] WHERE [Id] = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Delete(string projectId) { con = new Connections(); string queryStr = "DELETE FROM [dbo].[Question] WHERE [ProjectId] = '" + projectId + "'"; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void DeleteByQuestion(int questionId) { con = new Connections(); string queryStr = "DELETE FROM [dbo].[Answer] WHERE [QuestionId] = '" + questionId + "'"; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Delete(string username) { con = new Connections(); string queryStr = "DELETE FROM [dbo].[Professors] WHERE [Username] = '" + username + "'"; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id) { con = new Connections(); string queryStr = "UPDATE [dbo].[Student] SET [Assigned] = 'True'" + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, byte[] avatar) { con = new Connections(); string queryStr = "UPDATE [dbo].[Professors] SET [avatar] = 0x" + BitConverter.ToString(avatar).Replace("-", "") + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string answer) { con = new Connections(); string queryStr = "UPDATE [dbo].[Answer] SET [Answer] = N'" + answer + "'" + "WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string fullName) { con = new Connections(); string queryStr = "UPDATE [dbo].[Professors] SET [FullName] = N'" + fullName + "'" + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, int questionId) { con = new Connections(); string queryStr = "UPDATE [dbo].[Answer] SET [QuestionId] = " + questionId + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, bool status) { con = new Connections(); string queryStr = "UPDATE [dbo].[Professors] SET [Status] = '" + status + "'" + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void UpdateStatus(int id, int status) { con = new Connections(); string queryStr = "UPDATE [dbo].[Answer] SET [Status] = " + status + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string question) { con = new Connections(); string queryStr = "UPDATE [dbo].[Question] SET [Question] = N'" + question + "'" + "WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Add(string name, DateTime createdAt, int createdBy, DateTime startDate, DateTime endDate) { con = new Connections(); string queryStr = "INSERT INTO [dbo].[Project] " + "(ProjectCode, Name, CreatedAt, CreatedBy, StartDate, EndDate)" + "VALUES ('PJ-' + CONVERT(VARCHAR, (SELECT IDENT_CURRENT('Project') AS INDENTITY)) + '" + createdAt.Day.ToString() + "', N'" + name + "', CONVERT(datetime, '" + createdAt + "', 103), " + createdBy + ", CONVERT(datetime, '" + startDate + "', 103), CONVERT(datetime, '" + endDate + "', 103))"; con.ExecuteScalar(queryStr); con.CloseConnection(); }
public static void Add(int projectId, string question) { con = new Connections(); string queryStr = "INSERT INTO [dbo].[Question] " + "([Question], [ProjectId])" + "VALUES (N'" + question + "', " + projectId + ")"; con.ExecuteScalar(queryStr); con.CloseConnection(); }
public static void Update(int id, string username, string password) { con = new Connections(); string queryStr = "UPDATE [dbo].[Professors] SET [Username] = N'" + username + "'" + ", [Password] = '" + password + "'" + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, int professorId, int projectId) { con = new Connections(); string queryStr = "UPDATE [dbo].[Group] SET [ProjectId] = " + projectId + ", [AssignBy] = " + professorId + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, int score, DateTime submitAt) { con = new Connections(); string queryStr = "UPDATE [dbo].[OnlineTest] SET [Score] = " + score + ", [SubmitAt] = CONVERT( datetime, '" + submitAt.ToString("dd/MM/yyyy") + "', 103)" + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Add(int questionId, string answer, bool status) { con = new Connections(); string queryStr = "INSERT INTO [dbo].[Answer] " + "([Answer], [QuestionId], [Status])" + "VALUES (N'" + answer + "', " + questionId + ", " + status + ")"; con.ExecuteScalar(queryStr); con.CloseConnection(); }
public static void Add(string username, string password, string fullName, string college, string subject, int age, DateTime birthday) { con = new Connections(); string queryStr = "INSERT INTO [dbo].[Student] " + "([Username], [Password], [FullName], [College], [Subject], [Age], [Assigned], [Birthday])" + "VALUES ('" + username + "', '" + password + "', N'" + fullName + "', N'" + college + "', N'" + subject + "', 0, " + age + ", CONVERT(datetime, '" + birthday + "', 103))"; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string answer, int questionId, bool status) { con = new Connections(); string queryStr = "UPDATE [dbo].[Answer] SET [Answer] = N'" + answer + "'" + ", [QuestionId] = " + questionId + ", [Status] = " + status + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Add(int studentId, DateTime expiryDate) { con = new Connections(); string queryStr = "INSERT INTO [dbo].[OnlineTest] " + "([StudentId], [StartDate], [ExpiryDate], [Score], [SubmitAt])" + "VALUES (" + studentId + ", CONVERT( datetime, '" + DateTime.Now.ToString("dd/MM/yyyy") + "', 103), CONVERT( datetime, '" + expiryDate.ToString("dd/MM/yyyy") + "', 103), " + 0 + ", CONVERT( datetime, '" + DateTime.Now.ToString("dd/MM/yyyy") + "', 103))"; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Add(int createdBy, DateTime createdAt, string fullName, string email, string username, string password, string phoneNumber, string address, bool status) { con = new Connections(); string queryStr = "INSERT INTO [dbo].[Professors] " + "([FullName], [Email], [Username], [Password], [PhoneNumber], [Address], [CreatedBy], [CreatedAt], [Status])" + "VALUES (N'" + fullName + "', '" + email + "', '" + username + "', '" + password + "', '" + phoneNumber + "', '" + address + "', " + createdBy + ", CONVERT(datetime, '" + createdAt + "', 103), " + status + ")"; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string fullName, string email, string address, string phoneNumber, byte[] avatar) { con = new Connections(); string queryStr = "UPDATE [dbo].[Professors] SET [FullName] = N'" + fullName + "'" + ", [Email] = '" + email + "'" + ", [Address] = N'" + address + "'" + ", [PhoneNumber] = '" + phoneNumber + "'" + ", [avatar] = " + avatar + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string fullName, string email, string username, string password, string phoneNumber) { con = new Connections(); string queryStr = "UPDATE [dbo].[Professors] SET [FullName] = N'" + fullName + "'" + ", [Email] = '" + email + "'" + ", [Username] = '" + username + "'" + ", [Password] = '" + password + "'" + ", [PhoneNumber] = '" + phoneNumber + "'" + " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Update(int id, string name, DateTime startDate, DateTime endDate) { con = new Connections(); string queryStr = "UPDATE [dbo].[Project] SET [Name] = N'" + name + "', "; if (startDate != null && endDate != null) { queryStr += "[StartDate] = CONVERT(datetime, '" + startDate + "', 103), [EndDate] = CONVERT(datetime, '" + endDate + "', 103) "; } else if (startDate != null && endDate == null) { queryStr += "[StartDate] = CONVERT(datetime, '" + startDate + "', 103) "; } else if (startDate == null && endDate != null) { queryStr += "[EndDate] = CONVERT(datetime, '" + endDate + "', 103) "; } queryStr += " WHERE Id = " + id; con.ExecuteNonQuery(queryStr); con.CloseConnection(); }
public static void Close() { con.CloseConnection(); }