Ejemplo n.º 1
0
        /// <summary>
        /// 取得選擇社團的資料
        /// </summary>
        public static Dictionary <string, CLUBRecord> GetClubRecord()
        {
            Dictionary <string, CLUBRecord> dic = new Dictionary <string, CLUBRecord>();

            foreach (CLUBRecord each in _AccessHelper.Select <CLUBRecord>(UDT_S.PopOneCondition("UID", ClubAdmin.Instance.SelectedSource)))
            {
                if (!dic.ContainsKey(each.UID))
                {
                    dic.Add(each.UID, each);
                }
            }
            return(dic);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 取得選擇社團的學生社團參與記錄
        /// </summary>
        public static Dictionary <string, SCJoin> GetSCJoin()
        {
            Dictionary <string, SCJoin> dic = new Dictionary <string, SCJoin>();

            foreach (SCJoin each in _AccessHelper.Select <SCJoin>(UDT_S.PopOneCondition("ref_club_id", ClubAdmin.Instance.SelectedSource)))
            {
                if (!dic.ContainsKey(each.UID))
                {
                    dic.Add(each.UID, each);
                }
            }
            return(dic);
        }
Ejemplo n.º 3
0
        void BGW_DoWork(object sender, DoWorkEventArgs e)
        {
            ClubDic = GetClubDic();

            List <SCJoin> SCJoin = _AccessHelper.Select <SCJoin>(UDT_S.PopOneCondition("ref_club_id", ClubDic.Values.ToList().Select(X => X.UID).ToList()));

            StudentDic = GetStudentDic(SCJoin);

            //主要資料內容
            DataDic = new Dictionary <string, StudRepeatObj>();

            //建立學生容器
            foreach (SCJoin each in SCJoin)
            {
                if (!DataDic.ContainsKey(each.RefStudentID))
                {
                    if (StudentDic.ContainsKey(each.RefStudentID))
                    {
                        StudRepeatObj sr = new StudRepeatObj(StudentDic[each.RefStudentID]);
                        sr._SCJoinList.Add(each);

                        DataDic.Add(each.RefStudentID, sr);
                    }
                }
                else
                {
                    DataDic[each.RefStudentID]._SCJoinList.Add(each);
                }
            }


            //依據資料內容呈現在畫面上

            List <StudRepeatObj> list = new List <StudRepeatObj>();

            foreach (string each in DataDic.Keys)
            {
                if (DataDic[each]._SCJoinList.Count > 1)
                {
                    list.Add(DataDic[each]);
                }
            }

            e.Result = list;
        }
Ejemplo n.º 4
0
        static private void DeleteClub()
        {
            DialogResult dr = MsgBox.Show("確認刪除所選社團?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (dr == DialogResult.Yes)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("已刪除選擇社團:");
                List <CLUBRecord> ClubList = tool._A.Select <CLUBRecord>(UDT_S.PopOneCondition("UID", ClubAdmin.Instance.SelectedSource));
                foreach (CLUBRecord each in ClubList)
                {
                    sb.AppendLine(string.Format("學年度「{0}」學期「{1}」社團名稱「{2}」", each.SchoolYear.ToString(), each.Semester.ToString(), each.ClubName));
                }

                List <SCJoin> SCJList = tool._A.Select <SCJoin>(UDT_S.PopOneCondition("ref_club_id", ClubAdmin.Instance.SelectedSource));
                if (SCJList.Count != 0)
                {
                    MsgBox.Show("刪除社團必須清空社團參與學生!");
                    return;
                }

                try
                {
                    tool._A.DeletedValues(ClubList);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("社團刪除失敗!!\n" + ex.Message);
                    SmartSchool.ErrorReporting.ReportingService.ReportException(ex);
                    return;
                }
                FISCA.LogAgent.ApplicationLog.Log("社團", "刪除社團", sb.ToString());
                MsgBox.Show("社團刪除成功!!");
                ClubEvents.RaiseAssnChanged();
            }
            else
            {
                MsgBox.Show("已中止刪除社團操作!!");
            }
        }