コード例 #1
0
        public static decimal SaveExpressOrder(decimal studentId)
        {
            var nextContactDate = DateTime.Now;

            if (nextContactDate.Hour >= 18)
            {
                nextContactDate = nextContactDate.Date.AddDays(1);
            }
            var studentInGroup =
                new StudentInGroup
            {
                Student_ID      = studentId,
                InputSource_TC  = GetInputSource(),
                Group_ID        = Groups.NotChoiceGroupID,
                BerthType_TC    = BerthTypes.NotPaid,
                Employee_TC     = Employees.Specweb,
                InputDate       = DateTime.Now,
                Debt            = 100,
                NextContactDate = nextContactDate,
                PriceType_TC    = PriceTypes.PrivatePersonWeekend,
                PresenceType_TC = PresenceTypes.Intramural,
                IsExpressOrder  = true,
            };
            var studentRepository = new Repository <StudentInGroup>(
                new SpecialistContextProvider());

            studentRepository.InsertAndSubmit(studentInGroup);
            return(studentInGroup.StudentInGroup_ID);
        }
コード例 #2
0
        public ActionResult Delete(int id)
        {
            StudentInGroup studentGroupsStaff = db.StudentsInGroups.Find(id);
            int?           studentGroupId     = studentGroupsStaff.StudentGroupId;

            db.StudentsInGroups.Remove(studentGroupsStaff);
            db.SaveChanges();
            return(RedirectToAction("Edit/" + studentGroupId, "StudentGroups"));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "EmployeeId, StudentGroupId, OrganisationId")] StudentInGroup studentGroupsStaff)
        {
            if (ModelState.IsValid)
            {
                db.StudentsInGroups.Add(studentGroupsStaff);
                db.SaveChanges();
                return(RedirectToAction("Edit/" + studentGroupsStaff.StudentGroupId, "StudentGroups"));
            }


            return(View(studentGroupsStaff));
        }
コード例 #4
0
        private static VendorEngCertData GetVendorRuCertData(StudentInGroup sig, bool hd, int ruCertId)
        {
            var data = new VendorEngCertData(
                hd,
                ruCertId,
                sig.Student.FullName,
                sig.Group.Course.NameOfficial,
                sig.Group.DateEnd.GetValueOrDefault(),
                sig.Group.Teacher.GetOrDefault(x => x.FullName));

            return(data);
        }
コード例 #5
0
 private void AddSource(Entities.Context.Order order, StudentInGroup studentInGroup)
 {
     if (order.User.Source_ID.HasValue)
     {
         studentInGroup.StudentInGroupSources.Add(
             new StudentInGroupSource {
             Source_ID      = order.User.Source_ID.Value,
             InputDate      = DateTime.Now,
             Employee_TC    = Employees.Specweb,
             LastChangeDate = DateTime.Now,
             LastChanger_TC = Employees.Specweb
         });
     }
 }
コード例 #6
0
        private static void GenerateRuCert(StudentInGroup sig, bool hd, int ruCertId)
        {
            var sigId    = sig.StudentInGroup_ID;
            var data     = GetVendorRuCertData(sig, hd, ruCertId);
            var certTemp = VendorEngCertData.WithOrgs.Contains(ruCertId)
                                ? ruCertId * 10 + OurOrgs.CertTypes.GetValueOrDefault(sig.OurOrg_TC)
                                : ruCertId;
            var vendor = ruCertId != VendorEngCertData.mainRu;
            var ru     = true;

            using (var image = Image.FromFile(UserImages.GetGroupCertEngFileSys(certTemp, hd, vendor, ru))) {
                var file = UserImages.GetGroupCertEngFileSys(sigId, hd, vendor, ru);
                ImageUtils.RenderVendorEngCertTexts(image, data).Save(file);
            }
        }
コード例 #7
0
        // GET: StudentGroups/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            StudentInGroup studentGroupsStaff = db.StudentsInGroups.Find(id);

            if (studentGroupsStaff == null)
            {
                return(HttpNotFound());
            }
            return(View(studentGroupsStaff));
        }
コード例 #8
0
        public ActionResult Create()
        {
            StudentInGroup studentGroupsStaff = new StudentInGroup();

            if (TempData["studentGroupId"] != null)
            {
                studentGroupsStaff.StudentGroupId = Convert.ToInt32(TempData["studentGroupId"]);
                int studentGroupTeacherId = Convert.ToInt32(TempData["studentGroupTeacherId"]);
                //Организации, привязанные к преподу
                ViewBag.Organisations = new SelectList(db.Organisations.Where(x => x.TeacherID == studentGroupTeacherId), "Id", "Name");
                //Сотрудники, которые есть в организации
                ViewBag.studentGroupId = Convert.ToInt32(TempData["studentGroupId"]);
            }

            return(View(studentGroupsStaff));
        }
コード例 #9
0
        private int GetEngCertVendroType(StudentInGroup sig)
        {
            if (sig.Group.Course.IsMs)
            {
                return(VendorEngCertData.microsoftCert);
            }
            if (sig.Group.Course.AuthorizationType_TC == AuthorizationTypes.Adobe)
            {
                return(VendorEngCertData.adobeCert);
            }
            if (sig.Group.Course.AuthorizationType_TC == AuthorizationTypes.Graphisoft)
            {
                return(VendorEngCertData.graphisoft);
            }

            return(0);
        }
コード例 #10
0
        private static VendorEngCertData GetVendorCertData(StudentInGroup sig, bool hd, int vendorCerType, string fullName)
        {
            var employee = sig.Group.Teacher;
            var empName  = employee != null
                                ? employee.FirstNameEN + " " + employee.LastNameEN
                                : null;
            var data = new VendorEngCertData(
                hd,
                vendorCerType,
                fullName,
                sig.Group.Course.NameOfficialEn,
                sig.Group.DateEnd.GetValueOrDefault(),
                empName);


            return(data);
        }
コード例 #11
0
        public StudentInGroupView(StudentInGroup st)
        {
            id          = st.id;
            student_id  = st.student_id;
            fio         = st.f + " " + st.i + " " + st.o;
            zach_number = st.zach_number;
            birth_date  = st.birth_date.ToShortDateString();
            address     = st.address;
            phone       = st.phone;
            orders      = st.orders;
            starosta    = st.starosta == "1";
            n_factor    = st.n_factor == "1";
            paid_edu    = st.paid_edu == "1";
            expelled    = st.expelled == "1";
            from        = st.from;
            to          = st.to;

            summary = fio + " " + " (" + (expelled ? "+" : "-") + zach_number + ")";
        }
コード例 #12
0
        private static Tuple <bool, bool, bool> GetHideVideo(StudentInGroup studentInGroup, List <StudentInGroupLecture> sglList, Group group)
        {
//		    return Tuple.Create(false, false);
            var isUnlimit      = studentInGroup.GetOrDefault(x => x.IsUnlimit);
            var hideForUnlimit = isUnlimit;
            var hideVideo      = true;
            var isIntraExtra   = group.IsIntraExtramural;
            var canAccessVideo = false;

            if (studentInGroup != null &&
                sglList.Any() &&
                (isIntraExtra ||
                 studentInGroup.Group.IsOpenLearning ||
                 isUnlimit ||
                 PriceTypes.IsWebinar(studentInGroup.PriceType_TC)))
            {
                canAccessVideo = true;
                var firstLecture = sglList.First();
                if (isIntraExtra && sglList.Count == 1)
                {
                    hideVideo = false;
                }
                else if (firstLecture.Lecture.LectureDateBeg <= DateTime.Now)
                {
                    var firstLectureIsVisited = !firstLecture.Truancy.GetValueOrDefault();
                    if (isUnlimit)
                    {
                        hideForUnlimit = !(firstLecture.IsRecognized.GetValueOrDefault() &&
                                           firstLectureIsVisited);
                        hideVideo = hideForUnlimit;
                    }
                    else if (isIntraExtra)
                    {
                        hideVideo = !firstLectureIsVisited;
                    }
                    else
                    {
                        hideVideo = false;
                    }
                }
            }
            return(Tuple.Create(hideVideo, hideForUnlimit, canAccessVideo));
        }
コード例 #13
0
        public Tuple <bool, StudentInGroup> CreateOrExists(decimal sigId)
        {
            if (CheckTemplateFile(sigId))
            {
                return(Tuple.Create(false, (StudentInGroup)null));
            }
            var            fileSys = UserImages.GetGroupCertFileSys(sigId);
            StudentInGroup sig     = null;

            if (!System.IO.File.Exists(fileSys))
            {
                sig = GetFullSig(sigId);
                if (sig == null)
                {
                    return(Tuple.Create(false, sig));
                }

                if (BerthTypes.AllForCert.Contains(sig.BerthType_TC) && sig.Group.IsFinished)
                {
                    var cert = CertificateService.GetAll(x => x.StudentInGroup_ID == sigId)
                               .OrderByDescending(x => x.ForPrint).ThenByDescending(x => x.Certificate_ID)
                               .FirstOrDefault();
                    if (cert == null)
                    {
                        return(Tuple.Create(false, sig));
                    }
                    Func <DateTime, string> format = x => "{0} {1} {2} г.".FormatWith(x.Day,
                                                                                      MonthUtil.GetName(x.Month, true), x.Year);
                    var orgName      = OurOrgs.Names.GetValueOrDefault(cert.OurOrg_TC) ?? OurOrgs.RuName;
                    var certTemplate = GetCertTemplate(cert);
                    if (certTemplate < 0)
                    {
                        return(Tuple.Create(false, sig));
                    }
                    using (var image = Image.FromFile(UserImages.GetGroupCertFileSys(certTemplate))) {
                        if (cert.CertType_TC == CertTypes.OldCert)
                        {
                            var date = "c {0} по {1}".FormatWith(format(cert.DateBeg.GetValueOrDefault()),
                                                                 format(cert.DateEnd.GetValueOrDefault()));
                            ImageUtils.DrawGroupCertText(image,
                                                         sig.Student.FullName,
                                                         cert.CourseFullName,
                                                         cert.Hours,
                                                         date, cert.FullNumber, sig.Student.Sex, orgName).Save(fileSys);
                        }
                        else
                        {
                            var date = format(cert.DateEnd.GetValueOrDefault());
                            ImageUtils.DrawGroupCertText2016(image,
                                                             sig.Student.FullName,
                                                             cert.CourseFullName,
                                                             cert.Hours,
                                                             date, cert.FullNumber, sig.Student.Sex, orgName, cert.CertType_TC == CertTypes.Y16).Save(fileSys);
                        }
                    }
                }
                else
                {
                    return(Tuple.Create(false, sig));
                }
            }
            return(Tuple.Create(true, sig));
        }
コード例 #14
0
        public void Export(Entities.Context.Order order, bool checkIfExists)
        {
            var alreadyInGroups = new List <decimal>();
            var groups          = order.OrderDetails.Where(x => x.Group_ID.HasValue)
                                  .Select(x => new { Group_ID = x.Group_ID.Value, x.PriceType_TC }).ToList();

            if (checkIfExists && order.User.Student_ID.HasValue && groups.Any())
            {
                alreadyInGroups = StudentInGroupService.GetAll(x =>
                                                               x.Student_ID == order.User.Student_ID.Value &&
                                                               groups.Contains(new { x.Group_ID, x.PriceType_TC })).Select(x => x.Group_ID).ToList();
            }
            var student     = GetOrInsertStudentByUser(order.User, order.OrderID.ToString());
            var berthTypeTC = BerthTypes.NotPaid;
            var studentInGroupRepository = new Repository <StudentInGroup>(
                new SpecialistContextProvider());
            var nextContactDate = DateTime.Today.AddDays(1);

            if (order.OrderDetails.Any(x =>
                                       x.Group.GetOrDefault(g => g.DateBeg) == DateTime.Today))
            {
                nextContactDate = DateTime.Today;
            }
            var addEduDocs = false;

            foreach (var orderDetail in order.OrderDetails.Where(x =>
                                                                 !alreadyInGroups.Contains(x.Group_ID.GetValueOrDefault())))
            {
                if (!orderDetail.IsTestCert)
                {
                    addEduDocs = true;
                }
                var discount = orderDetail.GetAllDiscountsInPercent();

                string presenceTypeTC;
                if (PriceTypes.IsDistance(orderDetail.PriceType_TC))
                {
                    presenceTypeTC = PresenceTypes.Distance;
                }
                else if (PriceTypes.Webinars.Contains(orderDetail.PriceType_TC))
                {
                    presenceTypeTC = PresenceTypes.Webinar;
                }
                else
                {
                    presenceTypeTC = PresenceTypes.Intramural;
                }

                var courseOrderMangerTC = orderDetail.IsTestCert
                                        ? Employees.TestCert
                                        : Employees.Site;

                var isFree = orderDetail.Price == 0;
                var reason = orderDetail.ReasonForLearning;
                if (orderDetail.IsTestCert)
                {
                    reason = LearningReasons.Testing;
                }
                else if (!(orderDetail.IsTrack ||
                           orderDetail.Course.GetOrDefault(x => x.FullHours >= CommonConst.LongCourseHours)))
                {
                    reason = LearningReasons.Comprehensive;
                }



                var studentInGroup =
                    new StudentInGroup
                {
                    Student_ID        = student.Student_ID,
                    Group_ID          = orderDetail.CalcGroupId,
                    InputSource_TC    = GetInputSource(),
                    PriceType_TC      = orderDetail.PriceType_TC,
                    Discount          = Math.Round(discount),
                    BerthType_TC      = berthTypeTC,
                    Track_TC          = orderDetail.Track_TC,
                    SeatNumber        = orderDetail.SeatNumber,
                    Employee_TC       = Employees.Site,
                    InputDate         = DateTime.Now,
                    FavoriteTeacher1  = orderDetail.IsCourseOrder ? order.FavoriteTeacher1 : null,
                    Debt              = 100,
                    NextContactDate   = nextContactDate,
                    Consultant_TC     = courseOrderMangerTC,
                    Router_TC         = courseOrderMangerTC,
                    PresenceType_TC   = presenceTypeTC,
                    ReasonForLearning = reason,
                    PromoCode         = orderDetail.Order.PromoCode,
                    Charge            = orderDetail.PriceWithDiscount,
                    IsHungry          = PriceTypes.IsBusiness(
                        orderDetail.PriceType_TC)
                };
                ;
                if (IsPreTestPass(orderDetail))
                {
                    studentInGroup.IsEntryTestPassed = true;
                }
                if (isFree)
                {
                    studentInGroup.Debt            = 0;
                    studentInGroup.BerthType_TC    = BerthTypes.Kons;
                    studentInGroup.NextContactDate = null;
                }
                AddSource(order, studentInGroup);
                foreach (var extras in orderDetail.OrderExtras)
                {
                    studentInGroup.StudentInGroupExtras.Add(
                        new StudentInGroupExtras {
                        Extras_ID      = extras.Extras_ID,
                        StudentInGroup = studentInGroup
                    });
                }
                studentInGroupRepository.InsertAndSubmit(studentInGroup);
                orderDetail.StudentInGroup_ID = studentInGroup.StudentInGroup_ID;
            }


            foreach (var orderExam in order.OrderExams)
            {
                decimal groupID = Groups.NotChoiceGroupID;
                if (orderExam.Group_ID.HasValue)
                {
                    groupID = orderExam.Group_ID.Value;
                }
                var studentInGroup =
                    new StudentInGroup
                {
                    Student_ID        = student.Student_ID,
                    Group_ID          = groupID,
                    PriceType_TC      = PriceTypes.PrivatePersonWeekend,
                    BerthType_TC      = berthTypeTC,
                    Employee_TC       = Employees.Site,
                    InputDate         = DateTime.Now,
                    InputSource_TC    = GetInputSource(),
                    Debt              = 100,
                    ReasonForLearning = LearningReasons.Exam,
                    Exam_ID           = orderExam.Exam_ID,
                    NextContactDate   = nextContactDate,
                    Charge            = orderExam.Price,
                    PresenceType_TC   = PresenceTypes.Intramural,
                };
                AddSource(order, studentInGroup);
                studentInGroupRepository.InsertAndSubmit(studentInGroup);
                orderExam.StudentInGroup_ID = studentInGroup.StudentInGroup_ID;
            }

            if (addEduDocs)
            {
                new PioneerDataContext().uspAutoEntryPersonalRecords(student.Student_ID,
                                                                     order.EduDocTypeTC);
            }
        }
コード例 #15
0
        private GroupVM.ProgressVM GetProgress(List <Lecture> lectures, Group @group, StudentInGroup studentInGroup)
        {
            if (studentInGroup == null || @group.IsDpCons)
            {
                return(null);
            }
            var courseCurrentHours = 0.0;
            var courseTotalHours   = 0.0;
            var trackProgress      = 0;

            if (lectures.Any())
            {
                var totalCount = lectures.Count;
                courseCurrentHours = lectures.Where(x => x.LectureDateEnd <= DateTime.Now)
                                     .Sum(x => x.Hours);
                courseTotalHours = lectures.Sum(x => x.Hours);
                var courseTc = @group.Course_TC;
                if (studentInGroup.Track_TC != null)
                {
                    var courses = CourseService.GetTrackCourses().GetValueOrDefault(studentInGroup.Track_TC);
                    if (courses != null)
                    {
                        var index = courses.IndexOf(courseTc);
                        if (index >= 0)
                        {
                            trackProgress = (100 * index + (int)(100 * courseCurrentHours / courseTotalHours)) / courses.Count;
                        }
                    }
                }
            }
            var ahCoef = 4.0 / 3;

            return(new GroupVM.ProgressVM {
                CourseTotalHours = (int)(courseTotalHours * ahCoef),
                CourseCurrentHours = (int)(courseCurrentHours * ahCoef),
                Track = trackProgress,
                TrackName = studentInGroup.Track_TC.GetOrDefault(x =>
                                                                 CourseService.AllCourseLinks()[x.Trim()].WebName)
            });
        }
コード例 #16
0
 private static List <StudentInGroupLecture> GetSqlList(StudentInGroup studentInGroup)
 {
     return(studentInGroup.StudentInGroupLectures.OrderBy(x => x.Lecture.LectureDateBeg).ToList());
 }
コード例 #17
0
        public string CreateOrExistsEng(decimal sigId, StudentInGroup sig, bool hd = false)
        {
            var fileSys = UserImages.GetGroupCertEngFileSys(sigId, hd, false, false);

            if (!System.IO.File.Exists(fileSys))
            {
                sig = sig ?? GetFullSig(sigId);
                if (sig == null)
                {
                    return("");
                }
                var finalMark = (sig.CertGiven || FinalExamMarks.MOCert.Contains(sig.FinalExamMark_TC));
                var berthType = BerthTypes.AllForCert.Contains(sig.BerthType_TC);
                var authType  = (sig.Group.Course_TC == CourseTC.Itil ||
                                 !AuthorizationTypes.WithoutMOCert.Contains(sig.Group.Course.AuthorizationType_TC));
                var engName    = !sig.Group.Course.NameOfficialEn.IsEmpty();
                var certExists = finalMark &&
                                 sig.Group.IsFinished &&
                                 berthType &&
                                 authType &&
                                 engName;
                if (!certExists)
                {
                    var errorTxt = "";
                    if (AuthService.CurrentUser != null && AuthService.CurrentUser.IsEmployee)
                    {
                        var errors = new List <string>();
                        if (!finalMark)
                        {
                            errors.Add("Не проставлено поле аттестации в карточке заказа");
                        }
                        if (!sig.Group.IsFinished)
                        {
                            errors.Add("Группа завершится " + sig.Group.DateEnd.DefaultString());
                        }
                        if (!berthType)
                        {
                            errors.Add("Тип оплаты " + sig.BerthType_TC);
                        }
                        if (!authType)
                        {
                            errors.Add("Авторизация " + sig.Group.Course.AuthorizationType_TC);
                        }
                        if (!engName)
                        {
                            errors.Add("Отсутствует название курса на английском " + sig.Group.Course.Course_TC);
                        }
                        errorTxt = errors.JoinWith("<br/>");
                    }
                    return("Сертификат недоступен<br/>" + errorTxt);
                }
                string fullName;
                if (sig.Student.FullNameEn.IsEmpty())
                {
                    var userIsStudent = AuthService.CurrentUser
                                        .GetOrDefault(x => x.Student_ID == sig.Student_ID);
                    if (userIsStudent)
                    {
                        fullName = AuthService.CurrentUser.EngFullName;
                    }
                    else
                    {
                        fullName = UserService.GetAll(x => x.Student_ID == sig.Student_ID)
                                   .OrderByDescending(x => x.UserID).Select(x => x.EngFullName).FirstOrDefault();
                    }
                }
                else
                {
                    fullName = sig.Student.FullNameEn;
                }


                GenerateRuCert(sig, hd, VendorEngCertData.mainRu);
                var ruCertId = VendorEngCertData.CourseRuCertVendor.GetValueOrDefault(sig.Group.Course.ParentCourse_TC);

                if (ruCertId > 0)
                {
                    GenerateRuCert(sig, hd, ruCertId);
                }



                if (String.IsNullOrWhiteSpace(fullName))
                {
                    var isOwner = AuthService.CurrentUser != null && AuthService.CurrentUser.Student_ID == sig.Student_ID;
                    return(isOwner ? "Сертификат недоступен, отсутствует информация о Фамилии/Имени на английском языке" : "");
                }

                var certType = GetEngCertType(sig.OurOrg_TC);
                using (var image = Image.FromFile(UserImages.GetGroupCertEngFileSys(certType, hd, false, false))) {
                    var data = GetVendorCertData(sig, hd, VendorEngCertData.main, fullName);

                    ImageUtils.RenderVendorEngCertTexts(image, data).Save(fileSys);
//						ImageUtils.DrawGroupCertEngTextOld(image,
//							fullName, sig.Group.Course.NameOfficialEn,
//							sig.Group.DateEnd.GetValueOrDefault().ToString("MMMM dd, yyyy", CultureInfo.InvariantCulture), hd).Save(fileSys);
                }
                var vendorCerType = GetEngCertVendroType(sig);
                if (vendorCerType > 0)
                {
                    using (var image = Image.FromFile(UserImages.GetGroupCertEngFileSys(vendorCerType, hd, true, false))) {
                        var data = GetVendorCertData(sig, hd, vendorCerType, fullName);
                        fileSys = UserImages.GetGroupCertEngFileSys(sigId, hd, true, false);
                        ImageUtils.RenderVendorEngCertTexts(image, data).Save(fileSys);
                    }
                }
            }
            return(null);
        }
コード例 #18
0
ファイル: GroupVM.cs プロジェクト: dKluev/Site
 public static bool CheckShowVideoAllConditions(bool hideForUnlimit, Group group, StudentInGroup sig)
 {
     return(!hideForUnlimit && (!group.WebinarRecordURL.IsEmpty() &&
                                sig != null &&
                                BerthTypes.AllPaidForCourses.Contains(sig.BerthType_TC)));
 }
コード例 #19
0
 public static ListRow FromSig(StudentInGroup sig)
 {
     return(new ListRow(sig.Group.Course_TC, 1, (int)sig.Charge, sig.Group.Course.Name));
 }
コード例 #20
0
        public GroupVM GetGroup(decimal groupID)
        {
            var group = GroupService.GetByPK(groupID);

            if (group == null)
            {
                return(null);
            }
            var            user           = AuthService.CurrentUser;
            var            sglList        = new List <StudentInGroupLecture>();
            StudentInGroup studentInGroup = null;

            if (user.GetOrDefault(x => x.IsStudent))
            {
                studentInGroup = GetSig(groupID);
                if (studentInGroup != null)
                {
                    sglList = GetSqlList(studentInGroup);
                }
            }



            var lectureOffset = 0;
            var lecturesGroup = group.IsOpenLearning
                        ? GroupService.GetByPK(group.MegaGroup_ID.Value) : group;
            var lectures   = lecturesGroup.Lectures.OrderBy(l => l.LectureDateBeg).ToList();
            var lecturesVM = lectures.Select(l => {
                var lectureHours = GetLectureHours(l);
                lectureOffset   += lectureHours;
                return(new GroupVM.LectureVM
                {
                    Lecture = l,
                    Contents = GetContent(group.Course, lectureOffset - lectureHours,
                                          lectureHours),
                    StudentLecture = sglList.FirstOrDefault(
                        sgl => sgl.Lecture_ID == l.Lecture_ID)
                });
            }).ToList();

            var groupFiles     = @group.GroupFiles.Select(g => g.UserFile).ToList();
            var groupUserFiles = groupFiles.Select(x => x.UserFileID);
            var fileList       = new FileListVM {
                Group     = group,
                Files     = groupFiles,
                UserFiles = FileVMService.GetUserFiles(null)
                            .Where(x => !groupUserFiles.Contains(x.UserFileID)).ToList()
            };
            var tests             = SiteObjectService.GetByRelationObject <Test>(group.Course).ToList();
            var testAfterComplete = new List <Test>();

            if (studentInGroup != null)
            {
                var isBegin = group.DateBeg.GetValueOrDefault() + group.TimeBeg.GetValueOrDefault().TimeOfDay <= DateTime.Now;
                if (group.Course_TC == CourseTC.DpCons && isBegin)
                {
                    testAfterComplete = TestService.CourseTests()
                                        .GetValueOrDefault(studentInGroup.Track_TC) ?? new List <Test>();
                }
                else
                {
                    testAfterComplete = TestService.CourseTests()
                                        .GetValueOrDefault(@group.Course_TC) ?? new List <Test>();
                }
            }
            var trainerUserId = group.Teacher.GetOrDefault(x =>
                                                           x.User.GetOrDefault(y => y.UserID));
            var trainerCourseInfo = UserCourseInfoService.FirstOrDefault(x =>
                                                                         x.UserID == trainerUserId && x.Course_TC == group.Course_TC)
                                    .GetOrDefault(x => x.Description);
            var sigId        = studentInGroup.GetOrDefault(x => x.StudentInGroup_ID);
            var IsCertExists = CertificateService.GetAll(x =>
                                                         x.StudentInGroup_ID == sigId).Any();
            var isUnlimit      = studentInGroup.GetOrDefault(x => x.IsUnlimit);
            var r              = GetHideVideo(studentInGroup, sglList, group);
            var hideVideo      = r.Item1;
            var hideForUnlimit = r.Item2;
            var canAccessVideo = r.Item3;


            return(new GroupVM
            {
                Group = group,
                TrainerCourseInfo = trainerCourseInfo,
                Lectures = lecturesVM,
                LastMessages = GetLastMessages(groupID),
                FileList = fileList,
                CanAccessVideo = canAccessVideo,
                Tests = tests,
                TestsAfterComplete = testAfterComplete,
                StudentInGroup = studentInGroup,
                IsCertExists = IsCertExists,
                User = user,
                HideForUnlimit = hideForUnlimit,
                HideVideo = hideVideo,
                IsUnlimit = isUnlimit,
                Progress = GetProgress(lectures, group, studentInGroup)
            });
        }