Ejemplo n.º 1
0
        protected void ToolbarClick(object sender, RadToolBarEventArgs e)
        {
            if (e.Item.Text == "New")
            {
                Grid.SelectedIndexes.Clear();
                ResetForm();
            }
            else if (e.Item.Text == "Save")
            {
                var cC = new CProgramCourse();
                var c  = new Erp2016.Lib.ProgramCourse();
                c.ProgramId   = Convert.ToInt32(RadComboBoxProgram.SelectedValue);
                c.IsActive    = RadButtonActive.Checked;
                c.CourseName  = RadTextBoxProgramCourse.Text;
                c.Description = RadTextBoxDescription.Text;
                c.CreatedId   = CurrentUserId;
                c.CreatedDate = DateTime.Now.Date;

                if (cC.Add(c) > 0)
                {
                    ShowMessage("'" + c.CourseName + "' is added.");
                    Grid.Rebind();
                }
                else
                {
                    ShowMessage("Failed to add");
                }
            }
            else if (e.Item.Text == "Update")
            {
                if (Grid.SelectedValue != null)
                {
                    var cC = new CProgramCourse();
                    var c  = cC.Get(Convert.ToInt32(Grid.SelectedValue));
                    c.ProgramId   = Convert.ToInt32(RadComboBoxProgram.SelectedValue);
                    c.IsActive    = true;
                    c.CourseName  = RadTextBoxProgramCourse.Text;
                    c.Description = RadTextBoxDescription.Text;
                    c.IsActive    = RadButtonActive.Checked;
                    c.UpdatedId   = CurrentUserId;
                    c.UpdatedDate = DateTime.Now;

                    if (cC.Update(c))
                    {
                        ShowMessage("'" + c.CourseName + "' is updated.");
                        Grid.Rebind();
                    }
                    else
                    {
                        ShowMessage("Failed to update");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void GetProgramCourseLevel()
        {
            ResetForm();
            if (Grid.SelectedValue != null)
            {
                var c = new CProgramCourseLevel().Get(Convert.ToInt32(Grid.SelectedValue));
                if (c != null)
                {
                    var programCourse = new CProgramCourse().Get(c.ProgramCourseId);
                    if (programCourse != null)
                    {
                        var program = new CProgram().Get(programCourse.ProgramId);

                        if (program != null)
                        {
                            if (program.ProgramGroupId != null)
                            {
                                var programGroup = new CProgramGroup().Get(Convert.ToInt32(program.ProgramGroupId));
                                if (programGroup != null)
                                {
                                    RadComboBoxFaculty.SelectedValue = programGroup.FacultyId.ToString();
                                    LoadProgramGroup(RadComboBoxFaculty.SelectedValue);
                                }
                                RadComboBoxProgramGroup.SelectedValue = program.ProgramGroupId.ToString();
                                LoadProgram(RadComboBoxProgramGroup.SelectedValue);
                            }
                            RadComboBoxProgram.SelectedValue = program.ProgramId.ToString();
                            LoadProgramCourse(RadComboBoxProgram.SelectedValue);
                        }
                    }
                    RadTextBoxProgramCourseLevel.Text = c.Level;
                    RadTextBoxDescription.Text        = c.Description;
                    RadButtonActive.Checked           = c.IsActive;
                }

                RadToolBarProgramGroup.FindItemByText("New").Enabled = true;
                if (RadToolBarProgramGroup.FindItemByText("Save") != null)
                {
                    RadToolBarProgramGroup.FindItemByText("Save").Text = "Update";
                }
            }
        }
Ejemplo n.º 3
0
        protected void GetProgramClass()
        {
            ResetForm();
            if (RadGridProgramClass.SelectedValue != null)
            {
                var c = new CProgramClass().Get(Convert.ToInt32(RadGridProgramClass.SelectedValue));
                if (c != null)
                {
                    var program = new CProgram().Get(c.ProgramId);
                    if (program != null)
                    {
                        if (program.ProgramGroupId != null)
                        {
                            var programGroup = new CProgramGroup().Get(Convert.ToInt32(program.ProgramGroupId));
                            if (programGroup != null)
                            {
                                RadComboBoxFaculty.SelectedValue = programGroup.FacultyId.ToString();
                                LoadProgramGroup(RadComboBoxFaculty.SelectedValue);
                            }
                            RadComboBoxProgramGroup.SelectedValue = program.ProgramGroupId.ToString();
                            LoadProgram(RadComboBoxProgramGroup.SelectedValue);
                        }
                        RadComboBoxProgram.SelectedValue = program.ProgramId.ToString();
                        LoadProgramCourse(RadComboBoxProgram.SelectedValue);

                        if (c.ProgramCourseId != null)
                        {
                            var programCourse = new CProgramCourse().Get((int)c.ProgramCourseId);
                            if (programCourse != null)
                            {
                                RadComboBoxProgramCourse.SelectedValue = programCourse.ProgramCourseId.ToString();
                                LoadProgramCourseLevel(RadComboBoxProgramCourse.SelectedValue);
                            }
                        }

                        if (c.ProgramCourseLevelId != null)
                        {
                            var programCourseLevel = new CProgramCourseLevel().Get((int)c.ProgramCourseLevelId);
                            if (programCourseLevel != null)
                            {
                                RadComboBoxProgramCourseLevel.SelectedValue = programCourseLevel.ProgramCourseLevelId.ToString();
                            }
                        }
                    }
                    RadComboBoxInstructor.SelectedValue = c.InstructorId.ToString();
                    RadTextBoxProgramClass.Text         = c.Name;
                    RadTextBoxDescription.Text          = c.Description;
                    RadButtonActive.Checked             = c.IsActive;

                    RadDatePickerStartDate.SelectedDate = c.StartDate;
                    RadDatePickerEndDate.SelectedDate   = c.EndDate;
                    RadComboBoxWeeks.SelectedValue      = c.ClassWeek.ToString();

                    RadTimePickerStartMon.SelectedTime = c.MondayStartTime;
                    RadTimePickerStartTue.SelectedTime = c.TuesdayStartTime;
                    RadTimePickerStartWed.SelectedTime = c.WednesdayStartTime;
                    RadTimePickerStartThu.SelectedTime = c.ThursdayStartTime;
                    RadTimePickerStartFri.SelectedTime = c.FridayStartTime;

                    RadTimePickerEndMon.SelectedTime = c.MondayEndTime;
                    RadTimePickerEndTue.SelectedTime = c.TuesdayEndTime;
                    RadTimePickerEndWed.SelectedTime = c.WednesdayEndTime;
                    RadTimePickerEndThu.SelectedTime = c.ThursdayEndTime;
                    RadTimePickerEndFri.SelectedTime = c.FridayEndTime;
                }

                SetClassTime();

                RadToolBarProgramClass.FindItemByText("New").Enabled = true;
                if (RadToolBarProgramClass.FindItemByText("Save") != null)
                {
                    RadToolBarProgramClass.FindItemByText("Save").Text = "Update";
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id   = Convert.ToInt32(Request["id"]);
            Type = Request["type"];

            if (!IsPostBack)
            {
                ResetForm();

                // new
                if (Type == "0")
                {
                    //
                }
                // modify
                else
                {
                    var gradeSchema = new CGradeSchema();
                    var grade       = gradeSchema.Get(Id);
                    if (grade != null)
                    {
                        RadTextBoxName.Text = grade.Name;
                        if (grade.IsGlobal)
                        {
                            RadComboBoxIsGlobal.SelectedIndex = 0;
                        }
                        else
                        {
                            RadComboBoxIsGlobal.SelectedIndex = 1;
                        }

                        if (grade.ProgramId != null)
                        {
                            var program = new CProgram().Get(Convert.ToInt32(grade.ProgramId));
                            if (program != null)
                            {
                                var programGroup = new CProgramGroup().Get(Convert.ToInt32(program.ProgramGroupId));
                                if (programGroup != null)
                                {
                                    RadComboBoxFaculty.SelectedValue = programGroup.FacultyId.ToString();
                                    LoadProgramGroup(RadComboBoxFaculty.SelectedValue);
                                }
                                RadComboBoxProgramGroup.SelectedValue = program.ProgramGroupId.ToString();
                                LoadProgram(RadComboBoxProgramGroup.SelectedValue);
                            }
                            RadComboBoxProgram.SelectedValue = program.ProgramId.ToString();
                            LoadProgramCourse(RadComboBoxProgram.SelectedValue);

                            if (grade.ProgramCourseId != null)
                            {
                                var programCourse = new CProgramCourse().Get(Convert.ToInt32(grade.ProgramCourseId));
                                if (programCourse != null)
                                {
                                    RadComboBoxProgramCourse.SelectedValue = programCourse.ProgramCourseId.ToString();
                                    LoadProgramCourseLevel(RadComboBoxProgramCourse.SelectedValue);

                                    if (grade.ProgramCourseLevelId != null)
                                    {
                                        var programCourseLevel = new CProgramCourseLevel().Get(Convert.ToInt32(grade.ProgramCourseLevelId));
                                        if (programCourseLevel != null)
                                        {
                                            RadComboBoxProgramCourseLevel.SelectedValue = programCourseLevel.ProgramCourseLevelId.ToString();
                                            LoadProgramClass(RadComboBoxProgram.SelectedValue, RadComboBoxProgramCourse.SelectedValue, RadComboBoxProgramCourseLevel.SelectedValue);

                                            if (grade.ProgramClassId != null)
                                            {
                                                var programclass = new CProgramClass().Get(Convert.ToInt32(grade.ProgramClassId));
                                                if (programclass != null)
                                                {
                                                    RadComboBoxProgramClass.SelectedValue = programclass.ProgramClassId.ToString();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            RadComboBoxFaculty.OpenDropDownOnLoad            = false;
            RadComboBoxProgramGroup.OpenDropDownOnLoad       = false;
            RadComboBoxProgram.OpenDropDownOnLoad            = false;
            RadComboBoxProgramCourse.OpenDropDownOnLoad      = false;
            RadComboBoxProgramCourseLevel.OpenDropDownOnLoad = false;
            RadComboBoxProgramClass.OpenDropDownOnLoad       = false;
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var tempSplit = Request["programClassStudentIdList"].Split(',');

            foreach (var v in tempSplit)
            {
                _classStudentIdList.Add(Convert.ToInt32(v));
            }
            var programClassStudent = new CProgramClassStudent().Get(_classStudentIdList[0]);

            CurrentProgramClassId = programClassStudent.ProgramClassId;

            if (!IsPostBack)
            {
                ResetForm();

                var c = new CProgramClass().Get(CurrentProgramClassId);
                if (c != null)
                {
                    var program = new CProgram().Get(c.ProgramId);
                    if (program != null)
                    {
                        if (program.ProgramGroupId != null)
                        {
                            var programGroup = new CProgramGroup().Get(Convert.ToInt32(program.ProgramGroupId));
                            if (programGroup != null)
                            {
                                RadComboBoxFaculty.SelectedValue = programGroup.FacultyId.ToString();
                                LoadProgramGroup(RadComboBoxFaculty.SelectedValue);
                            }
                            RadComboBoxProgramGroup.SelectedValue = program.ProgramGroupId.ToString();
                            LoadProgram(RadComboBoxProgramGroup.SelectedValue);
                        }
                        RadComboBoxProgram.SelectedValue = program.ProgramId.ToString();
                        LoadProgramCourse(RadComboBoxProgram.SelectedValue);

                        if (c.ProgramCourseId != null)
                        {
                            var programCourse = new CProgramCourse().Get((int)c.ProgramCourseId);
                            if (programCourse != null)
                            {
                                RadComboBoxProgramCourse.SelectedValue = programCourse.ProgramCourseId.ToString();
                                LoadProgramCourseLevel(RadComboBoxProgramCourse.SelectedValue);
                            }
                        }

                        if (c.ProgramCourseLevelId != null)
                        {
                            var programCourseLevel = new CProgramCourseLevel().Get((int)c.ProgramCourseLevelId);
                            if (programCourseLevel != null)
                            {
                                RadComboBoxProgramCourseLevel.SelectedValue = programCourseLevel.ProgramCourseLevelId.ToString();
                                LoadProgramClass(RadComboBoxProgramCourse.SelectedValue, CurrentProgramClassId);
                            }
                        }
                    }
                }
            }

            SearchProgramClassStudent();

            RadComboBoxFaculty.OpenDropDownOnLoad            = false;
            RadComboBoxProgramGroup.OpenDropDownOnLoad       = false;
            RadComboBoxProgram.OpenDropDownOnLoad            = false;
            RadComboBoxProgramCourse.OpenDropDownOnLoad      = false;
            RadComboBoxProgramCourseLevel.OpenDropDownOnLoad = false;
            RadComboBoxProgramClass.OpenDropDownOnLoad       = false;
        }