private void LoadData()
        {
            lblGroupName.Text     = MOEGroupNmae;
            lblGPName.Text        = _GPlanData.Name;
            lblDiffCount.Text     = _GPlanData.calSubjDiffCount() + "";
            lblUpdateCount.Text   = _GPlanData.calSubjUpdateCount() + "";
            lblDelCount.Text      = _GPlanData.calSubjDelCount() + "";
            lblNoChangeCount.Text = _GPlanData.calSubjNoChangeCount() + "";

            dgData.Rows.Clear();

            foreach (chkSubjectInfo subj in _GPlanData.chkSubjectInfoList)
            {
                int rowIdx = dgData.Rows.Add();
                try
                {
                    Console.WriteLine("subj.ProcessStatus:" + subj.ProcessStatus);
                    dgData.Rows[rowIdx].Tag = subj;
                    dgData.Rows[rowIdx].Cells["差異狀態"].Value = string.Join(",", subj.DiffStatusList.ToArray());
                    dgData.Rows[rowIdx].Cells["處理方式"].Value = subj.ProcessStatus;
                    dgData.Rows[rowIdx].Cells["領域"].Value   = subj.Domain;
                    dgData.Rows[rowIdx].Cells["分項類別"].Value = subj.Entry;
                    dgData.Rows[rowIdx].Cells["科目名稱"].Value = subj.SubjectName;
                    dgData.Rows[rowIdx].Cells["校訂部定"].Value = subj.RequiredBy;
                    dgData.Rows[rowIdx].Cells["必選修"].Value  = subj.isRequired;


                    // 缺少解析方式 學分
                    if (subj.DiffStatusList.Contains("缺"))
                    {
                        if (subj.credit_period != null && subj.credit_period.Length == 6)
                        {
                            dgData.Rows[rowIdx].Cells["1上"].Value = subj.credit_period.Substring(0, 1);
                            dgData.Rows[rowIdx].Cells["1下"].Value = subj.credit_period.Substring(1, 1);
                            dgData.Rows[rowIdx].Cells["2上"].Value = subj.credit_period.Substring(2, 1);
                            dgData.Rows[rowIdx].Cells["2下"].Value = subj.credit_period.Substring(3, 1);
                            dgData.Rows[rowIdx].Cells["3上"].Value = subj.credit_period.Substring(4, 1);
                            dgData.Rows[rowIdx].Cells["3下"].Value = subj.credit_period.Substring(5, 1);
                        }
                    }
                    else
                    {
                        foreach (XElement elm in subj.GPlanXml)
                        {
                            if (elm.Attribute("GradeYear").Value == "1" && elm.Attribute("Semester").Value == "1")
                            {
                                dgData.Rows[rowIdx].Cells["1上"].Value = elm.Attribute("Credit").Value;
                            }

                            if (elm.Attribute("GradeYear").Value == "1" && elm.Attribute("Semester").Value == "2")
                            {
                                dgData.Rows[rowIdx].Cells["1下"].Value = elm.Attribute("Credit").Value;
                            }

                            if (elm.Attribute("GradeYear").Value == "2" && elm.Attribute("Semester").Value == "1")
                            {
                                dgData.Rows[rowIdx].Cells["2上"].Value = elm.Attribute("Credit").Value;
                            }


                            if (elm.Attribute("GradeYear").Value == "2" && elm.Attribute("Semester").Value == "2")
                            {
                                dgData.Rows[rowIdx].Cells["2下"].Value = elm.Attribute("Credit").Value;
                            }


                            if (elm.Attribute("GradeYear").Value == "3" && elm.Attribute("Semester").Value == "1")
                            {
                                dgData.Rows[rowIdx].Cells["3上"].Value = elm.Attribute("Credit").Value;
                            }

                            if (elm.Attribute("GradeYear").Value == "3" && elm.Attribute("Semester").Value == "2")
                            {
                                dgData.Rows[rowIdx].Cells["3下"].Value = elm.Attribute("Credit").Value;
                            }
                        }
                    }


                    dgData.Rows[rowIdx].Cells["開課方式"].Value = subj.OpenStatus;
                    dgData.Rows[rowIdx].Cells["課程代碼"].Value = subj.CourseCode;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
예제 #2
0
        //private string SubjFullName(string SubjectName, int level)
        //{
        //    string lev = "";
        //    if (level == 1)
        //        lev = " I";

        //    if (level == 2)
        //        lev = " II";

        //    if (level == 3)
        //        lev = " III";

        //    if (level == 4)
        //        lev = " IV";

        //    if (level == 5)
        //        lev = " V";

        //    if (level == 6)
        //        lev = " VI";

        //    string value = SubjectName + lev;

        //    return value;
        //}


        private void dgData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                if (e.ColumnIndex == colSet.Index)
                {
                    GPlanData data = dgData.Rows[e.RowIndex].Tag as GPlanData;
                    if (data != null)
                    {
                        frmCreateClassGPlanSetDetail fGPD = new frmCreateClassGPlanSetDetail();
                        fGPD.SetGPlanData(data);
                        fGPD.SetMOENameAndXml(SelectGroupName, SelectMOEXml);
                        if (fGPD.ShowDialog() == DialogResult.OK)
                        {
                            GPlanData newData = fGPD.GetGPlanData();
                            dgData.Rows[e.RowIndex].Tag = newData;
                            dgData.Rows[e.RowIndex].Cells[colDiffSujeCount.Index].Value = newData.calSubjDiffCount();
                            // 更新科目
                            dgData.Rows[e.RowIndex].Cells[colUpdateSubjCount.Index].Value = newData.calSubjUpdateCount();
                        }
                    }
                }
            }
        }