public async Task <IActionResult> PutLectures(int id, Lectures lectures)
        {
            if (id != lectures.Id)
            {
                return(BadRequest());
            }

            _context.Entry(lectures).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LecturesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Department;
         hashCode = (hashCode * 397) ^ (Specialty != null ? Specialty.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)EducationForm;
         hashCode = (hashCode * 397) ^ Course;
         hashCode = (hashCode * 397) ^ Semester;
         hashCode = (hashCode * 397) ^ НедельВСем;
         hashCode = (hashCode * 397) ^ (Flow != null ? Flow.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ GroupsCount;
         hashCode = (hashCode * 397) ^ SubgroupsCount;
         hashCode = (hashCode * 397) ^ ГруппВПотоке;
         hashCode = (hashCode * 397) ^ (Численность != null ? Численность.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Трудоемкость.GetHashCode();
         hashCode = (hashCode * 397) ^ ТрудоемкостьГода.GetHashCode();
         hashCode = (hashCode * 397) ^ (Lectures != null ? Lectures.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Laboratory != null ? Laboratory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Practical != null ? Practical.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Exam.GetHashCode();
         hashCode = (hashCode * 397) ^ Test.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)CourseDesigning;
         hashCode = (hashCode * 397) ^ (PlannedLoad != null ? PlannedLoad.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public async Task <ActionResult <Lectures> > PostLectures(Lectures lectures)
        {
            _context.Lectures.Add(lectures);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLectures", new { id = lectures.Id }, lectures));
        }
Exemplo n.º 4
0
 public void InsertLectures(Lectures lectures)
 {
     using (var cnn = OpenConnection())
     {
         var id = cnn.Insert(lectures);
     }
 }
Exemplo n.º 5
0
        // GET: Lectures/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Lectures lectures = db.Lectures.Find(id);

            if (lectures == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseID = new SelectList(db.Course, "CourseID", "CourseName", lectures.CourseID);
            //ViewBag.LecturerID = new SelectList(db.LecturerPerson, "LecturerID", "Name", lectures.LecturerID);
            //dohvaćanje imena i prezimena predavača
            ViewData["LecturerID"] =
                new SelectList((from s in db.LecturerPerson
                                select new
            {
                LecturerID = s.LecturerID,
                FullName = s.Name + " " + s.Surname
            }),
                               "LecturerID", "FullName", lectures.CourseID);
            return(View(lectures));
        }
Exemplo n.º 6
0
        private void btn_lectures_nav(object sender, EventArgs e)
        {
            this.Hide();
            Lectures f2 = new Lectures();

            f2.Show();
        }
Exemplo n.º 7
0
        public ActionResult DeleteConfirmed(int id)
        {
            Lectures lectures = db.Lectures.Find(id);

            db.Lectures.Remove(lectures);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
 public void UpdateLectures(Lectures lec)
 {
     using (var cnn = OpenConnection())
     {
         cnn.Update(lec);
         //cnn.Execute("update Table set val = @val where Id = @id", new { val, id = 1 });
     }
 }
Exemplo n.º 9
0
        public void DeleteLection(Lectures lectures)
        {
            using var context = new LmPlatformModelsContext();
            var model = context.Set <Lectures>().FirstOrDefault(e => e.Id == lectures.Id);

            context.Delete(model);

            context.SaveChanges();
        }
Exemplo n.º 10
0
 protected bool Equals(Load load)
 {
     return(Id == load.Id && Lectures.Equals(load.Lectures) && Laboratory.Equals(load.Laboratory) &&
            Practical.Equals(load.Practical) && Test.Equals(load.Test) &&
            Consultations.Equals(load.Consultations) && Exams.Equals(load.Exams) &&
            Nir.Equals(load.Nir) && CourseDesigning.Equals(load.CourseDesigning) &&
            Vkr.Equals(load.Vkr) && Gek.Equals(load.Gek) && Gak.Equals(load.Gak) &&
            Rma.Equals(load.Rma) && Rmp.Equals(load.Rmp));
 }
Exemplo n.º 11
0
 public int GetNextEmptyContentLectureCount(LectureVM lectureVM)
 {
     if (lectureVM.Contents.IsEmpty())
     {
         return(0);
     }
     return(Lectures.SkipWhile(l => l != lectureVM).Skip(1)
            .TakeWhile(l => l.Contents.IsEmpty()).Count());
 }
Exemplo n.º 12
0
        public Day(Days day)
        {
            Today = day;

            foreach (LectureTimes value in typeof(LectureTimes).GetEnumValues())
            {
                Lectures.Add(value, null);
            }
        }
Exemplo n.º 13
0
 public LecturesDataViewModel(Lectures lectures)
 {
     Theme       = lectures.Theme;
     LecturesId  = lectures.Id;
     Duration    = lectures.Duration;
     SubjectId   = lectures.SubjectId;
     Order       = lectures.Order;
     PathFile    = lectures.Attachments;
     Attachments = FilesManagementService.GetAttachments(lectures.Attachments);
 }
Exemplo n.º 14
0
        public IActionResult Lectures_Create(IFormCollection collection)
        {
            Lectures lectures = new Lectures();

            lectures.Name        = collection["Name"];
            lectures.Description = collection["Description"];
            db.Lectures.Add(lectures);
            db.SaveChanges();

            return(Redirect("Admin/Lectures"));
        }
Exemplo n.º 15
0
 public ActionResult Edit([Bind(Include = "LecturesID,LecturerID,CourseID,LectureDate,LectureStart,LectureEnd,LectureText")] Lectures lectures)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lectures).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseID   = new SelectList(db.Course, "CourseID", "CourseName", lectures.CourseID);
     ViewBag.LecturerID = new SelectList(db.LecturerPerson, "LecturerID", "Name", lectures.LecturerID);
     return(View(lectures));
 }
Exemplo n.º 16
0
        public void Add(Lecture lecture)
        {
            Lectures.Add(lecture);
            if (!UniqueGroups.Contains(lecture.Audience))
            {
                UniqueGroups.Add(lecture.Audience);
            }

            if (!UniqueTeachers.Contains(lecture.Lecturer))
            {
                UniqueTeachers.Add(lecture.Lecturer);
            }
        }
Exemplo n.º 17
0
        // GET: Lectures/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Lectures lectures = db.Lectures.Find(id);

            if (lectures == null)
            {
                return(HttpNotFound());
            }
            return(View(lectures));
        }
Exemplo n.º 18
0
        public ActionResult AddLecture(string LectureName, string LectureTerm, string LectureCredit, int DeptID)
        {
            Lectures new_lec = new Lectures();

            new_lec.LectureName = LectureName;
            new_lec.LectureTerm = LectureTerm;
            new_lec.LecAKTS     = LectureCredit;
            new_lec.DeptID      = DeptID;

            db.Lectures.Add(new_lec);
            db.SaveChanges();

            return(RedirectToAction("AddLecture", "Lecture"));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Возвращает таблицу вопросов по заданному номеру лекции
        /// </summary>
        /// <param name="LectureNum">Номер лекции</param>
        /// <returns></returns>
        public Hashtable GetTaskList(int LectureNum)
        {
            int          LectureID    = GetLectureID(LectureNum);
            Lectures     Lecture      = GetLectureFromCourse(LectureID);
            List <Tasks> LectureTasks = GetTasksFromLecture(Lecture.TasksRaw);

            Hashtable TaskList = new Hashtable();

            foreach (var item in LectureTasks)
            {
                TaskList.Add(item.TID, item.TaskText);
            }

            return(TaskList);
        }
Exemplo n.º 20
0
    public int AddStudent(Lectures l)
    {
        SqlConnection conn = connect.GetConnnect();
        string        q    = "INSERT INTO Lectures (LectureName,LectureDescription,PictureUri,course_id,instructor_name) OUTPUT Inserted.Id VALUES(@n,@c,@p,@i,@in)";
        SqlCommand    cmd  = new SqlCommand(q, conn);

        conn.Open();

        cmd.Parameters.AddWithValue("@n", l.LectureName);
        cmd.Parameters.AddWithValue("@c", l.LectureDescription);
        cmd.Parameters.AddWithValue("@i", l.instructor);
        cmd.Parameters.AddWithValue("@p", l.PictureUri);
        cmd.Parameters.AddWithValue("@in", l.instructor_name);
        return(int.Parse(cmd.ExecuteScalar().ToString()));
    }
Exemplo n.º 21
0
        public Lectures Map(LecturesForm form)
        {
            string ss  = Staticcl.S;
            var    lec = new Lectures
            {
                Vtitle       = form.Title,
                Vdescription = form.Description,
                Date         = DateTime.Now,

                Vlocation = ss,
                Vstatus   = 10
            };

            return(lec);
        }
Exemplo n.º 22
0
        private Lectures GetLectureFromCourse(int LectureID)
        {
            string pattern = @"(?<lid>";

            pattern += LectureID.ToString();
            pattern += @")\s=>\s(?<tasks>\[.*?(?:\],){7})";

            Match lectures = Regex.Match(_courseFileText, pattern, RegexOptions.Singleline);

            Lectures CurrentLecture = new Lectures();

            CurrentLecture.LID      = Convert.ToInt32(lectures.Groups["lid"].Value);
            CurrentLecture.TasksRaw = lectures.Groups["tasks"].Value;

            return(CurrentLecture);
        }
Exemplo n.º 23
0
    public void UpdateStudent(Lectures l)
    {
        SqlConnection conn = connect.GetConnnect();
        string        q    = "UPDATE Lectures SET LectureName=@n,LectureDescription=@c,PictureUri=@p,course_id=@i,instructor_name=@in WHERE Id=@id";
        SqlCommand    cmd  = new SqlCommand(q, conn);

        conn.Open();

        cmd.Parameters.AddWithValue("@n", l.LectureName);
        cmd.Parameters.AddWithValue("@c", l.LectureDescription);
        cmd.Parameters.AddWithValue("@i", l.instructor);
        cmd.Parameters.AddWithValue("@p", l.PictureUri);
        cmd.Parameters.AddWithValue("@id", l.Id);
        cmd.Parameters.AddWithValue("@in", l.instructor_name);
        cmd.ExecuteNonQuery();
        conn.Close();
    }
Exemplo n.º 24
0
        public Lecture AddLecture(
            DayOfWeek dayOfWeek,
            DateTime startTime,
            DateTime endTime,
            LectureTheatre theatre)
        {
            var lecture = new Lecture(
                Id,
                theatre.Id,
                dayOfWeek,
                startTime,
                endTime);

            Lectures.Add(lecture);

            return(lecture);
        }
Exemplo n.º 25
0
        public IActionResult Post([FromBody] LectureViewModel obj)
        {
            DigitalBoardMarkerContext db = new DigitalBoardMarkerContext();
            Lectures l = new Lectures();

            if (!db.Courses.Any(b => b.Id == obj.courseId))
            {
                ModelState.AddModelError("", "Course with course id doesn't exist");
                return(BadRequest(ModelState));
            }

            l.CourseId = obj.courseId;
            l.Name     = obj.Name;
            db.Add(l);
            db.SaveChanges();
            return(Ok());
        }
        public void DeleteLection(Lectures lectures)
        {
            using var repositoriesContainer = new LmPlatformRepositoriesContainer();

            var lectModel =
                repositoriesContainer.LecturesRepository.GetBy(new Query <Lectures>(e => e.Id == lectures.Id));
            var deleteFiles =
                repositoriesContainer.AttachmentRepository.GetAll(
                    new Query <Attachment>(e => e.PathName == lectModel.Attachments)).ToList();

            foreach (var attachment in deleteFiles)
            {
                FilesManagementService.DeleteFileAttachment(attachment);
            }

            repositoriesContainer.SubjectRepository.DeleteLection(lectures);
            repositoriesContainer.ApplyChanges();
        }
Exemplo n.º 27
0
            protected override string RunInBackground(params string[] @params)
            {
                string      url      = @params[0];
                HttpHandler http     = new HttpHandler();
                Lectures    lectures = new Lectures();

                lectures.course   = course;
                lectures.lecturer = lecturer;
                lectures.title    = title;
                lectures.vidurl   = vidurl;
                lectures.notename = notename;
                lectures.vidname  = vidname;
                lectures.noteurl  = noteurl;
                string json = JsonConvert.SerializeObject(lectures);

                http.PostHttpData(url, json);
                return(string.Empty);
            }
        public void OnItemClick(AdapterView parent, View view, int position, long id)
        {
            lectureselected = lectureslistss[position];
            positions.Add(position);
            var    t      = lectureselected.title.ToString();
            var    vurl   = lectureselected.vidurl.ToString();
            var    nurl   = lectureselected.noteurl.ToString();
            var    vname  = lectureselected.vidname.ToString();
            var    nname  = lectureselected.notename.ToString();
            Intent intent = new Intent(this, typeof(QuestionsActivity));

            intent.PutExtra("course", cours);
            intent.PutExtra("title", t);


            StartActivity(intent);
            Android.Widget.Toast.MakeText(this, t, Android.Widget.ToastLength.Short).Show();
        }
        public Lectures SaveLectures(Lectures lectures, IList <Attachment> attachments, int userId)
        {
            using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
            {
                if (!string.IsNullOrEmpty(lectures.Attachments))
                {
                    var deleteFiles =
                        repositoriesContainer.AttachmentRepository.GetAll(
                            new Query <Attachment>(e => e.PathName == lectures.Attachments)).ToList()
                        .Where(e => attachments.All(x => x.Id != e.Id)).ToList();

                    foreach (var attachment in deleteFiles)
                    {
                        FilesManagementService.DeleteFileAttachment(attachment);
                    }
                }
                else
                {
                    lectures.Attachments = GetGuidFileName();
                }

                FilesManagementService.SaveFiles(attachments.Where(e => e.Id == 0), lectures.Attachments);

                foreach (var attachment in attachments)
                {
                    if (attachment.Id == 0)
                    {
                        attachment.PathName = lectures.Attachments;
                        repositoriesContainer.AttachmentRepository.Save(attachment);
                    }
                }

                repositoriesContainer.LecturesRepository.Save(lectures);
                repositoriesContainer.ApplyChanges();

                if (lectures.IsNew &&
                    lectures.Subject.SubjectModules.Any(s => s.Module.ModuleType == ModuleType.Lectures))
                {
                    ConceptManagementService.AttachFolderToLectSection(lectures.Theme, userId, lectures.SubjectId);
                }
            }

            return(lectures);
        }
    static void Main(string[] args)
    {
        var lectures = int.Parse(Console.ReadLine().Substring(9));

        List <Lectures> lectureses = new List <Lectures>();

        for (int i = 0; i < lectures; i++)
        {
            var lectureInput = Console.ReadLine().Split(':');
            var lectureName  = lectureInput[0];

            var lectureTime = lectureInput[1].Split(new string[] { " - " }, StringSplitOptions.RemoveEmptyEntries)
                              .Select(e => int.Parse(e)).ToArray();

            var start = lectureTime[0];
            var end   = lectureTime[1];

            Lectures newLectures = new Lectures(lectureName, start, end);
            lectureses.Add(newLectures);
        }

        lectureses.Sort();
        var schedule = new List <Lectures>();

        schedule.Add(lectureses.First());

        var currentEndTime = lectureses.First().End;

        foreach (var lecture in lectureses)
        {
            if (currentEndTime <= lecture.Start)
            {
                schedule.Add(lecture);
                currentEndTime = lecture.End;
            }
        }

        Console.WriteLine($"Lectures ({schedule.Count}):");
        foreach (var lecture in schedule)
        {
            Console.WriteLine(lecture);
        }
    }
Exemplo n.º 31
0
        private Lectures GetLectureFromCourse(int LectureID)
        {
            string pattern = @"(?<lid>";
            pattern += LectureID.ToString();
            pattern += @")\s=>\s(?<tasks>\[.*?(?:\],){7})";

            Match lectures = Regex.Match(_courseFileText, pattern, RegexOptions.Singleline);

            Lectures CurrentLecture = new Lectures();

            CurrentLecture.LID = Convert.ToInt32(lectures.Groups["lid"].Value);
            CurrentLecture.TasksRaw = lectures.Groups["tasks"].Value;

            return CurrentLecture;
        }