Example #1
0
        void BGW_DoWork(object sender, DoWorkEventArgs e)
        {
            _DefaultSchoolYear = tool.StringIsInt_DefIsZero(K12.Data.School.DefaultSchoolYear);
            _DefaultSemester   = tool.StringIsInt_DefIsZero(K12.Data.School.DefaultSemester);

            //取得老師資料
            TeacherList.Clear();
            DataTable dt = _QueryHelper.Select(@"
SELECT 
    id
    , teacher_name
    , nickname 
FROM 
    teacher 
WHERE 
    status = 1 
ORDER BY 
    teacher_name");

            foreach (DataRow row in dt.Rows)
            {
                TeacherObj obj = new TeacherObj();
                obj.TeacherID       = "" + row[0];
                obj.TeacherName     = "" + row[1];
                obj.TeacherNickName = "" + row[2];
                TeacherList.Add(obj);
            }

            //取得場地[GROUP BY]
            string TableName = Tn._CLUBRecordUDT;

            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();

            //取得科別資料
            deptList = tool.GetQueryDeptList();
        }
Example #2
0
        /// <summary>
        /// 將使用者修改內容填入物件
        /// </summary>
        private void GetChengeObj()
        {
            ClubPrimary.ClubName = txtClubName.Text.Trim();
            //社團老師
            if (cbTeacher1.SelectedItem != null)
            {
                TeacherObj teach = (TeacherObj)cbTeacher1.SelectedItem;
                ClubPrimary.RefTeacherID = teach.TeacherID;
            }
            else
            {
                ClubPrimary.RefTeacherID = "";
            }
            //社團老師2
            if (cbTeacher2.SelectedItem != null)
            {
                TeacherObj teach = (TeacherObj)cbTeacher2.SelectedItem;
                ClubPrimary.RefTeacherID2 = teach.TeacherID;
            }
            else
            {
                ClubPrimary.RefTeacherID2 = "";
            }
            //社團老師3
            if (cbTeacher3.SelectedItem != null)
            {
                TeacherObj teach = (TeacherObj)cbTeacher3.SelectedItem;
                ClubPrimary.RefTeacherID3 = teach.TeacherID;
            }
            else
            {
                ClubPrimary.RefTeacherID3 = "";
            }
            //場地
            ClubPrimary.Location = cbLocation.Text.Trim();
            //關於
            string refText = txtAbout.Text.Replace("\r\n", "<br>");

            ClubPrimary.About = refText;
            //類型
            ClubPrimary.ClubCategory = cbCategory.Text;

            //社團編號(8/7)
            ClubPrimary.ClubNumber = tbCLUBNumber.Text;

            //評等
            ClubPrimary.Level = cbRank.Text;
        }
Example #3
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();         //類型

            if (!string.IsNullOrEmpty(tbGrade1Limit.Text.Trim())) //一年級人限
            {
                club.Grade1Limit = tool.StringIsInt_DefIsZero(tbGrade1Limit.Text.Trim());
            }
            if (!string.IsNullOrEmpty(tbGrade2Limit.Text.Trim())) //二年級人限
            {
                club.Grade2Limit = tool.StringIsInt_DefIsZero(tbGrade2Limit.Text.Trim());
            }
            if (!string.IsNullOrEmpty(tbGrade3Limit.Text.Trim())) //三年級人限
            {
                club.Grade3Limit = tool.StringIsInt_DefIsZero(tbGrade3Limit.Text.Trim());
            }
            if (!string.IsNullOrEmpty(tbLimit.Text.Trim())) //三年級人限
            {
                club.Limit = tool.StringIsInt_DefIsZero(tbLimit.Text.Trim());
            }

            if (cbGenderRestrict.SelectedItem != null) //男女限制
            {
                string res = cbGenderRestrict.GetItemText(cbGenderRestrict.SelectedItem);
                club.GenderRestrict = res;
            }

            //社團老師

            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();
            }

            //社團限制 - 科別
            DSXmlHelper dsXml = new DSXmlHelper("Department");

            foreach (ListViewItem each in listDepartment.Items)
            {
                if (each.Checked)
                {
                    dsXml.AddElement("Dept");
                    dsXml.AddText("Dept", each.Text);
                }
            }
            club.DeptRestrict = dsXml.BaseElement.OuterXml;
            club.About        = tbAboutClub.Text.Trim(); //簡介

            return(club);
        }
Example #4
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 
    id
    , teacher_name
    , nickname 
FROM 
    teacher 
WHERE
    status = 1
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);
                }
            }
        }