Ejemplo n.º 1
0
        public string PrepareSQLStringForInsertToDB()
        {
            string WhenDateForSqlString =
                !String.IsNullOrEmpty(WhenDate)
                ? "'" + (WhenDate.Substring(6, 4) + "-" + WhenDate.Substring(3, 2) + "-" + WhenDate.Substring(0, 2) + " 00:00:00'")
                : "null";
            string VoteForSqlString =
                !String.IsNullOrEmpty(Vote)
                ? Vote
                : "null";

            return("insert into ClassRoomTasks (WhenDate, Vote, TaskId, SubjectId) " +
                   $"values ({WhenDateForSqlString}, {VoteForSqlString}, " +
                   $"(select Id from ClassroomTaskTypes where Description = '{ClassRoomTaskType}')," +
                   $"(select Id from Subjects where Description = '{SubjectDescritpion}')) ");
        }
Ejemplo n.º 2
0
        public string PrepareSQLStringForUpdateToDB()
        {
            string WhenDateForSqlString =
                !String.IsNullOrEmpty(WhenDate)
                ? "'" + (WhenDate.Substring(6, 4) + "-" + WhenDate.Substring(3, 2) + "-" + WhenDate.Substring(0, 2) + " 00:00:00'")
                : "null";
            string VoteForSqlString =
                !String.IsNullOrEmpty(Vote)
                ? Vote
                : "null";

            return($"update ClassRoomTasks set WhenDate = {WhenDateForSqlString}, Vote = {VoteForSqlString}, " +
                   $"TaskId = (select Id from ClassroomTaskTypes where Description = '{ClassRoomTaskType}'), " +
                   $"SubjectId = (select Id from Subjects where Description = '{SubjectDescritpion}') " +
                   $"where Id = {Id} ");
        }