コード例 #1
0
        void BGW_DoWork(object sender, DoWorkEventArgs e)
        {
            List<CLUBRecord> ClubPrimaryList = tool._A.Select<CLUBRecord>(string.Format("UID = '{0}'", this.PrimaryKey));
            if (ClubPrimaryList.Count != 1)
            {
                //如果取得2門以上 或 沒取得社團時
                e.Cancel = true;
                return;
            }
            _CLUBRecord = ClubPrimaryList[0];

            //本社團的學生參與記錄
            scMAG = new ScJoinMag(this.PrimaryKey, 1);

            ClassDic = tool.GetClassDic(scMAG.SCJoinStudent_LIst);
        }
コード例 #2
0
        private CLUBRecord GetClub()
        {
            CLUBRecord club = new CLUBRecord();
            club.ClubName = txtClubName.Text.Trim(); //社團名稱
            club.SchoolYear = intSchoolYear.Value; //學年度
            club.Semester = intSemester.Value; //學期
            club.ClubCategory = cbCategory.Text.Trim(); //類型
            club.ClubNumber = tbClubNumber.Text.Trim(); //代碼

            int x;
            if (int.TryParse(tbTotalNumberHours.Text, out x))
                club.TotalNumberHours = x; //总课时数
            else
                club.TotalNumberHours = null;

            #region 總人數

            if (!string.IsNullOrEmpty(tbLimit1.Text.Trim()))
                club.Grade1Limit = tool.StringIsInt_DefIsZero(tbLimit1.Text.Trim());

            if (!string.IsNullOrEmpty(tbLimit2.Text.Trim()))
                club.Grade2Limit = tool.StringIsInt_DefIsZero(tbLimit2.Text.Trim());

            if (!string.IsNullOrEmpty(tbLimit3.Text.Trim()))
                club.Grade3Limit = tool.StringIsInt_DefIsZero(tbLimit3.Text.Trim());

            if (!string.IsNullOrEmpty(tbLimit4.Text.Trim()))
                club.Grade4Limit = tool.StringIsInt_DefIsZero(tbLimit4.Text.Trim());

            if (!string.IsNullOrEmpty(tbLimit5.Text.Trim()))
                club.Grade5Limit = tool.StringIsInt_DefIsZero(tbLimit5.Text.Trim());

            #endregion

            #region 男生

            if (!string.IsNullOrEmpty(tbBoyLimit1.Text.Trim()))
                club.Grade1BoyLimit = tool.StringIsInt_DefIsZero(tbBoyLimit1.Text.Trim());

            if (!string.IsNullOrEmpty(tbBoyLimit2.Text.Trim()))
                club.Grade2BoyLimit = tool.StringIsInt_DefIsZero(tbBoyLimit2.Text.Trim());

            if (!string.IsNullOrEmpty(tbBoyLimit3.Text.Trim()))
                club.Grade3BoyLimit = tool.StringIsInt_DefIsZero(tbBoyLimit3.Text.Trim());

            if (!string.IsNullOrEmpty(tbBoyLimit4.Text.Trim()))
                club.Grade4BoyLimit = tool.StringIsInt_DefIsZero(tbBoyLimit4.Text.Trim());

            if (!string.IsNullOrEmpty(tbBoyLimit5.Text.Trim()))
                club.Grade5BoyLimit = tool.StringIsInt_DefIsZero(tbBoyLimit5.Text.Trim());

            #endregion

            #region 女生

            if (!string.IsNullOrEmpty(tbGirlLimit1.Text.Trim()))
                club.Grade1GirlLimit = tool.StringIsInt_DefIsZero(tbGirlLimit1.Text.Trim());

            if (!string.IsNullOrEmpty(tbGirlLimit2.Text.Trim()))
                club.Grade2GirlLimit = tool.StringIsInt_DefIsZero(tbGirlLimit2.Text.Trim());

            if (!string.IsNullOrEmpty(tbGirlLimit3.Text.Trim()))
                club.Grade3GirlLimit = tool.StringIsInt_DefIsZero(tbGirlLimit3.Text.Trim());

            if (!string.IsNullOrEmpty(tbGirlLimit4.Text.Trim()))
                club.Grade4GirlLimit = tool.StringIsInt_DefIsZero(tbGirlLimit4.Text.Trim());

            if (!string.IsNullOrEmpty(tbGirlLimit5.Text.Trim()))
                club.Grade5GirlLimit = tool.StringIsInt_DefIsZero(tbGirlLimit5.Text.Trim());

            #endregion


            //社團老師
            if (cbTeacher.SelectedItem != null)
            {
                TeacherObj cbi = (TeacherObj)cbTeacher.SelectedItem;
                club.RefTeacherID = cbi.TeacherID;
            }

            if (cbTeacher2.SelectedItem != null)
            {
                TeacherObj cbi = (TeacherObj)cbTeacher2.SelectedItem;
                club.RefTeacherID2 = cbi.TeacherID;
            }

            if (cbTeacher3.SelectedItem != null)
            {
                TeacherObj cbi = (TeacherObj)cbTeacher3.SelectedItem;
                club.RefTeacherID3 = cbi.TeacherID;
            }

            //社團場地
            if (!string.IsNullOrEmpty(cbLocation.Text.Trim()))
                club.Location = cbLocation.Text.Trim();

            club.About = tbAboutClub.Text.Trim(); //簡介

            return club;
        }
コード例 #3
0
        public override string Import(List<Campus.DocumentValidator.IRowStream> Rows)
        {
            if (mOption.Action == ImportAction.InsertOrUpdate)
            {
                List<CLUBRecord> ClubInsertList = new List<CLUBRecord>();
                List<CLUBRecord> ClubUpdateList = new List<CLUBRecord>();

                foreach (IRowStream Row in Rows)
                { //教师名称
                    string SchoolYear = Row.GetValue("学年度");
                    string Semester = Row.GetValue("学期");
                    string CLUBName = Row.GetValue("课程名称");
                    string name = SchoolYear + "," + Semester + "," + CLUBName;

                    if (Importbot.ClubDic.ContainsKey(name)) //更新
                    {
                        CLUBRecord club = Importbot.ClubDic[name];
                        if (!Log_Dic.ContainsKey(club.UID))
                        {
                            ImputLog i_n = new ImputLog();
                            i_n.lo_CLUB = club.CopyExtension();
                            Log_Dic.Add(club.UID, i_n);
                        }

                        Importbot.SetClub(Row, club);
                        ClubUpdateList.Add(club);
                    }
                    else
                    {
                        //新增
                        CLUBRecord club = new CLUBRecord();
                        club.SchoolYear = int.Parse(SchoolYear);
                        club.Semester = int.Parse(Semester);
                        club.ClubName = CLUBName;

                        Importbot.SetClub(Row, club);
                        ClubInsertList.Add(club);
                    }
                }

                if (ClubInsertList.Count > 0)
                {
                    StringBuilder mstrLog1 = new StringBuilder();
                    mstrLog1.AppendLine("新增汇入课程:");
                    foreach (CLUBRecord each in ClubInsertList)
                    {
                        mstrLog1.AppendLine(Importbot.GetLogString(each));
                    }
                    tool._A.InsertValues(ClubInsertList);
                    FISCA.LogAgent.ApplicationLog.Log("课程", "新增汇入", mstrLog1.ToString());
                }

                if (ClubUpdateList.Count > 0)
                {
                    StringBuilder mstrLog2 = new StringBuilder();
                    mstrLog2.AppendLine("更新汇入课程:");
                    foreach (CLUBRecord each in ClubUpdateList)
                    {
                        if (Log_Dic.ContainsKey(each.UID))
                        {
                            Log_Dic[each.UID].New_club = each.CopyExtension();
                            mstrLog2.AppendLine(Importbot.SetLog(Log_Dic[each.UID]));
                        }

                    }
                    tool._A.UpdateValues(ClubUpdateList);
                    FISCA.LogAgent.ApplicationLog.Log("课程", "更新汇入", mstrLog2.ToString());
                }
                ClubEvents.RaiseAssnChanged();
            }

            return "";

        }
コード例 #4
0
        public void SetClub(IRowStream Row, CLUBRecord club)
        {
            club.ClubNumber = Row.GetValue("代码");
            club.Location = Row.GetValue("场地");
            club.ClubCategory = Row.GetValue("类型");

            club.FullPhase = Row.GetValue("长短课程") == "长课程";
            club.Domain = Row.GetValue("课程领域");
            club.Type = Row.GetValue("课程属性");
            club.Formal = Row.GetValue("上课形式");

            club.RefTeacherID = checkTeacherName("" + Row.GetValue("老师1"));
            club.RefTeacherID2 = checkTeacherName("" + Row.GetValue("老师2"));
            club.RefTeacherID3 = checkTeacherName("" + Row.GetValue("老师3"));

            int x;
            if (int.TryParse("" + Row.GetValue("总课时数"), out x))
                club.TotalNumberHours = x;
            else
                club.TotalNumberHours = null;

            club.About = Row.GetValue("简介");

            #region 选课人数限制

            if (int.TryParse("" + Row.GetValue("限制:一年级选课人数限制"), out x))
                club.Grade1Limit = x;
            else
                club.Grade1Limit = null;

            if (int.TryParse("" + Row.GetValue("限制:二年级选课人数限制"), out x))
                club.Grade2Limit = x;
            else
                club.Grade2Limit = null;

            if (int.TryParse("" + Row.GetValue("限制:三年级选课人数限制"), out x))
                club.Grade3Limit = x;
            else
                club.Grade3Limit = null;

            if (int.TryParse("" + Row.GetValue("限制:四年级选课人数限制"), out x))
                club.Grade4Limit = x;
            else
                club.Grade4Limit = null;

            if (int.TryParse("" + Row.GetValue("限制:五年级选课人数限制"), out x))
                club.Grade5Limit = x;
            else
                club.Grade5Limit = null; 

            #endregion

            #region 选课人数男生限制

            if (int.TryParse("" + Row.GetValue("限制:一年级选课人数男生限制"), out x))
                club.Grade1BoyLimit = x;
            else
                club.Grade1BoyLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:二年级选课人数男生限制"), out x))
                club.Grade2BoyLimit = x;
            else
                club.Grade2BoyLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:三年级选课人数男生限制"), out x))
                club.Grade3BoyLimit = x;
            else
                club.Grade3BoyLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:四年级选课人数男生限制"), out x))
                club.Grade4BoyLimit = x;
            else
                club.Grade4BoyLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:五年级选课人数男生限制"), out x))
                club.Grade5BoyLimit = x;
            else
                club.Grade5BoyLimit = null; 

            #endregion

            #region 选课人数女生限制

            if (int.TryParse("" + Row.GetValue("限制:一年级选课人数女生限制"), out x))
                club.Grade1GirlLimit = x;
            else
                club.Grade1GirlLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:二年级选课人数女生限制"), out x))
                club.Grade2GirlLimit = x;
            else
                club.Grade2GirlLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:三年级选课人数女生限制"), out x))
                club.Grade3GirlLimit = x;
            else
                club.Grade3GirlLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:四年级选课人数女生限制"), out x))
                club.Grade4GirlLimit = x;
            else
                club.Grade4GirlLimit = null;

            if (int.TryParse("" + Row.GetValue("限制:五年级选课人数女生限制"), out x))
                club.Grade5GirlLimit = x;
            else
                club.Grade5GirlLimit = null; 

            #endregion

        }
コード例 #5
0
        public string GetLogString(CLUBRecord each)
        {
            StringBuilder log = new StringBuilder();
            log.AppendLine(string.Format("学年度「{0}」学期「{1}」课程名称「{2}」", each.SchoolYear, each.Semester, each.ClubName));
            if (!string.IsNullOrEmpty(each.ClubNumber))
                log.AppendLine(string.Format("代码「{0}」", each.ClubNumber));
            if (!string.IsNullOrEmpty(each.Location))
                log.AppendLine(string.Format("场地「{0}」", each.Location));
            if (!string.IsNullOrEmpty(each.ClubCategory))
                log.AppendLine(string.Format("类型「{0}」", each.ClubCategory));

            if (!string.IsNullOrEmpty(each.RefTeacherID))
            {
                if (TeacherIDDic.ContainsKey(each.RefTeacherID))
                {
                    log.AppendLine(string.Format("老师1「{0}」", GetTeacherName(TeacherIDDic[each.RefTeacherID])));
                }
            }
            if (!string.IsNullOrEmpty(each.RefTeacherID2))
            {
                if (TeacherIDDic.ContainsKey(each.RefTeacherID2))
                {
                    log.AppendLine(string.Format("老师2「{0}」", GetTeacherName(TeacherIDDic[each.RefTeacherID2])));
                }
            }

            if (!string.IsNullOrEmpty(each.RefTeacherID3))
            {
                if (TeacherIDDic.ContainsKey(each.RefTeacherID3))
                {
                    log.AppendLine(string.Format("老师3「{0}」", GetTeacherName(TeacherIDDic[each.RefTeacherID3])));
                }
            }

            if (each.TotalNumberHours.HasValue)
                log.AppendLine(string.Format("总课时数「{0}」", each.TotalNumberHours.Value));

            if (!string.IsNullOrEmpty(each.About))
                log.AppendLine(string.Format("简介「{0}」", each.About));

            if (each.Grade1Limit.HasValue)
                log.AppendLine(string.Format("限制:一年级选课人数限制「{0}」", each.Grade1Limit.Value.ToString()));
            if (each.Grade2Limit.HasValue)
                log.AppendLine(string.Format("限制:二年级选课人数限制「{0}」", each.Grade2Limit.Value.ToString()));
            if (each.Grade3Limit.HasValue)
                log.AppendLine(string.Format("限制:三年级选课人数限制「{0}」", each.Grade3Limit.Value.ToString()));
            if (each.Grade4Limit.HasValue)
                log.AppendLine(string.Format("限制:四年级选课人数限制「{0}」", each.Grade4Limit.Value.ToString()));
            if (each.Grade5Limit.HasValue)
                log.AppendLine(string.Format("限制:五年级选课人数限制「{0}」", each.Grade5Limit.Value.ToString()));

            if (each.Grade1BoyLimit.HasValue)
                log.AppendLine(string.Format("限制:一年级选课人数男生限制「{0}」", each.Grade1BoyLimit.Value.ToString()));
            if (each.Grade2BoyLimit.HasValue)
                log.AppendLine(string.Format("限制:二年级选课人数男生限制「{0}」", each.Grade2BoyLimit.Value.ToString()));
            if (each.Grade3BoyLimit.HasValue)
                log.AppendLine(string.Format("限制:三年级选课人数男生限制「{0}」", each.Grade3BoyLimit.Value.ToString()));
            if (each.Grade4BoyLimit.HasValue)
                log.AppendLine(string.Format("限制:四年级选课人数男生限制「{0}」", each.Grade4BoyLimit.Value.ToString()));
            if (each.Grade5BoyLimit.HasValue)
                log.AppendLine(string.Format("限制:五年级选课人数男生限制「{0}」", each.Grade5BoyLimit.Value.ToString()));

            if (each.Grade1GirlLimit.HasValue)
                log.AppendLine(string.Format("限制:一年级选课人数女生限制「{0}」", each.Grade1GirlLimit.Value.ToString()));
            if (each.Grade2GirlLimit.HasValue)
                log.AppendLine(string.Format("限制:二年级选课人数女生限制「{0}」", each.Grade2GirlLimit.Value.ToString()));
            if (each.Grade3GirlLimit.HasValue)
                log.AppendLine(string.Format("限制:三年级选课人数女生限制「{0}」", each.Grade3GirlLimit.Value.ToString()));
            if (each.Grade4GirlLimit.HasValue)
                log.AppendLine(string.Format("限制:四年级选课人数女生限制「{0}」", each.Grade4GirlLimit.Value.ToString()));
            if (each.Grade5GirlLimit.HasValue)
                log.AppendLine(string.Format("限制:五年级选课人数女生限制「{0}」", each.Grade5GirlLimit.Value.ToString()));

            return log.ToString();

        }
 private int SortClub(CLUBRecord cr1, CLUBRecord cr2)
 {
     return cr1.ClubCategory.CompareTo(cr2.ClubCategory);
 }
コード例 #7
0
        /// <summary>
        /// 排除已存在於本社團之學生
        /// </summary>
        public void CheckTempStudentInCourse(List<string> IsSaft, Dictionary<string, List<SCJoin>> SCJoin_Dic, CLUBRecord _CLUBRecord, int phase)
        {
            //檢查已經加入本階段修課的學生
            foreach (string each in IsSaft)
            {
                if (!SCJoin_Dic.ContainsKey(each))
                {
                    //可加入社團之學生
                    InsertList.Add(each);
                }
                else
                {
                    SCJoin scjK = new SCJoin();
                    foreach (SCJoin scj in SCJoin_Dic[each])
                    {
                        if (string.IsNullOrEmpty(scjK.UID))
                        {
                            scjK = scj;
                            continue;
                        }

                        //如果是相同階段別之學生
                        if (scjK.Phase == scj.Phase)
                        {
                            //重覆加入社團之學生
                            ReMoveTemp.Add(each);
                        }
                    }

                }
            }
            //取得可加入學生的社團參與記錄(所有學期)
            List<SCJoin> scjList = tool._A.Select<SCJoin>("ref_student_id in ('" + string.Join("','", InsertList) + "')");

            if (scjList.Count != 0)
            {
                Dictionary<string, CLUBRecord> clubDic = GetDistinctClub(scjList);

                foreach (SCJoin each in scjList)
                {    //增加判斷已不存在的社團
                    if (clubDic.ContainsKey(each.RefClubID))
                    {
                        //學年度學期相同
                        if (clubDic[each.RefClubID].SchoolYear == _CLUBRecord.SchoolYear && clubDic[each.RefClubID].Semester == _CLUBRecord.Semester)
                        {
                            //同階段已加入
                            if (each.Phase == phase)
                                ReDoubleTemp.Add(each);
                            //已加入長課程,或者已加入其他課程但是要加入長課程
                            else if (clubDic[each.RefClubID].FullPhase == true || _CLUBRecord.FullPhase == true)

                                ReDoubleTemp.Add(each);

                            ////判斷待處理學生,是否已經有社團參與記錄(SCJoin)
                            //if (IsSaft.Contains(each.RefStudentID))
                            //{
                            //    //有記錄則先剔除
                            //    IsSaft.Remove(each.RefStudentID);
                            //}
                        }
                    }
                }
            }
        }
コード例 #8
0
        void BGW_DoWork(object sender, DoWorkEventArgs e)
        {
            //取得社團資料
            List<CLUBRecord> ClubPrimaryList = _AccessHelper.Select<CLUBRecord>(string.Format("UID = '{0}'", this.PrimaryKey));
            if (ClubPrimaryList.Count != 1)
            {
                //如果取得2門以上 或 沒取得社團時
                e.Cancel = true;
                return;
            }

            ClubPrimary = ClubPrimaryList[0];
            Log_ClubPrimary = ClubPrimary.CopyExtension();
        }
コード例 #9
0
        void BGW_DoWork(object sender, DoWorkEventArgs e)
        {
            //StudentNameDic.Clear();

            //取得社團資料
            List<CLUBRecord> ClubPrimaryList = _AccessHelper.Select<CLUBRecord>(string.Format("UID = '{0}'", this.PrimaryKey));
            if (ClubPrimaryList.Count != 1)
            {
                //如果取得2門以上 或 沒取得社團時
                e.Cancel = true;
                return;
            }

            ClubPrimary = ClubPrimaryList[0];
            Log_ClubPrimary = ClubPrimary.CopyExtension();

            //取得場地[GROUP BY]
            string TableName = Tn._CLUBRecordUDT;
            DataTable dt = _QueryHelper.Select("select location from " + TableName.ToLower() + " group by location ORDER by location");
            ClubLocation.Clear();
            foreach (DataRow row in dt.Rows)
            {
                string loc = "" + row[0];
                ClubLocation.Add(loc);
            }
            ClubLocation.Sort();

            //取得社團類型[Group By]
            TableName = Tn._CLUBRecordUDT;
            dt = _QueryHelper.Select("select club_category from " + TableName.ToLower() + " group by club_category ORDER by club_category");
            ClubCategory.Clear();
            foreach (DataRow row in dt.Rows)
            {
                string loc = "" + row[0];
                if (string.IsNullOrEmpty(loc))
                    continue;
                ClubCategory.Add(loc);
            }
            ClubCategory.Sort();

            //取得老師資料
            TeacherList.Clear();
            TeacherDic.Clear();
            TeacherNameDic.Clear();
            dt = _QueryHelper.Select("select teacher.id,teacher.teacher_name,teacher.nickname from teacher ORDER by teacher_name");
            foreach (DataRow row in dt.Rows)
            {
                TeacherObj obj = new TeacherObj();
                obj.TeacherID = "" + row[0];
                obj.TeacherName = ("" + row[1]).Trim();
                obj.TeacherNickName = ("" + row[2]).Trim();
                TeacherList.Add(obj);

                if (!TeacherDic.ContainsKey(obj.TeacherID))
                {
                    TeacherDic.Add(obj.TeacherID, obj);
                }

                if (!TeacherNameDic.ContainsKey(obj.TeacherFullName))
                {
                    TeacherNameDic.Add(obj.TeacherFullName, obj);
                }
            }

        }