Esempio n. 1
0
        private void LoadData()
        {
            itmPnlQuizName.SuspendLayout();
            itmPnlQuizName.Items.Clear();
            txtQuizName.Text = "";
            dgDataField.Rows.Clear();
            _QuizData = _UDTTransfer.GetAllQuizData();
            _QuizData = (from data in _QuizData orderby data.QuizName select data).ToList();

            foreach (DAO.UDT_QuizDef qd in _QuizData)
            {
                ButtonItem btnItem = new ButtonItem();
                btnItem.Name        = qd.QuizName;
                btnItem.Text        = qd.QuizName;
                btnItem.Tag         = qd;
                btnItem.OptionGroup = "itmPnlQuizName";
                btnItem.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
                btnItem.Click      += new EventHandler(btnItem_Click);
                itmPnlQuizName.Items.Add(btnItem);
            }


            itmPnlQuizName.ResumeLayout();
            itmPnlQuizName.Refresh();
            txtQuizName.Enabled = false;
        }
        void _bgWork_DoWork(object sender, DoWorkEventArgs e)
        {
            // 取得測驗資料
            _AllQuizData = _UDTTransfer.GetAllQuizData();
            // 取得所選學生測驗資料
            _StudentQuizDataList = _UDTTransfer.GetStudQuizDataByStudentIDList(_SelectStudentIDList);
            _QuizIDDict.Clear();
            // 比對測驗資料名稱

            foreach (DAO.UDT_QuizDef QN in _AllQuizData)
            {
                int count = 0;
                int id    = int.Parse(QN.UID);
                foreach (DAO.UDT_StudQuizDataDef StudQ in _StudentQuizDataList.Where(x => x.QuizID == id))
                {
                    count++;
                }

                // 有資料
                if (count > 0)
                {
                    if (!_QuizIDDict.ContainsKey(QN.QuizName))
                    {
                        _QuizIDDict.Add(QN.QuizName, id);
                    }
                }
            }
        }
        public StudQuizDataForm(DAO.UDT_StudQuizDataDef sqd,EditMode editMode,string StudentID)
        {
            InitializeComponent();
            _EditMode = editMode;
            _RowNameList = new List<string>();
            _StudQuizData = sqd;
            _UDTTransfer = new DAO.UDTTransfer();
            _AllQuiz = _UDTTransfer.GetAllQuizData();
            _quizFieldNameList = new List<DAO.SortData1>();
            _StudentID = StudentID;
            _LogTransfer = new DAO.LogTransfer();

            // 將測驗名稱放入
            List<string> nameList = (from data in _AllQuiz orderby data.QuizName select data.QuizName).ToList();
            cbxQuizName.Items.AddRange(nameList.ToArray());

            ReLoadQuizFieldNameList();
        }
        public StudQuizDataForm(DAO.UDT_StudQuizDataDef sqd, EditMode editMode, string StudentID)
        {
            InitializeComponent();
            _EditMode          = editMode;
            _RowNameList       = new List <string>();
            _StudQuizData      = sqd;
            _UDTTransfer       = new DAO.UDTTransfer();
            _AllQuiz           = _UDTTransfer.GetAllQuizData();
            _quizFieldNameList = new List <DAO.SortData1>();
            _StudentID         = StudentID;
            _LogTransfer       = new DAO.LogTransfer();

            // 將測驗名稱放入
            List <string> nameList = (from data in _AllQuiz orderby data.QuizName select data.QuizName).ToList();

            cbxQuizName.Items.AddRange(nameList.ToArray());

            ReLoadQuizFieldNameList();
        }
        private void ImportStudQuizDataSelectQuizNameForm_Load(object sender, EventArgs e)
        {
            // 預設用學號
            rbClassSeatNo.Checked   = false;
            rbStudentNumber.Checked = true;
            K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration[_ConfigData_Name];

            bool b1, b2;

            if (bool.TryParse(cd[_ConfigData_ItemSnum], out b1))
            {
                rbStudentNumber.Checked = b1;
            }

            if (bool.TryParse(cd[_ConfigData_ItemSeatNo], out b2))
            {
                rbClassSeatNo.Checked = b2;
            }

            _QuizDataList = _UDTTransfer.GetAllQuizData();
            List <string> NameList = _QuizDataList.Select(x => x.QuizName).ToList();

            cbxQuizName.Items.AddRange(NameList.ToArray());
        }