예제 #1
0
 public static string DeleteSubject(string SubjectID)
 {
     if (Convert.ToInt32(VideoBLL.GetTotalVideosCountInSubject(SubjectID)) > 0)
     {
         return("Subject Can't be deleted," + VideoBLL.GetTotalVideosCountInSubject(SubjectID) + " videos found in this Subject");
     }
     else
     {
         if ((int)SqlHelper.ExecuteNonQuery(SqlHelper.Connect, CommandType.Text, "delete from Subjects where  SubjectID=@Subjectid", new SqlParameter("@SubjectID", SubjectID)) > 0)
         {
             return("Subject Deleted Sucessfully!");
         }
         else
         {
             return("Subject not deleted!");
         }
     }
 }
예제 #2
0
        public static List<Subjects> GetAllSubjectsBySession()
        {
            DataTable dsSubjects = SqlHelper.ExecuteDataset(SqlHelper.Connect, CommandType.Text, "select subjects.*,classes.classname from subjects inner join Classes on Classes.ClassId=Subjects.ClassID where subjects.current_session=@Session order by Classid", new SqlParameter("@Session", VideoBLL.Session())).Tables[0];

            List<Subjects> subjectsList = new List<Subjects>();

            foreach (DataRow dr in dsSubjects.Rows)
            {
                Subjects subjectModel = new Subjects();
                subjectModel.SubjectID = dr["SubjectID"].ToString();
                subjectModel.SubjectName = dr["SubjectName"].ToString();
                subjectModel.ClassName = dr["ClassName"].ToString();
                subjectModel.ClassID = dr["ClassID"].ToString();
                subjectsList.Add(subjectModel);
            }

            return subjectsList;
        }