public void UpdateCourses() { // Courses c1 = new Courses(Session["IdCourse"].ToString()); string sql = " UPDATE DepartmentCourses SET [Mandatory] = '" + this.Mandatory + "' where [IdCourse]= '" + this.IdCourse + "'"; DBFunctions.ChangTable(sql); }
public bool DeleteCourse() { if (CheckExist()) { string x = "Delete From [DepartmentCourses] Where IdCourse='" + this.IdCourse + "'"; DBFunctions.ChangTable(x); return(true); } return(false); }
public bool DeleteCourseForStudent() { if (CheckExist()) { string x = "Delete From [StudentAtCourse] Where Id_Course='" + this.Id_Course + "' and Id_Student='" + this.Id_Student + "'"; DBFunctions.ChangTable(x); return(true); } return(false); }
public bool DeleteHotel() { if (CheckExist()) { string x = "Delete From [Courses] Where ID='" + this.ID + "'"; DBFunctions.ChangTable(x); return(true); } return(false); }
public bool DeleteCourseForLecture() { if (CheckExist()) { string x = "Delete From [LectureOfCourse] Where Id_Course='" + this.Id_Course + "' and Id_Lecture='" + this.Id_lecture + "'"; string s = "Update DepartmentCourses SET Lecture='' and LectureName='' where Id_Course='" + this.Id_Course + "'"; DBFunctions.ChangTable(x + s); return(true); } return(false); }
public bool insertCourseForStudent() { if (!CheckExist()) { string sql = " INSERT INTO [StudentAtCourse] ([Id_Course],[Id_Student])"; string sql2 = "VALUES ('" + this.Id_Course + "','" + this.Id_Student + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
public bool insertCourse() { if (!CheckExist()) { string sql = " INSERT INTO [Courses] ([ID],[Day],[Hour],[CourseName],[Credits],[Department],[Mandatory],[Year],[Semester])"; string sql2 = "VALUES ('" + this.ID + "','" + this.Day + "','" + this.Hour + "','" + this.CourseName + "','" + this.Credits + "','" + this.Department + "','" + this.Mandatory + "','" + this.Year + "','" + this.Semester + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
public bool insertCourseForLecture() { if (!CheckExist()) { string sql = " INSERT INTO [LectureOfCourse] ([Id_Course],[Id_Lecture])"; string sql2 = "VALUES ('" + this.Id_Course + "','" + this.Id_lecture + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
public bool insertCourse() { if (!CheckExist()) { string sql = " INSERT INTO [DepartmentCourses] ([Department],[Year],[Semster],[CourseName],[IdCourse],[Day],[HourStart],[HourEnd],[Credits],[Mandatory],[Lecture],[RegisteredStudents],[MaxStudent],[LectureName])"; string sql2 = "VALUES ('" + this.Department + "','" + this.Year + "','" + this.Semster + "','" + this.CourseName + "','" + this.IdCourse + "','" + this.Day + "','" + this.HourStart + "','" + this.HourEnd + "','" + this.Credits + "','" + this.Mandatory + "','" + this.Lecture + "','" + this.RegisteredStudents + "','" + this.MaxStudent + "','" + this.LectureName + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
public bool insertImage() { if (!checkIfImageExsist()) { string sql = " INSERT INTO [imges] ([imageName],[image])"; string sql2 = "VALUES ('" + this.imageName + "','" + this.imagel + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
public bool insertStuttr() { if (!checkIfStutterExsist()) { string sql = " INSERT INTO [Stutter] ([id],[name],[email],[Username],[Password])"; string sql2 = "VALUES ('" + this.id + "','" + this.name + "','" + this.email + "','" + this.Password + "','" + this.Username + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
public bool deleteStutter() { if (checkIfStutterExsist()) { string sql = "DELETE FROM Stutter WHERE id='" + this.id + "'"; DBFunctions.ChangTable(sql); return(true); } else { return(false); } }
public bool insertStudent() { if (!checkIfStudentExsist()) { string sql = " INSERT INTO [Students] ([ID],[Name],[LastName],[Year],[semester],[Department])"; string sql2 = "VALUES ('" + this.ID + "','" + this.Name + "','" + this.LastName + "','" + this.Year + "','" + this.semester + "','" + this.Department + "')"; DBFunctions.ChangTable(sql + sql2); return(true); } return(false); }
//==================== Helper Methods ====================// public bool IsCanDelete(string tableName, string id) { string sqlQuery = $"Select * from [{tableName}] Where id='{id}';"; DataTable dt = DBFunctions.SelectFromTable(sqlQuery); bool isCanDelete = dt.Rows.Count > 0; if (isCanDelete) { string deleteQuery = $"DELETE FROM [{tableName}] WHERE id='{id}';"; DBFunctions.ChangTable(deleteQuery); } return(isCanDelete); }
public void AddUserForDeleteTest(string tableName, string id) { string sqlQuery = $"Select * from [{tableName}] Where id='{id}';"; DataTable dt = DBFunctions.SelectFromTable(sqlQuery); bool isExist = dt.Rows.Count > 0; if (isExist) { return; } string addQuery = $"Insert Into [{tableName}] VALUES('{id}','user','*****@*****.**','user','123');"; DBFunctions.ChangTable(addQuery); }
//==================== Helper Methods ====================// public bool IsCanRegister(string tableName, string id, string userName, string password, string name, string email) { string sqlQuery = $"Select * from [{tableName}] Where Username='******' or email='{email}' or id='{id}';"; DataTable dt = DBFunctions.SelectFromTable(sqlQuery); bool isExist = dt.Rows.Count > 0; if (isExist) { return(false); } string addQuery = $"Insert Into [{tableName}] VALUES('{id}','{name}','{email}','{userName}','{password}');"; DBFunctions.ChangTable(addQuery); return(true); }
public bool IsCanUpdate(string tableName, string id, string userName, string password, string name, string email) { string sqlQuery = $"Select * from [{tableName}] Where id='{id}';"; DataTable dt = DBFunctions.SelectFromTable(sqlQuery); bool isExist = dt.Rows.Count > 0; if (!isExist) { return(false); } string addQuery = $"UPDATE [{tableName}] SET name='{name}', email='{email}', Username='******', Password='******' where id='{id}';"; DBFunctions.ChangTable(addQuery); return(true); }
public void updateStutter()//تحديث { string sq1 = "UPDATE Stutter SET [id]='" + this.id + "',[name]='" + this.name + "',[email]='" + this.email + "' WHERE [id]='" + this.id + "'"; DBFunctions.ChangTable(sq1); }
public void updateLectureName() { string sql = " UPDATE DepartmentCourses SET [LectureName] = '" + this.LectureName + "' where [IdCourse]= '" + this.IdCourse + "'"; DBFunctions.ChangTable(sql); }
public void updateDeaf()//تحديث { string sq1 = "UPDATE Deaf SET [name]='" + this.name + "',[email]='" + this.email + "',[Username]='" + this.Username + "',[Password]='" + this.Password + "' WHERE [id]='" + this.id + "'"; DBFunctions.ChangTable(sq1); }
public void UpdateRegisteringStud() { string sql = "UPDATE DepartmentCourses SET [RegisteredStudents] ='" + this.RegisteredStudents + "' where [IdCourse]= '" + this.IdCourse + "'"; DBFunctions.ChangTable(sql); }
public void UpdateRegisteringLecture() { string sql = "UPDATE DepartmentCourses SET [Lecture] ='" + this.Lecture + "'and [LectureName]='" + this.LectureName + "' where [IdCourse]= '" + this.IdCourse + "' and Department='" + this.Department + "'"; DBFunctions.ChangTable(sql); }