private void RefreshAvailableSubjects()
        {
            if (availableSubjects == null)
            {
                return;
            }
            // Process the situation when the Semester is not specified (see the Scenario 3 above)
            if (Semester == null)
            {
                ConstrainstParameter cpNHHK = Session.FindObject <ConstrainstParameter>(
                    new BinaryOperator("Code", "REGISTERSEMESTER"));
                Semester semester1 = Session.FindObject <Semester>(new BinaryOperator("SemesterName", cpNHHK.Value));
                // Show only Global Accessories when the Product is not specified

                availableSubjects.Criteria = new ContainsOperator("Lessons", new BinaryOperator("Semester", semester1));
            }
            else
            {
                // Leave only the current Product's Accessories in the availableAccessories collection
                availableSubjects.Criteria = new ContainsOperator("Lessons", new BinaryOperator("Semester", Semester));
            }
            // Set null for the Accessory property to allow an end-user
            //to set a new value from the refreshed data source
            Subject = null;
        }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ToolsRoundPanel.PreRender += new EventHandler(ToolsRoundPanel_PreRender);
        contextMenu  = new ContextActionsMenu(this, "Edit", "RecordEdit", "ObjectsCreation", "ListView", "Reports");
        Header.Title = WebApplication.Instance.Title;
        ObjectSpace          objectSpace = WebApplication.Instance.CreateObjectSpace();
        ConstrainstParameter cpNHHK      = objectSpace.FindObject <ConstrainstParameter>(
            new BinaryOperator("Code", "REGISTERSEMESTER"));

        if (cpNHHK == null || cpNHHK.Value == 0)
        {
            currentSemester.Text = "Chưa thiết lập NHHK hiện tại để ĐKMH";
        }
        else
        {
            try
            {
                currentSemester.Text = "NĂM HỌC " + cpNHHK.Value.ToString().Substring(0, 4) + " - HỌC KỲ " + cpNHHK.Value.ToString().Substring(4, 1);
            }
            catch {}
        }
        //Copyright.Text = GetApplicationInfoString();
        //LogoImage.ImageUrl = string.Format("~/App_Themes/{0}/Xaf/Logo.png", Theme);
        WebApplication.Instance.CreateControls(this);
    }
        private void FilterByUsersViewController_Activated(object sender, EventArgs e)
        {
            User u = (User)SecuritySystem.CurrentUser;

            if (u is Student)
            {
                Student student         = u as Student;
                bool    studentlistview = (View.ObjectTypeInfo.Type == typeof(RegisterDetail)) ||
                                          (View.ObjectTypeInfo.Type == typeof(StudentResult)) ||
                                          (View.ObjectTypeInfo.Type == typeof(StudentAccumulation)) ||
                                          (View.ObjectTypeInfo.Type == typeof(AccountTransaction));

                if ((View is ListView) && studentlistview)
                {
                    ((ListView)View).CollectionSource.Criteria["ByStudent"] = new BinaryOperator(
                        "Student.StudentCode", student.StudentCode, BinaryOperatorType.Equal);
                }
                if ((View is ListView) && (View.ObjectTypeInfo.Type == typeof(RegisterDetail)))
                {
                    ConstrainstParameter cpNHHK = View.ObjectSpace.FindObject <ConstrainstParameter>(
                        new BinaryOperator("Code", "REGISTERSEMESTER"));

                    if (cpNHHK == null || cpNHHK.Value == 0)
                    {
                        throw new UserFriendlyException("Người Quản trị chưa thiết lập NHHK để ĐKMH, vui lòng liên hệ quản trị viên.");
                    }
                    else
                    {
                        ((ListView)View).CollectionSource.Criteria[cpNHHK.Value.ToString()] = new BinaryOperator(
                            "Lesson.Semester.SemesterName", cpNHHK.Value, BinaryOperatorType.Greater);
                    }
                }

                if ((View is ListView) && (View.ObjectTypeInfo.Type == typeof(Student)))
                {
                    ((ListView)View).CollectionSource.Criteria["ByStudent"] = new BinaryOperator(
                        "StudentCode", student.StudentCode, BinaryOperatorType.Equal);
                }
                if ((View is ListView) && (View.ObjectTypeInfo.Type == typeof(User)))
                {
                    ((ListView)View).CollectionSource.Criteria["ByStudent"] = new BinaryOperator(
                        "Oid", student.Oid, BinaryOperatorType.Equal);
                }
                if ((View is ListView) && (View.ObjectTypeInfo.Type == typeof(WeekReportData)))
                {
                    ((ListView)View).CollectionSource.Criteria["ByStudent"] = new BinaryOperator(
                        "Name", student.StudentCode, BinaryOperatorType.Equal);
                }
            }
            else if (u.UserName == "guest")
            {
                if ((View is ListView) && (View.ObjectTypeInfo.Type == typeof(User)))
                {
                    ((ListView)View).CollectionSource.Criteria["ByStudent"] = new BinaryOperator(
                        "Oid", u.Oid, BinaryOperatorType.Equal);
                }
            }
        }
示例#4
0
        private void CalculateFeeForLesson_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ConstrainstParameter cp = View.ObjectSpace.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "TUITIONFEEPERCREDIT"));

            try
            {
                decimal fee = Convert.ToDecimal(cp.Value);

                foreach (Lesson lesson in ((ListView)View).SelectedObjects)
                {
                    View.ObjectSpace.SetModified(lesson);
                    lesson.TuitionFee = Convert.ToDecimal(lesson.Subject.Credit) * fee;
                }
                View.ObjectSpace.CommitChanges();
            }
            catch
            {
                throw new UserFriendlyException("Không có giá học phí mặc định cho 1 tín chỉ (TUITIONFEEPERCREDIT)");
            }
            PopUpMessage     ms;
            DialogController dc;
            ObjectSpace      objectSpace = Application.CreateObjectSpace();

            ms         = objectSpace.CreateObject <PopUpMessage>();
            ms.Title   = "Kết quả cập nhật";
            ms.Message = string.Format("Đã cập nhật học phí cho {0} nhóm lớp MH!", ((ListView)View).SelectedObjects.Count);
            e.ShowViewParameters.CreatedView = Application.CreateDetailView(
                objectSpace, ms);
            e.ShowViewParameters.TargetWindow        = TargetWindow.NewModalWindow;
            e.ShowViewParameters.CreatedView.Caption = "Thông báo";
            dc = Application.CreateController <DialogController>();
            dc.AcceptAction.Active.SetItemValue("object", false);
            dc.CancelAction.Caption = "Đóng";
            dc.SaveOnAccept         = false;
            e.ShowViewParameters.Controllers.Add(dc);
        }
        private void SelectRegister_Execute(object sender, SimpleActionExecuteEventArgs args)
        {
            ObjectSpace          objectSpace = Application.CreateObjectSpace();
            ConstrainstParameter cpNHHK      = objectSpace.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "REGISTERSEMESTER"));

            if (cpNHHK == null || cpNHHK.Value == 0 || cpNHHK.Value.ToString().Length != 5)
            {
                throw new UserFriendlyException("Người Quản trị chưa thiết lập NHHK để ĐKMH, vui lòng liên hệ quản trị viên.");
            }

            CriteriaOperatorCollection c = new CriteriaOperatorCollection();

            dicStudentRegDetail = new Dictionary <string, List <string> >();

            CollectionSource newCollectionSource = new CollectionSource(objectSpace, typeof(Lesson));

            listVacancies = new List <Vacancy>();
            foreach (StudentClass studentClass in View.SelectedObjects)
            {
                foreach (Student student in studentClass.Students)
                {
                    if (!dicStudentRegDetail.ContainsKey(student.StudentCode))
                    {
                        dicStudentRegDetail.Add(student.StudentCode, new List <string>());
                    }

                    foreach (RegisterDetail regDetail in student.RegisterDetails)
                    {
                        foreach (TkbSemester tkbsem in regDetail.Lesson.TKBSemesters)
                        {
                            listVacancies.Add(new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode)));
                        }
                        dicStudentRegDetail[student.StudentCode].Add(regDetail.Lesson.Subject.SubjectCode);

                        newCollectionSource.Criteria[regDetail.Lesson.Subject.SubjectCode] =
                            new BinaryOperator("Subject.SubjectCode", regDetail.Lesson.Subject.SubjectCode, BinaryOperatorType.NotEqual);
                    }
                    //listStudentCode.Add(student.StudentCode);
                }
            }

            using (XPCollection xpLesson = new XPCollection(objectSpace.Session, typeof(Lesson)))
            {
                Vacancy vc;
                foreach (Lesson lesson in xpLesson)
                {
                    if ((Convert.ToInt32(lesson.Semester.SemesterName) <= cpNHHK.Value) || (lesson.NumRegistration >= lesson.NumExpectation))
                    {
                        //không đăng ký, quá sĩ số, khác nhhk
                        newCollectionSource.Criteria[lesson.Oid.ToString()] = new BinaryOperator("Oid", lesson.Oid, BinaryOperatorType.NotEqual);
                    }
                    //vi phạm thời khóa biểu
                    foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                    {
                        vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                        if (Utils.IsConfictTKB(listVacancies, vc))
                        {
                            newCollectionSource.Criteria[lesson.Oid.ToString()] = new BinaryOperator("Oid", lesson.Oid, BinaryOperatorType.NotEqual);
                            break;
                        }
                    }
                }
            }

            ListView lv = Application.CreateListView(
                Application.FindListViewId(typeof(Lesson)),
                newCollectionSource, true);

            lv.Editor.AllowEdit        = false;
            lv.Editor.ControlsCreated += Editor_ControlsCreated;

            args.ShowViewParameters.CreatedView          = lv;
            args.ShowViewParameters.TargetWindow         = TargetWindow.NewModalWindow;
            args.ShowViewParameters.CreateAllControllers = true;
            DialogController selectAcception = new DialogController();

            args.ShowViewParameters.Controllers.Add(selectAcception);
            selectAcception.Accepting += selectAcception_AcceptingAdmin;
        }
示例#6
0
        private void CreateParam()
        {
            ConstrainstParameter cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "REGISTERSEMESTER"));

            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "REGISTERSEMESTER";
                cp.Name  = "NHHK hiện tại";
                cp.Value = 0;
                cp.Save();
            }
            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "MINCREDITS"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "MINCREDITS";
                cp.Name  = "Số tín chỉ Min";
                cp.Value = 15;
                cp.Save();
            }
            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "MAXCREDITS"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "MAXCREDITS";
                cp.Name  = "Số tín chỉ Max";
                cp.Value = 25;
                cp.Save();
            }
            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "TUITIONFEEPERCREDIT"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "TUITIONFEEPERCREDIT";
                cp.Name  = "Số tiền học phí cho 01 tín chỉ (VND)";
                cp.Value = 150000;
                cp.Save();
            }
            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "MINDEPTCANENROLL"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "MINDEPTCANENROLL";
                cp.Name  = "Số tiền nợ học phí tối thiểu có thể đăng ký môn học (VNĐ)- (Sinh viên không được nợ nhiều hơn)";
                cp.Value = 199999;
                cp.Save();
            }
            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "MINDEPTCANPRINTRESULT"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "MINDEPTCANPRINTRESULT";
                cp.Name  = "Số tiền nợ học phí tối thiểu có thể in được bảng điểm (VNĐ)- (Sinh viên không được nợ nhiều hơn)";
                cp.Value = 499999;
                cp.Save();
            }

            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "MORNINGPERIODCOUNT"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "MORNINGPERIODCOUNT";
                cp.Name  = "Số tiết buổi sáng";
                cp.Value = 6;
                cp.Save();
            }

            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "AFTERNOONPERIODCOUNT"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "AFTERNOONPERIODCOUNT";
                cp.Name  = "Số tiết buổi chiều";
                cp.Value = 6;
                cp.Save();
            }
            cp = Session.FindObject <ConstrainstParameter>(
                new BinaryOperator("Code", "EVERNINGPERIODCOUNT"));
            if (cp == null)
            {
                cp       = new ConstrainstParameter(Session);
                cp.Code  = "EVERNINGPERIODCOUNT";
                cp.Name  = "Số tiết buổi tối";
                cp.Value = 3;
                cp.Save();
            }


            RegisterState regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "SELECTED"));

            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "SELECTED";
                regstate.Name = "Đã chọn";
                regstate.Type = "DKMH";
                regstate.Save();
            }
            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "BOOKED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "BOOKED";
                regstate.Name = "Đã đăng ký";
                regstate.Type = "DKMH";
                regstate.Save();
            }

            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "PRINTED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "PRINTED";
                regstate.Name = "Đã in biên lai";
                regstate.Type = "DKMH";
                regstate.Save();
            }
            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "CANCELED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "CANCELED";
                regstate.Name = "Đã hủy";
                regstate.Type = "KIEMTRA";
                regstate.Save();
            }
            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "INSERTED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "INSERTED";
                regstate.Name = "Đã thêm";
                regstate.Type = "KIEMTRA";
                regstate.Save();
            }
            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "CHECKED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "CHECKED";
                regstate.Name = "Đã kiểm tra";
                regstate.Type = "KIEMTRA";
                regstate.Save();
            }
            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "CONFIRMED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "CONFIRMED";
                regstate.Name = "Đã xác nhận";
                regstate.Type = "KIEMTRA";
                regstate.Save();
            }
            regstate = Session.FindObject <RegisterState>(
                new BinaryOperator("Code", "NOTCHECKED"));
            if (regstate == null)
            {
                regstate      = new RegisterState(Session);
                regstate.Code = "NOTCHECKED";
                regstate.Name = "Chưa kiểm tra";
                regstate.Type = "KIEMTRA";
                regstate.Save();
            }
        }