Пример #1
0
        private void SyncStudentMenuItemStatus()
        {
            Dictionary <string, ButtonItem> _students = new Dictionary <string, ButtonItem>();

            foreach (object obj in btnAdd.SubItems)
            {
                ButtonItem each = obj as ButtonItem;
                if (each == null)
                {
                    continue;
                }

                StudentRecord stu = each.Tag as StudentRecord;

                if (stu != null)
                {
                    //if (!stu.IsNormal)
                    //{
                    //    each.Enabled = false;
                    //    each.Tooltip = "需為在校生才能加入課程。";
                    //}
                    //else
                    //    _students.Add(stu.ID, each);
                }
            }
            foreach (ListViewItem each in lvStudents.Items)
            {
                AttendInfo info = each as AttendInfo;
                if (_students.ContainsKey(info.RefStudentID.ToString()))
                {
                    _students[info.RefStudentID.ToString()].Enabled = false;
                    _students[info.RefStudentID.ToString()].Tooltip = "此學生已在修課清單中";
                }
            }
        }
Пример #2
0
        private void AddAddend(StudentRecord student)
        {
            // 檢查是否要加入
            bool CheckAdd = true;

            foreach (ListViewItem lvi in lvStudents.Items)
            {
                AttendInfo ai = lvi as AttendInfo;
                // 表示學生已經加入
                if (ai.RefStudentID == student.ID)
                {
                    CheckAdd = false;
                    break;
                }
            }

            if (CheckAdd)
            {
                AttendInfo   newItem = new AttendInfo(student);
                CourseRecord info    = Course.Instance.Items[RunningID];

                lvStudents.Items.Add(newItem);
                newItem.EnsureVisible();
                OnValueChanged("IsDirty", "True");
                label2.Text = lvStudents.Items.Count.ToString();
            }
        }
Пример #3
0
 private void lvStudents_DoubleClick(object sender, EventArgs e)
 {
     if (lvStudents.FocusedItem != null)
     {
         AttendInfo info = lvStudents.FocusedItem as AttendInfo;
         Student.Instance.PopupDetailPane(info.RefStudentID);
     }
 }
Пример #4
0
        private bool RemoveSelected()
        {
            DSResponse rsp = null;

            try
            {
                rsp = CourseGradeB.Feature.Legacy.QueryCourse.GetSECTake(RunningID);
            }
            catch (Exception ex)
            {
                //CurrentUser user = CurrentUser.Instance;
                //BugReporter.ReportException(user.SystemName, user.SystemVersion, ex, false);
                MsgBox.Show("移除學生修課記錄失敗:" + ex.Message, Application.ProductName);
                return(false);
            }

            List <AttendInfo> cannot = new List <AttendInfo>();
            List <AttendInfo> can    = new List <AttendInfo>();
            int index = lvStudents.Items.Count - 1;

            for (; index >= 0; index--)
            {
                AttendInfo each = lvStudents.Items[index] as AttendInfo;
                if (each.Selected)
                {
                    if (rsp.GetContent().GetElement("Score/AttendID[.='" + each.Identity + "']") == null)
                    {
                        can.Add(each);
                    }
                    else
                    {
                        cannot.Add(each);
                    }
                }
            }

            if (cannot.Count > 0)
            {
                string names = string.Empty;
                foreach (AttendInfo each in cannot)
                {
                    names += string.Format("{0,-12}  {1}", each.Class, each.StudentName + "\n");
                }
                MsgBox.Show("下列學生已經有評量成績,請先刪除評量成績再移除學生修課記錄。\n\n" + names, Application.ProductName);
                return(false);
            }
            else
            {
                _delete_list.AddRange(can);
                foreach (AttendInfo each in can)
                {
                    each.Remove();
                }
                return(true);
            }
        }
Пример #5
0
        private void ChangeSelectedItemsRequired(string value)
        {
            if (lvStudents.SelectedItems.Count > 0)
            {
                OnValueChanged("IsDirty", "True");
            }

            foreach (ListViewItem each in lvStudents.SelectedItems)
            {
                AttendInfo info = each as AttendInfo;
                info.IsRequired = value;
            }
        }
Пример #6
0
        private void AddAddend(StudentRecord student)
        {
            // 檢查是否要加入
            bool CheckAdd = true;

            foreach (ListViewItem lvi in lvStudents.Items)
            {
                AttendInfo ai = lvi as AttendInfo;
                // 表示學生已經加入
                if (ai.RefStudentID == student.ID)
                {
                    CheckAdd = false;
                    break;
                }
            }

            if (CheckAdd)
            {
                AttendInfo   newItem = new AttendInfo(student);
                CourseRecord info    = Course.Instance.Items[RunningID];
                //GraduationPlanSubject subject = student.GraduationPlanInfo.GetSubjectInfo(
                //    info.Subject,
                //    info.SubjectLevel
                //    );

                //if (subject.Required == "必修")
                //    newItem.IsRequired = "必";
                //if (subject.Required == "選修")
                //    newItem.IsRequired = "選";
                //newItem.RequiredBy = subject.RequiredBy;


                lvStudents.Items.Add(newItem);
                newItem.EnsureVisible();
                OnValueChanged("IsDirty", "True");
                label2.Text = lvStudents.Items.Count.ToString();
            }
        }
Пример #7
0
        private void GetList(List <AttendInfo> insertList, List <AttendInfo> updateList, List <AttendInfo> deleteList)
        {
            foreach (ListViewItem each in lvStudents.Items)
            {
                AttendInfo info = each as AttendInfo;
                if (info.Identity == -1) //新增
                {
                    insertList.Add(info);
                }
                else if (info.IsDirty) //修改
                {
                    updateList.Add(info);
                }
            }

            foreach (AttendInfo each in _delete_list)
            {
                if (each.Identity != -1) //刪除
                {
                    deleteList.Add(each);
                }
            }
        }
Пример #8
0
        private void AddRow(AttendInfo p)
        {
            if (t.Rows.Count % 2 == 0)
                t.DefaultCell.BackgroundColor = new GrayColor(240);
            else
                t.DefaultCell.BackgroundColor = BaseColor.WHITE;

            var t2 = new PdfPTable(w2);
            t2.WidthPercentage = 100;
            t2.DefaultCell.Border = border;
            t2.DefaultCell.Padding = 5;
            var name = new Phrase(p.Name + "\n", font);
            name.Add(new Chunk("  ({0})".Fmt(p.PeopleId), smallfont));
            t2.AddCell(name);
            var addr = new StringBuilder(p.Address);
            AddLine(addr, p.Address2);
            AddLine(addr, p.CSZ);
            t2.AddCell(new Phrase(addr.ToString(), font));
            var phones = new StringBuilder();
            AddPhone(phones, p.HomePhone, "h ");
            AddPhone(phones, p.CellPhone, "c ");
            AddLine(phones, p.Email);
            t2.AddCell(new Phrase(phones.ToString(), font));
            var c = new PdfPCell(t.DefaultCell);
            c.AddElement(GetAttendance(p.PeopleId));
            c.Colspan = 3;
            t2.AddCell(c);
            c = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t2);
            t.AddCell(c);

            var t3 = new PdfPTable(w3);
            t3.WidthPercentage = 100;
            t3.DefaultCell.Border = border;
            t3.DefaultCell.Padding = 5;
            t3.DefaultCell.PaddingBottom = 0;
            t3.AddCell(new Phrase(p.Birthday, font));
            t3.AddCell(new Phrase(p.MemberStatus));
            var contacts = GetContacts(p.PeopleId);
            if (contacts.Items.Count > 0)
            {
                c = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(new Chunk("Contacts", boldfont));
                t3.AddCell(c);
                c = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(contacts);
                t3.AddCell(c);
            }
            c = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t3);
            t.AddCell(c);
        }
Пример #9
0
        private void AddRow(AttendInfo p)
        {
            if (t.Rows.Count % 2 == 0)
            {
                t.DefaultCell.BackgroundColor = new GrayColor(240);
            }
            else
            {
                t.DefaultCell.BackgroundColor = BaseColor.WHITE;
            }

            var t2 = new PdfPTable(w2);

            t2.WidthPercentage     = 100;
            t2.DefaultCell.Border  = border;
            t2.DefaultCell.Padding = 5;
            var name = new Phrase(p.Name + "\n", font);

            name.Add(new Chunk("  ({0})".Fmt(p.PeopleId), smallfont));
            t2.AddCell(name);
            var addr = new StringBuilder(p.Address);

            AddLine(addr, p.Address2);
            AddLine(addr, p.CSZ);
            t2.AddCell(new Phrase(addr.ToString(), font));
            var phones = new StringBuilder();

            AddPhone(phones, p.HomePhone, "h ");
            AddPhone(phones, p.CellPhone, "c ");
            AddLine(phones, p.Email);
            t2.AddCell(new Phrase(phones.ToString(), font));
            var c = new PdfPCell(t.DefaultCell);

            c.AddElement(GetAttendance(p.PeopleId));
            c.Colspan = 3;
            t2.AddCell(c);
            c         = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t2);
            t.AddCell(c);

            var t3 = new PdfPTable(w3);

            t3.WidthPercentage           = 100;
            t3.DefaultCell.Border        = border;
            t3.DefaultCell.Padding       = 5;
            t3.DefaultCell.PaddingBottom = 0;
            t3.AddCell(new Phrase(p.Birthday, font));
            t3.AddCell(new Phrase(p.MemberStatus));
            var contacts = GetContacts(p.PeopleId);

            if (contacts.Items.Count > 0)
            {
                c         = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(new Chunk("Contacts", boldfont));
                t3.AddCell(c);
                c         = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(contacts);
                t3.AddCell(c);
            }
            c         = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t3);
            t.AddCell(c);
        }