public CourseListViewItem(CourseRecord course, AEIncludeRecord aei, List <SCETakeRecord> sceList)
            {
                _is_finish = true;

                TeacherRecord teacher = course.GetFirstTeacher();

                _total = SCAttend.GetCourseStudentCount(course.ID);
                Calculate(sceList);

                if (aei.UseScore)
                {
                    _is_finish &= (_scoreCount == _total);
                }
                if (aei.UseEffort)
                {
                    _is_finish &= (_effortCount == _total);
                }
                if (aei.UseText)
                {
                    _is_finish &= (_textCount == _total);
                }

                this.Text = course.Name;
                this.SubItems.Add((teacher != null) ? teacher.Name : "");
                this.SubItems.Add(aei.UseScore ? ScoreField : "").ForeColor   = (_scoreCount == _total) ? Color.Black : Color.Red;
                this.SubItems.Add(aei.UseEffort ? EffortField : "").ForeColor = (_effortCount == _total) ? Color.Black : Color.Red;
                this.SubItems.Add(aei.UseText ? TextField : "").ForeColor     = (_textCount == _total) ? Color.Black : Color.Red;
            }
        /// <summary>
        /// Constructor
        /// 傳入一個課程。
        /// </summary>
        /// <param name="course"></param>
        public CourseScoreInputForm(CourseRecord course)
        {
            InitializeComponent();
            prlp    = new PermRecLogProcess();
            _course = course;

            #region 設定小標題
            TeacherRecord first  = course.GetFirstTeacher();
            TeacherRecord second = course.GetSecondTeacher();
            TeacherRecord third  = course.GetThirdTeacher();

            StringBuilder builder = new StringBuilder("");
            if (first != null)
            {
                builder.Append(first.Name + ",");
            }
            if (second != null)
            {
                builder.Append(second.Name + ",");
            }
            if (third != null)
            {
                builder.Append(third.Name + ",");
            }

            string teachers = builder.ToString();
            if (!string.IsNullOrEmpty(teachers))
            {
                teachers = teachers.Substring(0, teachers.Length - 1);
            }

            lblCourseName.Text = course.Name + (!string.IsNullOrEmpty(teachers) ? " (" + teachers + ")" : "");
            #endregion

            #region 取得文字評量代碼表
            K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["文字描述代碼表"];
            if (!string.IsNullOrEmpty(cd["xml"]))
            {
                K12.Data.XmlHelper helper = new K12.Data.XmlHelper(K12.Data.XmlHelper.LoadXml(cd["xml"]));
                foreach (XmlElement item in helper.GetElements("Item"))
                {
                    string code    = item.GetAttribute("Code");
                    string content = item.GetAttribute("Content");

                    if (!_textMapping.ContainsKey(code))
                    {
                        _textMapping.Add(code, content);
                    }
                }
            }
            #endregion
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// 傳入一個課程。
        /// </summary>
        /// <param name="course"></param>
        public CourseScoreInputForm(CourseRecord course)
        {
            InitializeComponent();
            _course                 = course;
            _SceTakeDic             = new Dictionary <string, SCETakeRecord>();
            _ScAttendDic            = new Dictionary <string, JHSCAttendRecord>();
            _dirtyCellList          = new List <DataGridViewCell>();
            _studentRow             = new Dictionary <string, DataGridViewRow>();
            _BW                     = new BackgroundWorker();
            _BW.DoWork             += new DoWorkEventHandler(_BW_DoWork);
            _BW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BW_Completed);
            _A = new AccessHelper();
            _Q = new QueryHelper();

            #region 設定小標題
            TeacherRecord first  = course.GetFirstTeacher();
            TeacherRecord second = course.GetSecondTeacher();
            TeacherRecord third  = course.GetThirdTeacher();

            StringBuilder builder = new StringBuilder("");
            if (first != null)
            {
                builder.Append(first.Name + ",");
            }
            if (second != null)
            {
                builder.Append(second.Name + ",");
            }
            if (third != null)
            {
                builder.Append(third.Name + ",");
            }

            string teachers = builder.ToString();
            if (!string.IsNullOrEmpty(teachers))
            {
                teachers = teachers.Substring(0, teachers.Length - 1);
            }

            lblCourseName.Text = course.Name + (!string.IsNullOrEmpty(teachers) ? " (" + teachers + ")" : "");

            #endregion
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// 傳入一個課程。
        /// </summary>
        /// <param name="course"></param>
        public CourseScoreInputForm(CourseRecord course)
        {
            InitializeComponent();
            prlp = new PermRecLogProcess();



            _course = course;

            #region 設定小標題
            TeacherRecord first  = course.GetFirstTeacher();
            TeacherRecord second = course.GetSecondTeacher();
            TeacherRecord third  = course.GetThirdTeacher();

            StringBuilder builder = new StringBuilder("");
            if (first != null)
            {
                builder.Append(first.Name + ",");
            }
            if (second != null)
            {
                builder.Append(second.Name + ",");
            }
            if (third != null)
            {
                builder.Append(third.Name + ",");
            }

            string teachers = builder.ToString();
            if (!string.IsNullOrEmpty(teachers))
            {
                teachers = teachers.Substring(0, teachers.Length - 1);
            }

            lblCourseName.Text = course.Name + (!string.IsNullOrEmpty(teachers) ? " (" + teachers + ")" : "");
            #endregion

            #region 取得努力程度對照表
            K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["努力程度對照表"];
            if (!string.IsNullOrEmpty(cd["xml"]))
            {
                XmlElement element = XmlHelper.LoadXml(cd["xml"]);

                foreach (XmlElement each in element.SelectNodes("Effort"))
                {
                    int     code = int.Parse(each.GetAttribute("Code"));
                    decimal score;
                    if (!decimal.TryParse(each.GetAttribute("Score"), out score))
                    {
                        score = 0;
                    }

                    if (!_effortList.ContainsKey(score))
                    {
                        _effortList.Add(score, code);
                    }
                }

                _scoreList = new List <decimal>();
                _scoreList.AddRange(_effortList.Keys);
                _scoreList.Sort(delegate(decimal a, decimal b)
                {
                    return(b.CompareTo(a));
                });
            }
            #endregion

            #region 取得文字評量代碼表
            cd = K12.Data.School.Configuration["文字描述代碼表"];
            if (!string.IsNullOrEmpty(cd["xml"]))
            {
                XmlHelper helper = new XmlHelper(XmlHelper.LoadXml(cd["xml"]));
                foreach (XmlElement item in helper.GetElements("Item"))
                {
                    string code    = item.GetAttribute("Code");
                    string content = item.GetAttribute("Content");

                    if (!_textMapping.ContainsKey(code))
                    {
                        _textMapping.Add(code, content);
                    }
                }
            }
            #endregion
        }