//取得需列印的項目清單
        private List <String> GetUserType()
        {
            List <String> displayList = new List <string>();

            Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User[ConfigType];
            String config = cd["假別設定"];

            if (!string.IsNullOrEmpty(config))
            {
                try
                {
                    XmlElement print = DSXmlHelper.LoadXml(config);

                    foreach (XmlElement elem in print.SelectNodes("//Type"))
                    {
                        String text  = elem.GetAttribute("Text");
                        String value = elem.GetAttribute("Value");
                        displayList.Add(text + "_" + value);
                    }
                }
                catch
                {
                    MessageBox.Show("取得假別設定失敗,請重新確認假別設定");
                }
            }
            return(displayList);
        }
Exemple #2
0
        //節次設定
        private Dictionary <string, List <string> > GetUserType()
        {
            Dictionary <string, List <string> > dic = new Dictionary <string, List <string> >();

            Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User[ConfigType];
            string config = cd["節次設定"];

            if (!string.IsNullOrEmpty(config))
            {
                XmlElement print = DSXmlHelper.LoadXml(config);

                foreach (XmlElement type in print.SelectNodes("Type"))
                {
                    string typeName = type.GetAttribute("Text");

                    if (!dic.ContainsKey(typeName))
                    {
                        dic.Add(typeName, new List <string>());
                    }

                    foreach (XmlElement absence in type.SelectNodes("Absence"))
                    {
                        string absenceName = absence.GetAttribute("Text");

                        if (!dic[typeName].Contains(absenceName))
                        {
                            dic[typeName].Add(absenceName);
                        }
                    }
                }
            }


            return(dic);
        }
Exemple #3
0
        //紙張設定
        private int GetSizeIndex()
        {
            Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User[ConfigPrint];
            string config = cd["紙張設定"];
            int    x      = 0;

            int.TryParse(config, out x);
            return(x); //如果是數值就回傳,如果不是回傳預設
        }
Exemple #4
0
        /// <summary>
        /// 設定可搜尋欄位
        /// </summary>
        private MenuButton SetSearchButton(string MenuName, string BoolMenuName, Campus.Configuration.ConfigData cd)
        {
            MenuButton SearchName = SearchConditionMenu[MenuName];

            SearchName.AutoCheckOnClick    = true;
            SearchName.AutoCollapseOnClick = false;
            SearchName.Checked             = CheckStringIsBool(cd[BoolMenuName]);
            SearchName.Click += delegate
            {
                cd[BoolMenuName] = SearchName.Checked.ToString();;
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            return(SearchName);
        }
        /// <summary>
        /// 傳入設定檔名稱與設定檔參數
        /// </summary>
        /// <param name="ConfigName">設定檔名稱</param>
        ///

        public SelectPrintSizeForm(String ConfigPrint)
        {
            InitializeComponent();

            _ConfigPrint = ConfigPrint;

            cd = Campus.Configuration.Config.User[_ConfigPrint];
            string config = cd["紙張設定"];
            int    x      = 0;

            if (!string.IsNullOrEmpty(config))
            {
                //列印資訊
                int.TryParse(config, out x);
            }
            comboBoxEx1.SelectedIndex = x;
        }
        /// <summary>
        /// 將試別填入ComboBox。
        /// </summary>
        private void FillToComboBox()
        {
            cboExamList.Items.Clear();

            foreach (var record in _aeIncludeRecordList)
            {
                cboExamList.Items.Add(new ExamComboBoxItem(record));
            }
            if (cboExamList.Items.Count > 0)
            {
                Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User["新竹課程成績輸入考試別"];
                string str = cd["新竹課程成績輸入考試別"];
                int    idx = cboExamList.FindString(str);
                if (idx < 0)
                {
                    cboExamList.SelectedIndex = 0;
                }
                else
                {
                    cboExamList.SelectedIndex = idx;
                }
            }
        }
Exemple #7
0
        private void _BGWAbsenceAndPeriodList_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            #region 預設畫面載入
            System.Windows.Forms.DataGridViewTextBoxColumn colName = new DataGridViewTextBoxColumn();
            colName.HeaderText   = "假別分類";
            colName.MinimumWidth = 70;
            colName.Name         = "colName";
            colName.ReadOnly     = true;
            colName.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            colName.Width        = 70;
            this.dataGridViewX1.Columns.Add(colName);

            //設定DataGridView的欄位屬性
            foreach (string absence in absenceList)
            {
                System.Windows.Forms.DataGridViewCheckBoxColumn newCol = new DataGridViewCheckBoxColumn();
                newCol.HeaderText = absence;
                newCol.Width      = 55;
                newCol.ReadOnly   = false;
                newCol.SortMode   = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
                newCol.Tag        = absence;
                newCol.ValueType  = typeof(bool);
                this.dataGridViewX1.Columns.Add(newCol);
            }

            //新增一個row
            foreach (String type in typeList)
            {
                DataGridViewRow addrow = new DataGridViewRow();
                addrow.CreateCells(dataGridViewX1, type);
                addrow.Tag = type;
                this.dataGridViewX1.Rows.Add(addrow);
            }

            #endregion

            #region 讀取上次設定
            cd = Campus.Configuration.Config.User[_ConfigPrint];
            string StringLine = cd[name];
            if (!string.IsNullOrEmpty(StringLine))
            {
                try
                {
                    XmlElement config = DSXmlHelper.LoadXml(StringLine);
                    foreach (XmlElement elem in config.SelectNodes("//Type"))
                    {
                        String text  = elem.GetAttribute("Text");
                        String value = elem.GetAttribute("Value");
                        foreach (DataGridViewRow row in dataGridViewX1.Rows)
                        {
                            foreach (DataGridViewCell cell in row.Cells)
                            {
                                if (cell.OwningRow.Tag == null || cell.OwningColumn.Tag == null)
                                {
                                    continue;
                                }
                                if (cell.OwningRow.Tag.ToString() == text && cell.OwningColumn.Tag.ToString() == value)
                                {
                                    cell.Value = true;
                                }
                            }
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("讀取上次設定失敗");
                }
            }

            #endregion
        }
        public GraduationAdmin()
        {
            //畢業生檔案檢索
            Group = "畢業";

            GraduationEvents.GraduationChanged += new EventHandler(GraduationEvents_GraduationChanged);

            BGW.DoWork             += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            #region 班級
            Field1              = new ListPaneField("班級");
            Field1.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].ClassName;
                }
            };
            this.AddListPaneField(Field1);
            #endregion
            #region 座號
            Field2 = new ListPaneField("座號");
            //Field2.CompareValue += new EventHandler<CompareValueEventArgs>(Field2_CompareValue);
            Field2.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].SeatNo;
                }
            };
            this.AddListPaneField(Field2);
            #endregion
            #region 姓名
            Field3              = new ListPaneField("姓名");
            Field3.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].Name;
                }
            };
            this.AddListPaneField(Field3);
            #endregion
            #region 學號
            Field4              = new ListPaneField("學號");
            Field4.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].StudentNumber;
                }
            };
            this.AddListPaneField(Field4);
            #endregion
            #region 姓別
            Field5              = new ListPaneField("姓別");
            Field5.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].Gender;
                }
            };
            this.AddListPaneField(Field5);
            #endregion
            #region 身分證號
            Field6              = new ListPaneField("身分證號");
            Field6.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].IDNumber;
                }
            };
            this.AddListPaneField(Field6);
            #endregion
            #region 戶籍地址
            Field7              = new ListPaneField("戶籍地址");
            Field7.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].PermanentAddress;
                }
            };
            this.AddListPaneField(Field7);
            #endregion
            #region 聯絡地址
            Field8              = new ListPaneField("聯絡地址");
            Field8.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].MailingAddress;
                }
            };
            this.AddListPaneField(Field8);
            #endregion
            #region 其它地址
            Field9              = new ListPaneField("其它地址");
            Field9.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].OtherAddresses;
                }
            };
            this.AddListPaneField(Field9);
            #endregion
            #region 備註
            Field10              = new ListPaneField("備註");
            Field10.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (TestDic.ContainsKey(e.Key))
                {
                    e.Value = TestDic[e.Key].Remarks;
                }
            };
            this.AddListPaneField(Field10);
            #endregion

            #region 學年度篩選
            FilterMenu.Visible = false;
            //FilterMenu.SupposeHasChildern = true;
            //FilterMenu.PopupOpen += delegate(object sender, PopupOpenEventArgs e)
            //{
            //foreach (string item in SemesterCourse.Keys)
            //{
            //    MenuButton mb = e.VirtualButtons[item];
            //    mb.AutoCheckOnClick = true;
            //    mb.AutoCollapseOnClick = true;
            //    mb.Checked = (item == FiltedSemester);
            //    mb.Tag = item;
            //    mb.CheckedChanged += delegate(object sender1, EventArgs e1)
            //    {
            //        MenuButton mb1 = sender1 as MenuButton;
            //        SetFilterSource(mb1.Text);
            //        FiltedSemester = FilterMenu.Text = mb1.Text;
            //        mb1.Checked = true;
            //    };
            //}
            //};

            #endregion

            //BGW.RunWorkerAsync(); //取得各項資料課程

            //預設選擇上一學年度畢業班級
            //int defSchool = int.Parse(School.DefaultSchoolYear) - 1;
            //FiltedSemester = defSchool + "學年度畢業班級";
            //FilterMenu.Text = FiltedSemester;
            //SetFilterSource(FiltedSemester);

            #region 搜尋
            Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User["AssociationSearchOptionPreference"];
            SearchStudentName = SearchConditionMenu["姓名"];
            SearchStudentName.AutoCheckOnClick    = true;
            SearchStudentName.AutoCollapseOnClick = false;
            SearchStudentName.Checked             = CheckBool(cd["SearchGraduateStudentName"]);
            SearchStudentName.Click += delegate
            {
                cd["SearchGraduateStudentName"] = SearchStudentName.Checked.ToString();
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchStudentNumber = SearchConditionMenu["學號"];
            SearchStudentNumber.AutoCheckOnClick    = true;
            SearchStudentNumber.AutoCollapseOnClick = false;
            SearchStudentNumber.Checked             = CheckBool(cd["SearchGraduateStudentNumber"]);
            SearchStudentNumber.Click += delegate
            {
                cd["SearchGraduateStudentNumber"] = SearchStudentNumber.Checked.ToString();
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchIDNumber = SearchConditionMenu["身分證號"];
            SearchIDNumber.AutoCheckOnClick    = true;
            SearchIDNumber.AutoCollapseOnClick = false;
            SearchIDNumber.Checked             = CheckBool(cd["SearchGraduateIDNumber"]);
            SearchIDNumber.Click += delegate
            {
                cd["SearchGraduateIDNumber"] = SearchIDNumber.Checked.ToString();
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchClassName = SearchConditionMenu["畢業班級"];
            SearchClassName.AutoCheckOnClick    = true;
            SearchClassName.AutoCollapseOnClick = false;
            SearchClassName.Checked             = CheckBool(cd["SearchGraduateClass"]);
            SearchClassName.Click += delegate
            {
                cd["SearchGraduateClass"] = SearchClassName.Checked.ToString();
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchAddress = SearchConditionMenu["地址"];
            SearchAddress.AutoCheckOnClick    = true;
            SearchAddress.AutoCollapseOnClick = false;
            SearchAddress.Checked             = CheckBool(cd["SearchGraduateAddress"]);
            SearchAddress.Click += delegate
            {
                cd["SearchGraduateAddress"] = SearchAddress.Checked.ToString();
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchRemarks = SearchConditionMenu["備註"];
            SearchRemarks.AutoCheckOnClick    = true;
            SearchRemarks.AutoCollapseOnClick = false;
            SearchRemarks.Checked             = CheckBool(cd["SearchGraduateRemarks"]);
            SearchRemarks.Click += delegate
            {
                cd["SearchGraduateRemarks"] = SearchRemarks.Checked.ToString();
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as Campus.Configuration.ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            #endregion

            this.Search += new EventHandler <SearchEventArgs>(GraduationAdmin_Search);
        }
Exemple #9
0
        public ClubAdmin()
        {
            Group = "社團";

            #region 事件

            BGW.DoWork             += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            //社團自我更新事件
            ClubEvents.ClubChanged += new EventHandler(ClubEvents_ClubChanged);

            #endregion

            #region 社團系統編號
            Field0_0              = new ListPaneField("社團系統編號");
            Field0_0.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].UID;
                }
            };
            this.AddListPaneField(Field0_0);
            #endregion
            #region 代碼
            Field0              = new ListPaneField("代碼");
            Field0.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].ClubNumber;
                }
            };
            this.AddListPaneField(Field0);
            #endregion
            #region 學年度
            Field1_1              = new ListPaneField("學年度");
            Field1_1.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].SchoolYear;
                }
            };
            this.AddListPaneField(Field1_1);
            #endregion
            #region 學期
            Field1_2              = new ListPaneField("學期");
            Field1_2.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].Semester;
                }
            };
            this.AddListPaneField(Field1_2);
            #endregion
            #region  稱
            Field1              = new ListPaneField("名稱");
            Field1.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].ClubName;
                }
            };
            this.AddListPaneField(Field1);
            #endregion
            #region 類型
            Field12              = new ListPaneField("類型");
            Field12.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].ClubCategory;
                }
            };
            this.AddListPaneField(Field12);
            #endregion
            #region 老師
            Field2              = new ListPaneField("老師1");
            Field2.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    if (TeacherDic.ContainsKey(AllClubDic[e.Key].RefTeacherID))
                    {
                        if (string.IsNullOrEmpty(TeacherDic[AllClubDic[e.Key].RefTeacherID].Nickname))
                        {
                            e.Value = TeacherDic[AllClubDic[e.Key].RefTeacherID].Name;
                        }
                        else
                        {
                            string terName = TeacherDic[AllClubDic[e.Key].RefTeacherID].Name;
                            string Nicname = TeacherDic[AllClubDic[e.Key].RefTeacherID].Nickname;
                            e.Value = terName + "(" + Nicname + ")";
                        }
                    }
                }
            };
            this.AddListPaneField(Field2);

            Field2_2              = new ListPaneField("老師2");
            Field2_2.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    if (TeacherDic.ContainsKey(AllClubDic[e.Key].RefTeacherID2))
                    {
                        if (string.IsNullOrEmpty(TeacherDic[AllClubDic[e.Key].RefTeacherID2].Nickname))
                        {
                            e.Value = TeacherDic[AllClubDic[e.Key].RefTeacherID2].Name;
                        }
                        else
                        {
                            string terName = TeacherDic[AllClubDic[e.Key].RefTeacherID2].Name;
                            string Nicname = TeacherDic[AllClubDic[e.Key].RefTeacherID2].Nickname;
                            e.Value = terName + "(" + Nicname + ")";
                        }
                    }
                }
            };
            this.AddListPaneField(Field2_2);

            Field2_3              = new ListPaneField("老師3");
            Field2_3.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    if (TeacherDic.ContainsKey(AllClubDic[e.Key].RefTeacherID3))
                    {
                        if (string.IsNullOrEmpty(TeacherDic[AllClubDic[e.Key].RefTeacherID3].Nickname))
                        {
                            e.Value = TeacherDic[AllClubDic[e.Key].RefTeacherID3].Name;
                        }
                        else
                        {
                            string terName = TeacherDic[AllClubDic[e.Key].RefTeacherID3].Name;
                            string Nicname = TeacherDic[AllClubDic[e.Key].RefTeacherID3].Nickname;
                            e.Value = terName + "(" + Nicname + ")";
                        }
                    }
                }
            };
            this.AddListPaneField(Field2_3);
            #endregion
            #region 場地
            Field3              = new ListPaneField("場地");
            Field3.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].Location;
                }
            };
            this.AddListPaneField(Field3);
            #endregion
            #region 社長
            Field4              = new ListPaneField("社長");
            Field4.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    //需取得社員資料
                    //對照出社長姓名
                    if (StudentDic.ContainsKey(AllClubDic[e.Key].President))
                    {
                        e.Value = StudentDic[AllClubDic[e.Key].President].StudentName;
                    }
                }
            };
            this.AddListPaneField(Field4);
            #endregion
            #region 副社長
            Field5              = new ListPaneField("副社長");
            Field5.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    //需取得副社員資料
                    //對照出副社長姓名
                    if (StudentDic.ContainsKey(AllClubDic[e.Key].VicePresident))
                    {
                        e.Value = StudentDic[AllClubDic[e.Key].VicePresident].StudentName;
                    }
                }
            };
            this.AddListPaneField(Field5);
            #endregion
            #region 性別條件
            Field6              = new ListPaneField("性別條件");
            Field6.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    e.Value = AllClubDic[e.Key].GenderRestrict;
                }
            };
            this.AddListPaneField(Field6);
            #endregion
            #region 科別限制
            Field7              = new ListPaneField("科別限制");
            Field7.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    if (AllClubDic[e.Key].DeptRestrict != "")
                    {
                        List <string> list = new List <string>();
                        XmlElement    xml  = DSXmlHelper.LoadXml(AllClubDic[e.Key].DeptRestrict);
                        foreach (XmlElement mini in xml.SelectNodes("Dept"))
                        {
                            list.Add(mini.InnerText);
                        }
                        string deptString = string.Join(",", list);
                        e.Value = deptString;
                    }
                }
            };
            this.AddListPaneField(Field7);
            #endregion
            #region 一年級人數限制
            Field8              = new ListPaneField("一年級人數/上限");
            Field8.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    //1年級的人數??
                    int count1 = 0;

                    if (ClubCountSCJoin.ContainsKey(e.Key))
                    {
                        count1 = ClubCountSCJoin[e.Key].一年級人數;
                    }

                    //人數上限
                    string count2 = AllClubDic[e.Key].Grade1Limit.HasValue ? AllClubDic[e.Key].Grade1Limit.Value.ToString() : "";
                    if (string.IsNullOrEmpty(count2))
                    {
                        e.Value = count1 + "/無限制";
                    }
                    else
                    {
                        e.Value = count1 + "/" + count2;
                    }
                }
            };
            this.AddListPaneField(Field8);
            #endregion
            #region 二年級人數限制
            Field9              = new ListPaneField("二年級人數/上限");
            Field9.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    //2年級的人數??
                    int count1 = 0;

                    if (ClubCountSCJoin.ContainsKey(e.Key))
                    {
                        count1 = ClubCountSCJoin[e.Key].二年級人數;
                    }

                    //人數上限
                    string count2 = AllClubDic[e.Key].Grade2Limit.HasValue ? AllClubDic[e.Key].Grade2Limit.Value.ToString() : "";
                    if (string.IsNullOrEmpty(count2))
                    {
                        e.Value = count1 + "/無限制";
                    }
                    else
                    {
                        e.Value = count1 + "/" + count2;
                    }
                }
            };
            this.AddListPaneField(Field9);
            #endregion
            #region  年級人數限制
            Field10              = new ListPaneField("三年級人數/上限");
            Field10.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    //3年級的人數??
                    int count1 = 0;

                    if (ClubCountSCJoin.ContainsKey(e.Key))
                    {
                        count1 = ClubCountSCJoin[e.Key].年級人數;
                    }

                    //人數上限
                    string count2 = AllClubDic[e.Key].Grade3Limit.HasValue ? AllClubDic[e.Key].Grade3Limit.Value.ToString() : "";
                    if (string.IsNullOrEmpty(count2))
                    {
                        e.Value = count1 + "/無限制";
                    }
                    else
                    {
                        e.Value = count1 + "/" + count2;
                    }
                }
            };
            this.AddListPaneField(Field10);
            #endregion
            #region 目前人數 / 社團人數上限
            Field11              = new ListPaneField("目前總人數/上限");
            Field11.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (AllClubDic.ContainsKey(e.Key))
                {
                    //count出本社團的SCJoin數量
                    //就是人數
                    int count1 = 0;

                    if (ClubCountSCJoin.ContainsKey(e.Key))
                    {
                        count1 = ClubCountSCJoin[e.Key].社團人數;
                    }

                    string count2 = AllClubDic[e.Key].Limit.HasValue ? AllClubDic[e.Key].Limit.Value.ToString() : "";
                    if (string.IsNullOrEmpty(count2))
                    {
                        e.Value = count1 + "/無限制";
                    }
                    else
                    {
                        e.Value = count1 + "/" + count2;
                    }
                }
            };
            this.AddListPaneField(Field11);
            #endregion


            FilterMenu.SupposeHasChildern = true;
            FilterMenu.PopupOpen         += new EventHandler <PopupOpenEventArgs>(FilterMenu_PopupOpen);
            //目前預設學年期設為標題
            FilterMenu.Text = FiltedSemester;

            //設定預設學年期
            //SetClubList(FiltedSemester);

            #region Search

            Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User["ClubSearchOptionPreference"];

            SearchClubName    = SetSearchButton("名稱", "SearchClubName", cd);
            SearchClubTeacher = SetSearchButton("老師", "SearchClubTeacher", cd);
            SearchStudentName = SetSearchButton("參與學生", "SearchClubStudentName", cd);
            SearchAddress     = SetSearchButton("場地", "SearchClubAddress", cd);
            #endregion

            this.Search += new EventHandler <SearchEventArgs>(ClubAdmin_Search);

            //取得社團基本資料
            BGW.RunWorkerAsync();
        }
Exemple #10
0
        void _BGWAbsenceAndPeriodList_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            #region 填入預設畫面
            System.Windows.Forms.DataGridViewTextBoxColumn colName = new DataGridViewTextBoxColumn();
            colName.HeaderText   = "節次分類";
            colName.MinimumWidth = 70;
            colName.Name         = "colName";
            colName.ReadOnly     = true;
            colName.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            colName.Width        = 70;
            this.dataGridViewX1.Columns.Add(colName);

            foreach (string absence in absenceList)
            {
                System.Windows.Forms.DataGridViewCheckBoxColumn newCol = new DataGridViewCheckBoxColumn();
                newCol.HeaderText = absence;
                newCol.Width      = 55;
                newCol.ReadOnly   = false;
                newCol.SortMode   = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
                newCol.Tag        = absence;
                newCol.ValueType  = typeof(bool);
                this.dataGridViewX1.Columns.Add(newCol);
            }
            foreach (string type in typeList)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dataGridViewX1, type);
                row.Tag = type;
                dataGridViewX1.Rows.Add(row);
            }
            #endregion

            #region 讀取列印設定 Preference

            cd = Campus.Configuration.Config.User[_ConfigPrint];
            string StringLine = cd[name];
            if (!string.IsNullOrEmpty(StringLine))
            {
                XmlElement config = DSXmlHelper.LoadXml(StringLine);

                if (config != null)
                {
                    //已有設定檔則將設定檔內容填回畫面上
                    foreach (XmlElement type in config.SelectNodes("Type"))
                    {
                        string typeName = type.GetAttribute("Text");
                        foreach (DataGridViewRow row in dataGridViewX1.Rows)
                        {
                            if (typeName == ("" + row.Tag))
                            {
                                foreach (XmlElement absence in type.SelectNodes("Absence"))
                                {
                                    string absenceName = absence.GetAttribute("Text");
                                    foreach (DataGridViewCell cell in row.Cells)
                                    {
                                        if (cell.OwningColumn is DataGridViewCheckBoxColumn && ("" + cell.OwningColumn.Tag) == absenceName)
                                        {
                                            cell.Value = true;
                                        }
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }

            #endregion
        }
        /// <summary>
        /// 按下「儲存」時觸發。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cboExamList.Text))
            {
                FISCA.Presentation.Controls.MsgBox.Show("沒有試別無法儲存.");
                return;
            }

            dgv.EndEdit();

            if (!IsValid())
            {
                MsgBox.Show("請先修正錯誤再儲存。");
                return;
            }

            try
            {
                //List<SCETakeRecordEditor> editors = MakeSCETakeRecordEditors();
                //if (editors.Count > 0) editors.SaveAll();
                bool           checkLoadSave = false;
                RecordIUDLists lists         = GetRecords();

                // 檢查超過 0~100
                if (lists.DeleteList.Count > 0)
                {
                    foreach (HsinChu.JHEvaluation.Data.HC.JHSCETakeRecord sc in lists.DeleteList)
                    {
                        if (sc.AssignmentScore.HasValue)
                        {
                            if ((sc.AssignmentScore < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.AssignmentScore.Value)) || sc.AssignmentScore > 100)
                            {
                                checkLoadSave = true;
                            }
                        }
                        if (sc.Score.HasValue)
                        {
                            if ((sc.Score < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.Score.Value)) || sc.Score > 100)
                            {
                                checkLoadSave = true;
                            }
                        }
                    }
                }

                if (lists.InsertList.Count > 0)
                {
                    foreach (HsinChu.JHEvaluation.Data.HC.JHSCETakeRecord sc in lists.InsertList)
                    {
                        if (sc.AssignmentScore.HasValue)
                        {
                            if ((sc.AssignmentScore < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.AssignmentScore.Value)) || sc.AssignmentScore > 100)
                            {
                                checkLoadSave = true;
                            }
                        }
                        if (sc.Score.HasValue)
                        {
                            if ((sc.Score < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.Score.Value)) || sc.Score > 100)
                            {
                                checkLoadSave = true;
                            }
                        }
                    }
                }

                if (lists.UpdateList.Count > 0)
                {
                    foreach (HsinChu.JHEvaluation.Data.HC.JHSCETakeRecord sc in lists.UpdateList)
                    {
                        if (sc.AssignmentScore.HasValue)
                        {
                            if ((sc.AssignmentScore < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.AssignmentScore.Value)) || sc.AssignmentScore > 100)
                            {
                                checkLoadSave = true;
                            }
                        }
                        if (sc.Score.HasValue)
                        {
                            if ((sc.Score < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.Score.Value)) || sc.Score > 100)
                            {
                                checkLoadSave = true;
                            }
                        }
                    }
                }

                if (checkLoadSave)
                {
                    CheckSaveForm csf = new CheckSaveForm();
                    csf.ShowDialog();
                    if (csf.DialogResult == DialogResult.Cancel)
                    {
                        return;
                    }
                }

                if (lists.InsertList.Count > 0)
                {
                    JHSchool.Data.JHSCETake.Insert(lists.InsertList.AsJHSCETakeRecords());
                }
                if (lists.UpdateList.Count > 0)
                {
                    JHSchool.Data.JHSCETake.Update(lists.UpdateList.AsJHSCETakeRecords());
                }
                if (lists.DeleteList.Count > 0)
                {
                    JHSchool.Data.JHSCETake.Delete(lists.DeleteList.AsJHSCETakeRecords());
                }

                //記憶所選的試別
                Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User["新竹課程成績輸入考試別"];
                cd["新竹課程成績輸入考試別"] = cboExamList.Text;
                cd.Save();

                MsgBox.Show("儲存成功。");

                // 記修改後 log
                SetSaveDataToLog();
                // 存 Log
                prlp.SetActionBy("課程", "課程成績輸入");
                prlp.SetAction("課程成績輸入");
                prlp.SetDescTitle("");
                prlp.SaveLog("", "", "Course", _course.ID);

                // 重新記修改前 Log
                SetLoadDataToLog();

                ExamComboBoxItem item = cboExamList.SelectedItem as ExamComboBoxItem;
                GetScoresAndFill(item.AEIncludeRecord);
            }
            catch (Exception ex)
            {
                MsgBox.Show("儲存失敗。\n" + ex.Message);
                //throw ex;
            }

            // // 載入分數顏色
            LoadDvScoreColor();
        }