Beispiel #1
0
        //public TransferStudentData TransferStudentData { get; set; }

        public Step1(TransferStudentForm parent)
        {
            InitializeComponent();

            _parent = parent;

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

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

            List <string> dailyBehaviorItems = TransferStudentDAL.GetDailyBehaviorItems();

            foreach (string dailyBehavior in dailyBehaviorItems)
            {
                dgDailyBehavior.Columns.Add(dailyBehavior, dailyBehavior);
            }

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

                DataGridViewRow row = dgDailyBehavior.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 dailyBehaviorItems)
                {
                    DailyBehaviorItem item = _parent.TransferStudentData.DailyBehaviorData.GetItem(each, sh.SchoolYear, sh.Semester);

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

            _dailyBehaviorDegrees = TransferStudentDAL.GetDailyBehaviorDegrees();

            //處理團體活動輸入畫面
            dgTeam.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgTeam.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgTeam.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgTeam.Columns[SEMESTER_COLUMN].Width = 60;

            _groupActivityItems = TransferStudentDAL.GetGroupActivitieItems();
            foreach (string each in _groupActivityItems)
            {
                string each1 = GetGADegreeColName(each);
                string each2 = GetGATextColName(each);

                int columnIndex1 = dgTeam.Columns.Add(each1, each1);
                int columnIndex2 = dgTeam.Columns.Add(each2, each2);

                DataGridViewColumn column1 = dgTeam.Columns[columnIndex1];
                DataGridViewColumn column2 = dgTeam.Columns[columnIndex2];

                column1.Tag = each;
                column2.Tag = each;
            }

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

                DataGridViewRow row = dgTeam.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 _groupActivityItems)
                {
                    GroupActivityItem item = _parent.TransferStudentData.GroupActivityData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[GetGADegreeColName(each)].Value = item.Degree;
                        row.Cells[GetGATextColName(each)].Value   = item.Text;
                    }
                }
            }

            _groupActivityDegrees = TransferStudentDAL.GetGroupActivityDegrees();
        }
        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);
                }
            }
        }
Beispiel #3
0
        public void OnChangeStep()
        {
            //將值塞入 _data 中
            foreach (DataGridViewRow row in dgDailyBehavior.Rows)
            {
                SemesterHistoryData sh = row.Tag as SemesterHistoryData;

                foreach (DataGridViewColumn column in dgDailyBehavior.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();
                    }

                    DailyBehaviorItem item = new DailyBehaviorItem();
                    item.SchoolYear = sh.SchoolYear;
                    item.Semester   = sh.Semester;
                    //item.Index = string.Empty;
                    item.Name   = column.Name;
                    item.Degree = value;

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

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

                foreach (string groupActivityItem in _groupActivityItems)
                {
                    string           degree     = string.Empty;
                    DataGridViewCell degreeCell = row.Cells[GetGADegreeColName(groupActivityItem)];
                    if (degreeCell.Value != null)
                    {
                        degree = degreeCell.Value.ToString();
                    }

                    string           text     = string.Empty;
                    DataGridViewCell textCell = row.Cells[GetGATextColName(groupActivityItem)];
                    if (textCell.Value != null)
                    {
                        text = textCell.Value.ToString();
                    }

                    GroupActivityItem item = new GroupActivityItem();
                    item.SchoolYear = sh.SchoolYear;
                    item.Semester   = sh.Semester;
                    item.Name       = groupActivityItem;
                    item.Degree     = degree;
                    item.Text       = text;

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