示例#1
0
        public void OnChangeStep()
        {
            foreach (DataGridViewRow row in dgDailyLifeRecommend.Rows)
            {
                SemesterHistoryData sh = row.Tag as SemesterHistoryData;

                foreach (DataGridViewColumn column in dgDailyLifeRecommend.Columns)
                {
                    if (column.Name == SCHOOL_YEAR_COLUMN)
                    {
                        continue;
                    }
                    if (column.Name == SEMESTER_COLUMN)
                    {
                        continue;
                    }

                    string value = string.Empty;

                    if (row.Cells[column.Name].Value != null)
                    {
                        value = row.Cells[column.Name].Value.ToString();
                    }

                    DailyLifeRecommendItem item = new DailyLifeRecommendItem();
                    item.SchoolYear  = sh.SchoolYear;
                    item.Semester    = sh.Semester;
                    item.Name        = column.Name;
                    item.Description = value;

                    _parent.TransferStudentData.DailyLifeRecommendData.SetItem(item);
                }
            }

            //將值塞入 _data 中
            foreach (DataGridViewRow row in dgPublicService.Rows)
            {
                SemesterHistoryData sh = row.Tag as SemesterHistoryData;

                foreach (DataGridViewColumn column in dgPublicService.Columns)
                {
                    if (column.Name == SCHOOL_YEAR_COLUMN)
                    {
                        continue;
                    }
                    if (column.Name == SEMESTER_COLUMN)
                    {
                        continue;
                    }

                    string value = string.Empty;

                    if (row.Cells[column.Name].Value != null)
                    {
                        value = row.Cells[column.Name].Value.ToString();
                    }

                    PublicServiceItem item = new PublicServiceItem();
                    item.SchoolYear  = sh.SchoolYear;
                    item.Semester    = sh.Semester;
                    item.Name        = column.Name;
                    item.Description = value;

                    _parent.TransferStudentData.PublicServiceData.SetItem(item);
                }
            }

            foreach (DataGridViewRow row in dgSchoolSpecial.Rows)
            {
                SemesterHistoryData sh = row.Tag as SemesterHistoryData;

                foreach (DataGridViewColumn column in dgSchoolSpecial.Columns)
                {
                    if (column.Name == SCHOOL_YEAR_COLUMN)
                    {
                        continue;
                    }
                    if (column.Name == SEMESTER_COLUMN)
                    {
                        continue;
                    }

                    string value = string.Empty;

                    if (row.Cells[column.Name].Value != null)
                    {
                        value = row.Cells[column.Name].Value.ToString();
                    }

                    SchoolSpecialItem item = new SchoolSpecialItem();
                    item.SchoolYear  = sh.SchoolYear;
                    item.Semester    = sh.Semester;
                    item.Name        = column.Name;
                    item.Description = value;

                    _parent.TransferStudentData.SchoolSpecialData.SetItem(item);
                }
            }
        }
示例#2
0
        public Step2(TransferStudentForm parent)
        {
            _parent = parent;

            InitializeComponent();

            if (Student.Instance.SelectedList.Count == 0)
            {
                return;
            }
            _studentID = Student.Instance.SelectedList[0].ID;

            // 處理日常生活表現畫面
            dgDailyLifeRecommend.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgDailyLifeRecommend.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgDailyLifeRecommend.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgDailyLifeRecommend.Columns[SEMESTER_COLUMN].Width = 65;

            List <string> dailyLifeRecommendItems = TransferStudentDAL.GetDailyLifeRecommendItems();

            foreach (string dailyLifeRecommend in dailyLifeRecommendItems)
            {
                int columnIndex           = dgDailyLifeRecommend.Columns.Add(dailyLifeRecommend, dailyLifeRecommend);
                DataGridViewColumn column = dgDailyLifeRecommend.Columns[columnIndex];
                column.Width = 400;
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgDailyLifeRecommend.Rows.Add();

                DataGridViewRow row = dgDailyLifeRecommend.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                //把值塞進來 .....
                foreach (string dailyLifeRecommend in dailyLifeRecommendItems)
                {
                    DailyLifeRecommendItem item = _parent.TransferStudentData.DailyLifeRecommendData.GetItem(dailyLifeRecommend, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[dailyLifeRecommend].Value = item.Description;
                    }
                }
            }

            _dailyLifeRecommendDegrees = TransferStudentDAL.GetDailyLifeRecommendMapping();

            // 公共服務表現畫面
            dgPublicService.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgPublicService.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgPublicService.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgPublicService.Columns[SEMESTER_COLUMN].Width = 65;

            List <string> PublicServiceServiceItems = TransferStudentDAL.GetPublicServicesItems();

            foreach (string dailyBehavior in TransferStudentDAL.GetPublicServicesItems())
            {
                dgPublicService.Columns.Add(dailyBehavior, dailyBehavior);
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgPublicService.Rows.Add();

                DataGridViewRow row = dgPublicService.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                foreach (string each in PublicServiceServiceItems)
                {
                    PublicServiceItem item = _parent.TransferStudentData.PublicServiceData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[each].Value = item.Description;
                    }
                }
            }

            //校內外特殊表現輸入畫面
            dgSchoolSpecial.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgSchoolSpecial.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgSchoolSpecial.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgSchoolSpecial.Columns[SEMESTER_COLUMN].Width = 65;

            List <string> schoolSpecialItems = TransferStudentDAL.GetSchoolSpecialItems();

            foreach (string each in schoolSpecialItems)
            {
                dgSchoolSpecial.Columns.Add(each, each);
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgSchoolSpecial.Rows.Add();

                DataGridViewRow row = dgSchoolSpecial.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                foreach (string each in schoolSpecialItems)
                {
                    SchoolSpecialItem item = _parent.TransferStudentData.SchoolSpecialData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[each].Value = item.Description;
                    }
                }
            }
        }
        public TransferStudentData(XmlElement response)
        {
            this.DailyBehaviorData      = new DailyBehaviorData();
            this.GroupActivityData      = new GroupActivityData();
            this.PublicServiceData      = new PublicServiceData();
            this.SchoolSpecialData      = new SchoolSpecialData();
            this.DailyLifeRecommendData = new DailyLifeRecommendData();
            this.AbsenceData            = new AbsenceData();
            this.MeritStatisticData     = new MeritStatisticData();
            this.SourceFlags            = new List <SourceFlag>();
            if (response == null)
            {
                return;
            }

            foreach (XmlNode node in response.SelectNodes("SemesterMoralScore"))
            {
                string schoolyear = node.SelectSingleNode("SchoolYear").InnerText;
                string semester   = node.SelectSingleNode("Semester").InnerText;

                SourceFlag sourceFlag = new SourceFlag();
                sourceFlag.SchoolYear = schoolyear;
                sourceFlag.Semester   = semester;
                XmlElement sourceElement;

                if (node.SelectSingleNode("Summary").ChildNodes.Count > 0)
                {
                    sourceFlag.Flag          = Flag.Summary;
                    sourceElement            = (XmlElement)node.SelectSingleNode("Summary");
                    sourceFlag.SourceElement = sourceElement;
                }
                else
                {
                    sourceFlag.Flag          = Flag.IntialSummary;
                    sourceElement            = (XmlElement)node.SelectSingleNode("InitialSummary");
                    sourceFlag.SourceElement = sourceElement;
                }
                SourceFlags.Add(sourceFlag);

                //處理日常生活表現
                foreach (XmlNode itemNode in node.SelectNodes("TextScore/DailyBehavior/Item"))
                {
                    XmlElement        itemElement = (XmlElement)itemNode;
                    DailyBehaviorItem item        = new DailyBehaviorItem();

                    item.SchoolYear = schoolyear;
                    item.Semester   = semester;
                    item.Degree     = itemElement.GetAttribute("Degree");
                    item.Name       = itemElement.GetAttribute("Name");
                    item.Index      = itemElement.GetAttribute("Index");
                    this.DailyBehaviorData.Items.Add(item);
                }

                //處理團隊活動表現
                foreach (XmlNode itemNode in node.SelectNodes("TextScore/GroupActivity/Item"))
                {
                    XmlElement        itemElement = (XmlElement)itemNode;
                    GroupActivityItem item        = new GroupActivityItem();

                    item.SchoolYear = schoolyear;
                    item.Semester   = semester;
                    item.Degree     = itemElement.GetAttribute("Degree");
                    item.Name       = itemElement.GetAttribute("Name");
                    item.Text       = itemElement.GetAttribute("Description");
                    this.GroupActivityData.Items.Add(item);
                }

                //處理公共服務表現
                foreach (XmlNode itemNode in node.SelectNodes("TextScore/PublicService/Item"))
                {
                    XmlElement        itemElement = (XmlElement)itemNode;
                    PublicServiceItem item        = new PublicServiceItem();

                    item.SchoolYear  = schoolyear;
                    item.Semester    = semester;
                    item.Name        = itemElement.GetAttribute("Name");
                    item.Description = itemElement.GetAttribute("Description");
                    this.PublicServiceData.Items.Add(item);
                }

                //處理校內外特殊表現
                foreach (XmlNode itemNode in node.SelectNodes("TextScore/SchoolSpecial/Item"))
                {
                    XmlElement        itemElement = (XmlElement)itemNode;
                    SchoolSpecialItem item        = new SchoolSpecialItem();

                    item.SchoolYear  = schoolyear;
                    item.Semester    = semester;
                    item.Name        = itemElement.GetAttribute("Name");
                    item.Description = itemElement.GetAttribute("Description");
                    this.SchoolSpecialData.Items.Add(item);
                }

                //日常生活表現具體建議
                //foreach (XmlNode itemNode in node.SelectNodes("TextScore/DailyLifeRecommend/Item"))
                foreach (XmlNode itemNode in node.SelectNodes("TextScore/DailyLifeRecommend"))
                {
                    XmlElement             itemElement = (XmlElement)itemNode;
                    DailyLifeRecommendItem item        = new DailyLifeRecommendItem();

                    item.SchoolYear  = schoolyear;
                    item.Semester    = semester;
                    item.Name        = itemElement.GetAttribute("Name");
                    item.Description = itemElement.GetAttribute("Description");
                    this.DailyLifeRecommendData.Items.Add(item);
                }

                //缺曠統計
                foreach (XmlNode itemNode in sourceElement.SelectNodes("AttendanceStatistics/Absence"))
                {
                    XmlElement  itemElement = (XmlElement)itemNode;
                    AbsenceItem item        = new AbsenceItem();

                    item.SchoolYear = schoolyear;
                    item.Semester   = semester;
                    item.Name       = itemElement.GetAttribute("Name");
                    item.PeriodType = itemElement.GetAttribute("PeriodType");

                    int count;
                    if (!int.TryParse(itemElement.GetAttribute("Count"), out count))
                    {
                        count = 0;
                    }
                    item.Count = count;

                    this.AbsenceData.Items.Add(item);
                }

                //懲統計
                foreach (XmlNode itemNode in sourceElement.SelectNodes("DisciplineStatistics/Demerit"))
                {
                    XmlElement         itemElement = (XmlElement)itemNode;
                    MeritStatisticItem itemA       = new MeritStatisticItem();

                    itemA.SchoolYear = schoolyear;
                    itemA.Semester   = semester;
                    itemA.MeritType  = "大過";
                    int count;
                    if (!int.TryParse(itemElement.GetAttribute("A"), out count))
                    {
                        count = 0;
                    }
                    itemA.Count = count;

                    this.MeritStatisticData.Items.Add(itemA);

                    MeritStatisticItem itemB = new MeritStatisticItem();

                    itemB.SchoolYear = schoolyear;
                    itemB.Semester   = semester;
                    itemB.MeritType  = "小過";

                    if (!int.TryParse(itemElement.GetAttribute("B"), out count))
                    {
                        count = 0;
                    }
                    itemB.Count = count;

                    this.MeritStatisticData.Items.Add(itemB);

                    MeritStatisticItem itemC = new MeritStatisticItem();

                    itemC.SchoolYear = schoolyear;
                    itemC.Semester   = semester;
                    itemC.MeritType  = "警告";

                    if (!int.TryParse(itemElement.GetAttribute("C"), out count))
                    {
                        count = 0;
                    }
                    itemC.Count = count;

                    this.MeritStatisticData.Items.Add(itemC);
                }

                //獎統計
                foreach (XmlNode itemNode in sourceElement.SelectNodes("DisciplineStatistics/Merit"))
                {
                    XmlElement         itemElement = (XmlElement)itemNode;
                    MeritStatisticItem itemA       = new MeritStatisticItem();

                    itemA.SchoolYear = schoolyear;
                    itemA.Semester   = semester;
                    itemA.MeritType  = "大功";
                    int count;
                    if (!int.TryParse(itemElement.GetAttribute("A"), out count))
                    {
                        count = 0;
                    }
                    itemA.Count = count;

                    this.MeritStatisticData.Items.Add(itemA);

                    MeritStatisticItem itemB = new MeritStatisticItem();

                    itemB.SchoolYear = schoolyear;
                    itemB.Semester   = semester;
                    itemB.MeritType  = "小功";

                    if (!int.TryParse(itemElement.GetAttribute("B"), out count))
                    {
                        count = 0;
                    }
                    itemB.Count = count;

                    this.MeritStatisticData.Items.Add(itemB);

                    MeritStatisticItem itemC = new MeritStatisticItem();

                    itemC.SchoolYear = schoolyear;
                    itemC.Semester   = semester;
                    itemC.MeritType  = "嘉獎";

                    if (!int.TryParse(itemElement.GetAttribute("C"), out count))
                    {
                        count = 0;
                    }
                    itemC.Count = count;

                    this.MeritStatisticData.Items.Add(itemC);
                }
            }
        }