private void BtnCourse_Click(object sender, EventArgs e) { this.Hide(); XF.Model.Base_Course course; try { course = ((sender as Button).Tag) as XF.Model.Base_Course; model.CourseID = course.CourseID; model.CourseName = course.CourseName; } catch { return; } if (model.CourseID == zDataConverter.ToInt(ConfigSetting.TryOutCourseID)) { FrmTryOutCourseSelectionInfo frmTryOutCourseSelectionInfo = new FrmTryOutCourseSelectionInfo(); frmTryOutCourseSelectionInfo.Status = CardEnum.ADD; frmTryOutCourseSelectionInfo.Model = model; frmTryOutCourseSelectionInfo.ShowDialog(); this.DialogResult = frmTryOutCourseSelectionInfo.DialogResult; this.Close(); } else { FrmCourseSelectionInfo frmCourseSelectionInfo = new FrmCourseSelectionInfo(); frmCourseSelectionInfo.Status = CardEnum.ADD; frmCourseSelectionInfo.Model = model; frmCourseSelectionInfo.ShowDialog(); this.DialogResult = frmCourseSelectionInfo.DialogResult; this.Close(); } }
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); } } } } } } }