Example #1
0
        private void BindData()
        {
            if (xfClassScheduler1 == null)
            {
                int      roomCount = zDataConverter.ToInt(bllConfiguration.GetItemValueByCache("RoomCount"));
                int      dayCount  = zDataConverter.ToInt(bllConfiguration.GetItemValueByCache("DayCount"));
                string[] roomNames = zDataConverter.ToString(bllConfiguration.GetItemValueByCache("RoomNames")).Split(',');
                string[] dayNames  = zDataConverter.ToString(bllConfiguration.GetItemValueByCache("DayNames")).Split(',');
                xfClassScheduler1            = new XFClassScheduler(dayCount, roomCount, roomNames, dayNames);
                xfClassScheduler1.Dock       = DockStyle.Fill;
                xfClassScheduler1.CellClick += xfClassScheduler1_CellClick;
                this.Controls.Add(xfClassScheduler1);
            }
            DataTable dtSelection = bll.GetDayDetailList(dt, StoreID, ClassRoomID).Tables[0];

            //设置已选课数据
            foreach (DataRow dr in dtSelection.Rows)
            {
                XF.Model.Course_Selection model = bll.DataRowToModel(dr);
                xfClassScheduler1.Rows[model.LessonNO].Cells[model.ClassRoomID].Style.BackColor = ColorTranslator.FromHtml(model.Color);
                xfClassScheduler1.Rows[model.LessonNO].Cells[model.ClassRoomID].Value           = string.Format("{0}第{1}节{2}选课人数:{3}{2}授课老师:{4}", model.CourseName, model.SectionNO, MessageText.KEY_ENTER, zDataConverter.ToString(model.SelectionCount), model.TeacherName);
                if (model.CourseID != zDataConverter.ToInt(ConfigSetting.TryOutCourseID))
                {
                    xfClassScheduler1.Rows[model.LessonNO].Cells[model.ClassRoomID].Tag = model.SelectionID;
                }
            }
        }
Example #2
0
        private void SetSelectionInfo(int index)
        {
            //设置显示日期文本
            DateTime dt        = dtpDate.Value.AddDays(index);
            int      roomCount = zDataConverter.ToInt(bllConfiguration.GetItemValueByCache("RoomCount"));
            int      dayCount  = zDataConverter.ToInt(bllConfiguration.GetItemValueByCache("DayCount"));

            string[] roomNames = zDataConverter.ToString(bllConfiguration.GetItemValueByCache("RoomNames")).Split(',');
            string[] dayNames  = zDataConverter.ToString(bllConfiguration.GetItemValueByCache("DayNames")).Split(',');
            tabControl1.TabPages[index].Text = string.Format(MessageText.FORMAT_DATE_WEEK, dt.ToString(MessageText.FORMAT_DATE), dt.ToString("dddd", new System.Globalization.CultureInfo("zh-CN")));
            //清除表格重绘
            Control[] controls = tabControl1.TabPages[index].Controls.Find(zDataConverter.ToString(typeof(XFClassScheduler)) + index, false);
            if (controls.Length > 0)
            {
                for (int i = 0; i < controls.Length; i++)
                {
                    tabControl1.TabPages[index].Controls.Remove(controls[i]);
                    controls[i].Dispose();
                }
            }
            xfClassScheduler      = new XFClassScheduler(dayCount, roomCount, roomNames, dayNames);
            xfClassScheduler.Name = zDataConverter.ToString(typeof(XFClassScheduler)) + index;
            xfClassScheduler.Tag  = dt;
            xfClassScheduler.Dock = DockStyle.Fill;
            xfClassScheduler.Size = new Size(tabControl1.TabPages[index].Width - 6, tabControl1.TabPages[index].Height - 6);
            tabControl1.TabPages[index].Controls.Add(xfClassScheduler);
            //设置已选课数据
            foreach (DataRow dr in dtSelection.Select(string.Format("CourseDate ='{0}' and StoreID = {1}", dt, StoreID)))
            {
                XF.Model.Course_Selection model = bll.DataRowToModel(dr);
                xfClassScheduler.Rows[model.LessonNO].Cells[model.ClassRoomID].Style.BackColor = ColorTranslator.FromHtml(model.Color);
                xfClassScheduler.Rows[model.LessonNO].Cells[model.ClassRoomID].Value           = string.Format("{0}第{1}节{2}选课人数:{3}{2}授课老师:{4}{2}学员:{5}", model.CourseName, model.SectionNO, MessageText.KEY_ENTER, zDataConverter.ToString(model.SelectionCount), model.TeacherName, model.StudentNames);
                xfClassScheduler.Rows[model.LessonNO].Cells[model.ClassRoomID].Tag             = model.SelectionID;
            }
            //设置已排课数据,目前不区分教室排课
            int weekDay = ((int)dt.DayOfWeek + 6) % 7;

            foreach (DataRow dr in dtScheduler.Select(string.Format("StoreID = {0} and WeekDay = {1}", StoreID, weekDay)))
            {
                XF.Model.Course_Scheduler model = bllScheduler.DataRowToModel(dr);
                for (int i = 0; i < roomCount; i++)
                {
                    if (zDataConverter.ToString(xfClassScheduler.Rows[model.LessonNO].Cells[i].Tag).Equals(string.Empty))
                    {
                        xfClassScheduler.Rows[model.LessonNO].Cells[i].Style.BackColor = Color.Lavender;
                        xfClassScheduler.Rows[model.LessonNO].Cells[i].Tag             = -1;
                        xfClassScheduler.Rows[model.LessonNO].Cells[i].Value           = "未排课";
                    }
                }
            }
            //设置点击事件
            xfClassScheduler.CellClick += new DataGridViewCellEventHandler(xfClassScheduler_CellClick);
        }
Example #3
0
 /// <summary>
 /// 设置Model数据
 /// </summary>
 private void SetModelData()
 {
     if (model == null)
     {
         model = new XF.Model.Course_Selection();
     }
     model.SectionNO = zDataConverter.ToInt(tbSectionNO.Text);
     model.SelectionStudents.Clear();
     foreach (DataGridViewRow dgvr in xfDataGridView1.Rows)
     {
         if (!zDataConverter.ToString(dgvr.Cells[ColStudentID.Name].Value).Equals(string.Empty))
         {
             XF.Model.Course_SelectionStudent student = new XF.Model.Course_SelectionStudent();
             student.SelectionID   = model.SelectionID;
             student.StudentID     = zDataConverter.ToInt(dgvr.Cells[ColStudentID.Name].Value);
             student.SelectionType = zDataConverter.ToInt(dgvr.Cells[ColType.Name].Value);
             model.SelectionStudents.Add(student);
         }
     }
 }
Example #4
0
        private void xfClassScheduler_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (sender.GetType().Equals(typeof(XFClassScheduler)))
            {
                XFClassScheduler xfClassScheduler = sender as XFClassScheduler;
                //判断是否可选
                if (!zDataConverter.ToString(xfClassScheduler.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag).Equals(string.Empty))
                {
                    XF.Model.Course_Selection model;
                    int selectionID = zDataConverter.ToInt(xfClassScheduler.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag);
                    if (selectionID == -1)
                    {
                        //未选课处理
                        model = new XF.Model.Course_Selection();
                        try
                        {
                            model.CourseDate = (DateTime)xfClassScheduler.Tag;
                        }
                        catch (Exception ex)
                        {
                            QQMessageBox.Show(
                                this,
                                string.Format(MessageText.PROGRAM_ERROR_SCHEDULER_DATE, ex.Message),
                                MessageText.MESSAGEBOX_CAPTION_ERROR,
                                QQMessageBoxIcon.Error,
                                QQMessageBoxButtons.OK);
                        }
                        model.SelectionID = selectionID;
                        model.StoreID     = StoreID;
                        model.ClassRoomID = e.ColumnIndex;
                        model.LessonNO    = e.RowIndex;

                        //弹出课程选择框
                        FrmCourseChoice frmCourseChoice = new FrmCourseChoice();
                        frmCourseChoice.Model = model;
                        frmCourseChoice.ShowDialog();
                        if (frmCourseChoice.DialogResult == System.Windows.Forms.DialogResult.OK)
                        {
                            //新增数据
                            string msg = bll.SaveSelection(frmCourseChoice.Model);
                            if (msg.Equals(string.Empty))
                            {
                                BindData();
                            }
                            else
                            {
                                QQMessageBox.Show(
                                    this,
                                    "选课保存出错,错误原因:" + msg,
                                    MessageText.MESSAGEBOX_CAPTION_ERROR,
                                    QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                            }
                        }
                    }
                    else
                    {
                        //已选课处理
                        model = bll.GetDetailModel(selectionID);
                        if (model.CourseID == zDataConverter.ToInt(ConfigSetting.TryOutCourseID))
                        {
                            //试听课处理
                            FrmTryOutCourseSelectionInfo frmTryOutCourseSelectionInfo = new FrmTryOutCourseSelectionInfo();
                            frmTryOutCourseSelectionInfo.Model  = model;
                            frmTryOutCourseSelectionInfo.Status = CardEnum.UPDATE;
                            frmTryOutCourseSelectionInfo.ShowDialog();
                            if (frmTryOutCourseSelectionInfo.DialogResult == System.Windows.Forms.DialogResult.OK)
                            {
                                //更新数据
                                //更新试听课数据----
                                string msg = bll.SaveSelection(frmTryOutCourseSelectionInfo.Model);
                                if (msg.Equals(string.Empty))
                                {
                                    BindData();
                                }
                                else
                                {
                                    QQMessageBox.Show(
                                        this,
                                        "选课保存出错,错误原因:" + msg,
                                        MessageText.MESSAGEBOX_CAPTION_ERROR,
                                        QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                                }
                            }
                            else if (frmTryOutCourseSelectionInfo.DialogResult == System.Windows.Forms.DialogResult.No)
                            {
                                //关闭课程
                                string msg = bll.CloseCourse(frmTryOutCourseSelectionInfo.Model.SelectionID, frmTryOutCourseSelectionInfo.Model.CourseID, frmTryOutCourseSelectionInfo.Model.CourseDate);
                                if (msg.Equals(string.Empty))
                                {
                                    QQMessageBox.Show(
                                        this,
                                        MessageText.SUCCESS_SELECTION_CLOSE,
                                        MessageText.MESSAGEBOX_CAPTION_TIP,
                                        QQMessageBoxIcon.OK, QQMessageBoxButtons.OK);
                                    BindData();
                                }
                                else
                                {
                                    QQMessageBox.Show(
                                        this,
                                        msg,
                                        MessageText.MESSAGEBOX_CAPTION_ERROR,
                                        QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                                }
                            }
                        }
                        else
                        {
                            //非试听课处理
                            FrmCourseSelectionInfo frmCourseSelectionInfo = new FrmCourseSelectionInfo();
                            frmCourseSelectionInfo.Model  = model;
                            frmCourseSelectionInfo.Status = CardEnum.UPDATE;
                            frmCourseSelectionInfo.ShowDialog();
                            if (frmCourseSelectionInfo.DialogResult == System.Windows.Forms.DialogResult.OK)
                            {
                                //更新数据
                                //更新非试听课数据----
                                string msg = bll.SaveSelection(frmCourseSelectionInfo.Model);
                                if (msg.Equals(string.Empty))
                                {
                                    BindData();
                                }
                                else
                                {
                                    QQMessageBox.Show(
                                        this,
                                        "选课保存出错,错误原因:" + msg,
                                        MessageText.MESSAGEBOX_CAPTION_ERROR,
                                        QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                                }
                            }
                            else if (frmCourseSelectionInfo.DialogResult == System.Windows.Forms.DialogResult.No)
                            {
                                //关闭课程
                                string msg = bll.CloseCourse(frmCourseSelectionInfo.Model.SelectionID, frmCourseSelectionInfo.Model.CourseID, frmCourseSelectionInfo.Model.CourseDate);
                                if (msg.Equals(string.Empty))
                                {
                                    QQMessageBox.Show(
                                        this,
                                        MessageText.SUCCESS_SELECTION_CLOSE,
                                        MessageText.MESSAGEBOX_CAPTION_TIP,
                                        QQMessageBoxIcon.OK, QQMessageBoxButtons.OK);
                                    BindData();
                                }
                                else
                                {
                                    QQMessageBox.Show(
                                        this,
                                        msg,
                                        MessageText.MESSAGEBOX_CAPTION_ERROR,
                                        QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #5
0
 /// <summary>
 /// 显示学员评价信息
 /// </summary>
 /// <param name="models"></param>
 private void ShowStudentEvalute()
 {
     if (xfDataGridView1.CurrentCell != null && xfDataGridView1.CurrentCell.RowIndex >= 0)
     {
         if (rowIndexOld != xfDataGridView1.CurrentCell.RowIndex)
         {
             XF.Model.Course_SelectionStudent model;
             if (rowIndexOld >= 0)
             {
                 model            = xfDataGridView1.Rows[rowIndexOld].Tag as XF.Model.Course_SelectionStudent;
                 model.Evaluation = rtcEvaluate.ContentText;
                 model.Evaluates.Clear();
                 model.Evaluates.AddRange(new List <XF.Model.Course_Evaluate>
                 {
                     new XF.Model.Course_Evaluate
                     {
                         SelectionStudentId = model.SelectionStudentID,
                         Item     = "Discipline",
                         Score    = zDataConverter.ToInt(nudDiscipline.Value),
                         MaxScore = 10
                     }, new XF.Model.Course_Evaluate
                     {
                         SelectionStudentId = model.SelectionStudentID,
                         Item     = "Practical",
                         Score    = zDataConverter.ToInt(nudPractical.Value),
                         MaxScore = 10
                     }, new XF.Model.Course_Evaluate
                     {
                         SelectionStudentId = model.SelectionStudentID,
                         Item     = "Concentration",
                         Score    = zDataConverter.ToInt(nudConcentration.Value),
                         MaxScore = 10
                     }, new XF.Model.Course_Evaluate
                     {
                         SelectionStudentId = model.SelectionStudentID,
                         Item     = "Logic",
                         Score    = zDataConverter.ToInt(nudLogic.Value),
                         MaxScore = 10
                     }, new XF.Model.Course_Evaluate
                     {
                         SelectionStudentId = model.SelectionStudentID,
                         Item     = "Communication",
                         Score    = zDataConverter.ToInt(nudCommunication.Value),
                         MaxScore = 10
                     }
                 });
             }
             rowIndexOld             = xfDataGridView1.CurrentCell.RowIndex;
             model                   = xfDataGridView1.Rows[xfDataGridView1.CurrentCell.RowIndex].Tag as XF.Model.Course_SelectionStudent;
             model.Evaluates         = bllEvaluate.GetSelectionStudentEvaluates(model.SelectionStudentID);
             rtcEvaluate.ContentText = model.Evaluation;
             if (model.Evaluates.Count == 0)
             {
                 nudDiscipline.Value    = 10;
                 nudPractical.Value     = 10;
                 nudConcentration.Value = 10;
                 nudLogic.Value         = 10;
                 nudCommunication.Value = 10;
             }
             else
             {
                 foreach (XF.Model.Course_Evaluate evaluate in model.Evaluates)
                 {
                     if (evaluate.Item.Equals("Discipline"))
                     {
                         nudDiscipline.Value = evaluate.Score;
                     }
                     else if (evaluate.Item.Equals("Practical"))
                     {
                         nudPractical.Value = evaluate.Score;
                     }
                     else if (evaluate.Item.Equals("Concentration"))
                     {
                         nudConcentration.Value = evaluate.Score;
                     }
                     else if (evaluate.Item.Equals("Logic"))
                     {
                         nudLogic.Value = evaluate.Score;
                     }
                     else if (evaluate.Item.Equals("Communication"))
                     {
                         nudCommunication.Value = evaluate.Score;
                     }
                 }
             }
         }
     }
 }