Esempio n. 1
0
        private void SaveSetting()
        {
            List <Setting> UDTlist = _A.Select <Setting>();

            _A.DeletedValues(UDTlist);                           //清除UDT資料

            UDTlist.Clear();                                     //清空UDTlist
            foreach (DataGridViewRow row in dataGridViewX1.Rows) //取得DataDataGridViewRow資料
            {
                if (row.Cells[0].Value == null)                  //遇到空白的Target即跳到下個loop
                {
                    continue;
                }

                String target = row.Cells[0].Value.ToString();
                String source = "";
                if (row.Cells[1].Value != null)
                {
                    source = row.Cells[1].Value.ToString();
                }

                Setting obj = new Setting();
                obj.Target = target;
                obj.Source = source;
                UDTlist.Add(obj);
            }

            _A.InsertValues(UDTlist); //回存到UDT
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (CheckData())
            {
                DSXmlHelper   DSXml = new DSXmlHelper("Xml");
                StringBuilder sb    = new StringBuilder();
                sb.AppendLine("已修改評量比例");

                foreach (DataGridViewRow row in dataGridViewX1.Rows)
                {
                    if (row.IsNewRow)
                    {
                        continue;
                    }

                    XmlElement xmle = DSXml.AddElement("Item");

                    xmle.SetAttribute("Name", "" + row.Cells[0].Value);
                    xmle.SetAttribute("Proportion", "" + row.Cells[1].Value);

                    //Log
                    sb.AppendLine(string.Format("名稱「{0}」比例「{1}」", "" + row.Cells[0].Value, "" + row.Cells[1].Value));
                }

                //先刪掉
                try
                {
                    List <WeightProportion> listdelete = _AccessHelper.Select <WeightProportion>();
                    _AccessHelper.DeletedValues(listdelete);

                    //新增一組全新的
                    List <WeightProportion> list = new List <WeightProportion>();
                    wp.Proportion = DSXml.BaseElement.OuterXml;
                    list.Add(wp);
                    _AccessHelper.InsertValues(list);

                    FISCA.LogAgent.ApplicationLog.Log("社團", "修改評量比例", sb.ToString());
                }
                catch (Exception ex)
                {
                    MsgBox.Show("儲存失敗!!\n" + ex.Message);
                    SmartSchool.ErrorReporting.ReportingService.ReportException(ex);
                    return;
                }

                MsgBox.Show("儲存成功!!");
                this.Close();
            }
            else
            {
                MsgBox.Show("資料錯誤請修正後儲存!!");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 清除社團參與記錄
        /// </summary>
        private void buttonX1_Click(object sender, EventArgs e)
        {
            List <string>     list2 = new List <string>();
            List <CLUBRecord> list1 = _A.Select <CLUBRecord>(string.Format("school_year={0} and semester={1}", integerInput1.Value.ToString(), integerInput2.Value.ToString()));

            foreach (CLUBRecord each in list1)
            {
                list2.Add(each.UID);
            }
            List <SCJoin> list3 = _A.Select <SCJoin>("ref_club_id in ('" + string.Join("','", list2) + "')");

            _A.DeletedValues(list3);
        }
Esempio n. 4
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            DialogResult dr = MsgBox.Show("您確定要把標記之社團參與記錄移除?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                List <SCJoin> RemoveList = new List <SCJoin>();
                foreach (DataGridViewRow row in dataGridViewX1.Rows)
                {
                    StudRepeatObj obj = (StudRepeatObj)row.DataBoundItem;
                    if (obj.Change) //如果資料有修改
                    {
                        RemoveList.AddRange(obj._RemoveList);
                    }
                }
                try
                {
                    _AccessHelper.DeletedValues(RemoveList);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("清除作業發生錯誤\n" + ex.Message);
                    return;
                }
                MsgBox.Show("社團參與記錄清除成功!!");
                this.Close();
            }
            else
            {
                MsgBox.Show("已中止操作!!");
            }
        }
Esempio n. 5
0
        private void dataGridViewX1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex == 5)
            {
                string       studentName = dataGridViewX1.Rows[e.RowIndex].Cells[3].Value.ToString();
                string       scorerID    = dataGridViewX1.Rows[e.RowIndex].Tag.ToString();
                DialogResult result      = MsgBox.Show(string.Format("確定刪除 {0} 評分員身分?", studentName), "提醒", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    try
                    {
                        AccessHelper access = new AccessHelper();
                        access.DeletedValues(access.Select <UDT.Scorer>(string.Format("uid = {0}", scorerID)));
                        MsgBox.Show("刪除成功");

                        ReloadDataGridView();
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show(ex.Message);
                    }
                }
            }
        }
        public void SaveMappingRecord() //儲存上次Mapping紀錄
        {
            AccessHelper _A = new AccessHelper();
            List <UpdateRecordReportUDT> UDTlist = _A.Select <UpdateRecordReportUDT>();

            _A.DeletedValues(UDTlist);                           //清除UDT資料

            UDTlist = new List <UpdateRecordReportUDT>();        //清空UDTlist
            foreach (DataGridViewRow row in dataGridViewX1.Rows) //取得DataDataGridViewRow資料
            {
                if (row.Cells[0].Value == null)                  //遇到空白的Target即跳到下個loop
                {
                    continue;
                }

                String target = row.Cells[0].Value.ToString();
                String source = "";
                if (row.Cells[1].Value != null)
                {
                    source = row.Cells[1].Value.ToString();
                }

                UpdateRecordReportUDT obj = new UpdateRecordReportUDT();
                obj.Target = target;
                obj.Source = source;
                UDTlist.Add(obj);
            }

            _A.InsertValues(UDTlist); //回存到UDT
        }
Esempio n. 7
0
        protected void Save()
        {
            dataGridViewX1.EndEdit();

            if (!IsValid(dataGridViewX1))
            {
                MsgBox.Show("請先修正錯誤");
                return;
            }

            List <DomainCode_DomainMakeUp> newList = new List <DomainCode_DomainMakeUp>();

            foreach (DataGridViewRow row in dataGridViewX1.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }

                DomainCode_DomainMakeUp cc = new DomainCode_DomainMakeUp();
                cc.Domain = "" + row.Cells[chDomainName.Index].Value;
                cc.Code   = "" + row.Cells[chCode.Index].Value;
                newList.Add(cc);
            }
            _accessHelper.DeletedValues(_list.ToArray());
            _accessHelper.InsertValues(newList.ToArray());
            ClassCodeMapper.Instance.Reload();

            this.DialogResult = DialogResult.OK;
        }
Esempio n. 8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Dictionary <string, AbsenceUDT> auDic = new Dictionary <string, AbsenceUDT>();

            foreach (DataGridViewRow row in dgv.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }

                string target = row.Cells[colTarget.Index].Value + "";
                string source = row.Cells[colSource.Index].Value + "";
                string key    = target + "_" + source;

                if (!auDic.ContainsKey(key))
                {
                    AbsenceUDT au = new AbsenceUDT();
                    au.Target = target;
                    au.Source = source;
                    auDic.Add(key, au);
                }
            }

            if (auDic.Count > 0)
            {
                _A.DeletedValues(_auList);

                _A.InsertValues(auDic.Values);
            }

            this.Close();
        }
        /// <summary>
        /// 自動修正選擇資料
        /// </summary>
        /// <param name="EntityIDs"></param>
        public void ExecuteAutoCorrect(IEnumerable <string> EntityIDs)
        {
            //Log
            StringBuilder      sb   = new StringBuilder();
            List <AssnAddress> list = new List <AssnAddress>();

            //如果是null / 表示修正所有資料
            if (K12.Data.Utility.Utility.IsNullOrEmpty(EntityIDs))
            {
                sb.AppendLine("已進行:社團上課地點空值檢查");
                sb.AppendLine("自動修正「所有」之錯誤資料");
                sb.AppendLine("刪除資料如下:");
                sb.AppendLine("");
                foreach (AssociationAddressRATRecord APeach in RATRecords)
                {
                    if (AssnciationDic.ContainsKey(APeach.課地點UID))
                    {
                        AssnAddress aa         = AssnciationDic[APeach.課地點UID];
                        string      schoolyear = CourseDic[aa.AssociationID].SchoolYear.HasValue ? CourseDic[aa.AssociationID].SchoolYear.Value.ToString() : "";
                        string      Semester   = CourseDic[aa.AssociationID].Semester.HasValue ? CourseDic[aa.AssociationID].Semester.Value.ToString() : "";
                        sb.AppendLine("上課地點「" + aa.Address + "」" + "資料系統編號(UID)「" + aa.UID + "」上課學年度「" + aa.SchoolYear + "」上課學期「" + aa.Semester + "」");
                        sb.AppendLine("(社團對應資料 - 學年度「" + schoolyear + "」學期「" + Semester + "」名稱「" + CourseDic[aa.AssociationID].Name + "」)");
                        list.Add(aa);
                    }
                    //_accessHelper.Select<AssnAddress>
                }
            }
            else //修正部份
            {
                sb.AppendLine("已進行:社團上課地點空值檢查");
                sb.AppendLine("自動修正「已選擇」之錯誤項目");
                sb.AppendLine("刪除資料如下:");
                sb.AppendLine("");
                foreach (string Entityeach in EntityIDs)
                {
                    if (AssnciationDic.ContainsKey(Entityeach))
                    {
                        AssnAddress aa         = AssnciationDic[Entityeach];
                        string      schoolyear = CourseDic[aa.AssociationID].SchoolYear.HasValue ? CourseDic[aa.AssociationID].SchoolYear.Value.ToString() : "";
                        string      Semester   = CourseDic[aa.AssociationID].Semester.HasValue ? CourseDic[aa.AssociationID].Semester.Value.ToString() : "";
                        sb.AppendLine("上課地點「" + aa.Address + "」" + "資料系統編號(UID)「" + aa.UID + "」上課學年度「" + aa.SchoolYear + "」上課學期「" + aa.Semester + "」");
                        sb.AppendLine("(社團對應資料 - 學年度「" + schoolyear + "」學期「" + Semester + "」名稱「" + CourseDic[aa.AssociationID].Name + "」)");
                        list.Add(AssnciationDic[Entityeach]);
                    }
                }
            }

            DialogResult dr = MsgBox.Show("即將刪除選取之資料\n您確定要進行自動修正嗎??", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (dr == DialogResult.Yes)
            {
                _accessHelper.DeletedValues(list.ToArray());
                ApplicationLog.Log("資料合理性檢查", "社團上課地點空值檢查(高雄市適用)", sb.ToString());
            }
            else
            {
                MsgBox.Show("已取消自動修正!!");
            }
        }
Esempio n. 10
0
        private void dataGridViewX1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            DialogResult dr = MsgBox.Show("您確定於封存資料中,刪除選擇之書面記錄(輔導)?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (dr == DialogResult.No)
            {
                MsgBox.Show("已中止刪除資料!");
                e.Cancel = true;
            }
            else
            {
                //說明:
                //CurrentRow的TAG內存之UID / 是WriteCounselingUDT的UID
                //欲取得GraduateUDT資料,需要先取得WriteCounselingUDT
                //後由WriteCounselingUDT的RefUDT_ID取得GraduateUDT資料

                List <string> uidList = new List <string>();
                foreach (DataGridViewRow each in dataGridViewX1.SelectedRows)
                {
                    string UID = "" + each.Cells[0].Tag;

                    if (!string.IsNullOrEmpty(UID))
                    {
                        uidList.Add(UID);
                    }
                }

                //取得所選的書面資料

                List <WriteCounselingUDT> listUDT2 = _AccessHelper.Select <WriteCounselingUDT>(UDT_S.PopOneCondition("UID", uidList));
                if (listUDT2.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();

                    sb.Append("班級「" + _StudentUdt.ClassName + "」");
                    sb.Append("座號「" + (_StudentUdt.SeatNo.HasValue ? _StudentUdt.SeatNo.Value.ToString() : "") + "」");
                    sb.Append("姓名「" + _StudentUdt.Name + "」");
                    sb.AppendLine("學號「" + _StudentUdt.StudentNumber + "」");
                    foreach (WriteCounselingUDT each in listUDT2)
                    {
                        sb.AppendLine("已刪除書面(輔導)資料「" + each.Name + each.Format + "」");
                    }


                    _AccessHelper.DeletedValues(listUDT2.ToArray());

                    ApplicationLog.Log("畢業生檔案檢索.書面資料(輔導)", "刪除", sb.ToString());
                    MsgBox.Show("已刪除所選書面資料(輔導)");
                    e.Cancel = true;
                    OnPrimaryKeyChanged(null);
                }
                else
                {
                    MsgBox.Show("刪除書面資料發生錯誤!");
                    e.Cancel = true;
                }
            }
        }
Esempio n. 11
0
        public void BGW_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                int          progress = 10;
                AccessHelper access   = new AccessHelper();
                List <UDT.SubjectClassSelection> scsNewList = access.Select <UDT.SubjectClassSelection>();

                // 讀取要修改的科目資料 CheckState != Indeterminate
                List <string> subjectIDList = new List <string>();
                foreach (DataGridViewRow dr in dataGridViewX1.Rows)
                {
                    if ("" + dr.Cells[0].Value != "Indeterminate")
                    {
                        subjectIDList.Add("" + dr.Tag);
                    }
                }
                BGW.ReportProgress(progress);
                // 刪除舊資料(班級選課管理):刪除CheckState != Indeterminate 的資料

                string subjectIDs = string.Join(",", subjectIDList);
                foreach (var _class in classDic)
                {
                    progress += 40 / classDic.Count;
                    BGW.ReportProgress(progress);

                    List <UDT.SubjectClassSelection> scsOLDList = access.Select <UDT.SubjectClassSelection>("ref_class_id = " + _class.Key + " AND ref_subject_id IN(" + subjectIDs + ")");
                    access.DeletedValues(scsOLDList);
                }

                // 新增資料(班級選課管理):新增CheckState == Checked 的資料
                foreach (DataGridViewRow dr in dataGridViewX1.Rows)
                {
                    progress += 60 / dataGridViewX1.Rows.Count;
                    BGW.ReportProgress(progress);
                    // 勾選的科目
                    if ("" + dr.Cells[0].Value == "Checked")
                    {
                        // 班級
                        foreach (var _class in classDic)
                        {
                            UDT.SubjectClassSelection scs = new UDT.SubjectClassSelection();
                            scs.RefSubjectID = int.Parse("" + dr.Tag);
                            scs.RefClassID   = int.Parse(_class.Key);

                            scsNewList.Add(scs);
                        }
                    }
                }
                // 儲存新資料
                scsNewList.SaveAll();
            }
            catch (Exception ex)
            {
                e.Result = ex;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 儲存
        /// </summary>
        private void buttonX1_Click(object sender, EventArgs e)
        {
            int         x   = 1;
            DSXmlHelper dsx = new DSXmlHelper("xml");

            foreach (DataGridViewRow row in dataGridViewX1.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }

                foreach (DataGridViewCell cell in row.Cells)
                {
                    if (cell is DataGridViewComboBoxExCell)
                    {
                        string name = "" + cell.Value;

                        if (ClubDic.ContainsKey(name))
                        {
                            CLUBRecord cr = ClubDic[name];

                            dsx.AddElement("Club");
                            dsx.SetAttribute("Club", "Index", x.ToString());
                            dsx.SetAttribute("Club", "Ref_Club_ID", cr.UID);
                            x++;
                        }
                    }
                }
            }

            List <string> list = K12.Presentation.NLDPanels.Student.SelectedSource;

            List <StudentRecord> StudentList = Student.SelectByIDs(list);

            List <VolunteerRecord> VolList = new List <VolunteerRecord>();

            List <VolunteerRecord> DelList = _A.Select <VolunteerRecord>(string.Format("ref_student_id in ('{0}')", string.Join("','", list)));

            foreach (StudentRecord stud in StudentList)
            {
                VolunteerRecord Vol = new VolunteerRecord();
                Vol.SchoolYear   = integerInput1.Value;
                Vol.Semester     = integerInput2.Value;
                Vol.RefStudentID = stud.ID;
                Vol.Content      = dsx.BaseElement.OuterXml;

                VolList.Add(Vol);
            }

            _A.DeletedValues(DelList); //清掉選擇學生的社團記錄
            _A.InsertValues(VolList);  //新增

            MsgBox.Show("儲存完成!!");
        }
Esempio n. 13
0
        /// <summary>
        /// 按年級計算各班該年級排名
        /// </summary>
        public void Execute()
        {
            AccessHelper access = new AccessHelper();

            // 0.刪除學年度、學期、週次的週排行資料
            List <UDT.WeeklyRank> listRank = access.Select <UDT.WeeklyRank>(string.Format("school_year = {0} AND semester = {1} AND week_number = {2}", this._schoolYear, this._semester, this._weekNo));

            access.DeletedValues(listRank);

            // 1.對於每個年級
            foreach (int grade in _dicAllClassByGrade.Keys)
            {
                List <UDT.WeeklyStats> weeklyStats = new List <UDT.WeeklyStats>();

                // 建立分數名次清單
                List <int> listScoreRank = new List <int>();

                // 2.找出該年級所有班級
                foreach (ClassRecord _class in _dicAllClassByGrade[grade])
                {
                    // 3.找出班級週統計成績
                    weeklyStats.Add(this._dicWeeklyStatsByClassID[_class.ID]);
                    listScoreRank.Add(this._dicWeeklyStatsByClassID[_class.ID].WeekTotal);
                }

                // 4.計算排名
                // 4.0 排序分數名次清單
                //listScoreRank.OrderByDescending(score => score).ToList();
                //listScoreRank.Sort();
                listScoreRank = listScoreRank.OrderByDescending(x => x).ToList();

                //List<UDT.WeeklyStats> result =  weeklyStats.OrderByDescending(x => x.WeekTotal).ToList();
                //int n = 1;

                foreach (UDT.WeeklyStats ws in weeklyStats)
                {
                    // 找出分數所對應的排名
                    int rank = listScoreRank.IndexOf(ws.WeekTotal) + 1;
                    // 4.1 建立排名物件
                    UDT.WeeklyRank wr = this.createRankObject(ws, rank, grade);

                    // 5. 判斷是否前5週連2
                    checkIfTop2In5Weeks(wr);

                    // 6. 判斷是否連8週前三
                    checkIfTop3In8Weeks(wr);

                    _listUpdateWeeklyRank.Add(wr);
                    //n++;
                }
            }

            // 5.寫入資料庫
            access.InsertValues(_listUpdateWeeklyRank);
        }
Esempio n. 14
0
        /// <summary>
        /// 刪除綜合紀錄表 複選記錄
        /// </summary>
        /// <param name="dataList"></param>
        public static void ABUDTMultipleRecordDelete(List<UDTMultipleRecordDef> dataList)
        {
            if (dataList.Count > 0)
            {
                AccessHelper accHelper = new AccessHelper();
                foreach (UDTMultipleRecordDef data in dataList)
                    data.Deleted = true;

                accHelper.DeletedValues(dataList);
            }
        }
        /// <summary>
        /// 刪除ABCard樣板內容
        /// </summary>
        /// <param name="RecList"></param>
        public static void DeleteABCardTemplate(List <UDT_ABCardTemplateDefinitionDef> RecList)
        {
            AccessHelper accHelper = new AccessHelper();

            foreach (UDT_ABCardTemplateDefinitionDef rec in RecList)
            {
                rec.Deleted = true;
            }

            accHelper.DeletedValues(RecList);
        }
Esempio n. 16
0
        /// <summary>
        /// 刪除設定資料
        /// </summary>
        /// <param name="dataList"></param>
        public static void DeleteConfigData(List <UDT_ScoreConfig> dataList)
        {
            foreach (UDT_ScoreConfig data in dataList)
            {
                data.Deleted = true;
            }

            AccessHelper accessHelper = new AccessHelper();

            accessHelper.DeletedValues(dataList);
        }
Esempio n. 17
0
        /// <summary>
        /// 刪除國籍中英文對照UDT
        /// </summary>
        /// <param name="dataList"></param>
        public static void UDTNationalityMappingDelete(List <UDT_NationalityMapping> dataList)
        {
            foreach (UDT_NationalityMapping data in dataList)
            {
                data.Deleted = true;
            }

            AccessHelper accessHelper = new AccessHelper();

            accessHelper.DeletedValues(dataList);
        }
        /// <summary>
        /// 刪除多筆建議重修名單
        /// </summary>
        /// <param name="dataList"></param>
        public static void UDTSuggestListDelete(List<UDTSuggestListDef> dataList)
        {
            if (dataList.Count > 0)
            {
                foreach (UDTSuggestListDef data in dataList)
                    data.Deleted = true;

                AccessHelper accessHelper = new AccessHelper();
                accessHelper.DeletedValues(dataList);
            
            }
        }
Esempio n. 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            _new.Clear();
            if (ValidateData())
            {
                List <GpaRef> insert = new List <GpaRef>();
                foreach (DataGridViewRow row in dgv.Rows)
                {
                    if (row.IsNewRow)
                    {
                        continue;
                    }

                    string  schoolYear = row.Cells[colSchoolYear.Index].Value + "";
                    string  semester   = row.Cells[colSemester.Index].Value + "";
                    string  grade      = row.Cells[colGrade.Index].Value + "";
                    string  max        = row.Cells[colMax.Index].Value + "";
                    string  avg        = row.Cells[colAvg.Index].Value + "";
                    decimal d;

                    GpaRef gr = new GpaRef();
                    gr.SchoolYear = int.Parse(schoolYear);
                    gr.Semester   = int.Parse(semester);
                    gr.Grade      = int.Parse(grade);
                    gr.Max        = decimal.TryParse(max, out d) ? d : 0;
                    gr.Avg        = decimal.TryParse(avg, out d) ? d : 0;
                    insert.Add(gr);

                    string key1 = schoolYear + "學年度" + semester + "學期" + grade + "年級最高GPA";
                    string key2 = schoolYear + "學年度" + semester + "學期" + grade + "年級平均GPA";

                    if (!_new.ContainsKey(key1))
                    {
                        _new.Add(key1, max);
                    }
                    if (!_new.ContainsKey(key2))
                    {
                        _new.Add(key2, avg);
                    }
                }

                _A.DeletedValues(_Records);
                _A.InsertValues(insert);
                FiscaLogWriter();
                MessageBox.Show("儲存完成");
                LoadData();
            }
            else
            {
                MessageBox.Show("資料有誤,請確認後再儲存");
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 刪除設定檔
        /// </summary>
        /// <param name="dataList"></param>
        public static void UDTConfigDelete(List <UDTConfig> dataList)
        {
            if (dataList.Count > 0)
            {
                foreach (UDTConfig data in dataList)
                {
                    data.Deleted = true;
                }

                AccessHelper accessHelper = new AccessHelper();
                accessHelper.DeletedValues(dataList);
            }
        }
Esempio n. 21
0
 /// <summary>
 /// 刪除學生體適能資料
 /// </summary>
 /// <param name="DataList"></param>
 public static void UDTStudentFitnessRecordListDelete(List<UDT_StudentFitnessRecord> DataList)
 {
     if (DataList.Count > 0)
     {
         foreach (UDT_StudentFitnessRecord data in DataList)
         {
             // Deleted 設成 true 才會真刪除
             data.Deleted = true;
         }
         AccessHelper accessHelper = new AccessHelper();
         accessHelper.DeletedValues(DataList);
     }
 }
Esempio n. 22
0
        /// <summary>
        /// 刪除比序績分主檔
        /// </summary>
        /// <param name="dataList"></param>
        public static void UDTEnrolmentExcessCreditsDelete(List <UDT_EnrolmentExcessCredits> dataList)
        {
            if (dataList.Count > 0)
            {
                foreach (UDT_EnrolmentExcessCredits data in dataList)
                {
                    data.Deleted = true;
                }

                AccessHelper accessHelper = new AccessHelper();
                accessHelper.DeletedValues(dataList);
            }
        }
Esempio n. 23
0
 /// <summary>
 /// 刪除學生體適能資料
 /// </summary>
 /// <param name="DataList"></param>
 public static void DeleteByRecordList(List <StudentFitnessRecord> DataList)
 {
     if (DataList.Count > 0)
     {
         foreach (StudentFitnessRecord data in DataList)
         {
             // Deleted 設成 true 才會真刪除
             data.Deleted = true;
         }
         AccessHelper accessHelper = new AccessHelper();
         accessHelper.DeletedValues(DataList);
     }
 }
Esempio n. 24
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (_RunningItem != null)
            {
                if (MessageBox.Show("確認刪除: " + _RunningItem.Name + " ?", "ishcool", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    List <ExamTemplateRecord> delete = new List <ExamTemplateRecord>();
                    delete.Add(_RunningItem);
                    _A.DeletedValues(delete);

                    ReLoad();
                }
            }
        }
Esempio n. 25
0
        /// <summary>
        /// 刪除學生體適能資料
        /// </summary>
        /// <param name="rec"></param>
        public static void DeleteByRecord(StudentFitnessRecord rec)
        {
            if (rec != null)
            {
                // Deleted 設成 true 才會真刪除
                rec.Deleted = true;

                List <StudentFitnessRecord> recList = new List <StudentFitnessRecord>();
                recList.Add(rec);

                AccessHelper accessHelper = new AccessHelper();
                accessHelper.DeletedValues(recList);
            }
        }
Esempio n. 26
0
 /// <summary>
 /// 重設
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         AccessHelper _A = new AccessHelper();
         List <UpdateRecordReportUDT> UDTlist = _A.Select <UpdateRecordReportUDT>();
         _A.DeletedValues(UDTlist);   //清除UDT資料
         dataGridViewX1.Rows.Clear(); //清除datagridview資料
         LoadLastRecord();            //再次讀入Mapping設定
     }
     catch
     {
         MessageBox.Show("網路或資料庫異常,請稍後再試...");
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (DateTimeParse())
            {
                if (!Compare())
                {
                    List <DTScore> list = new List <DTScore>();
                    DTScore        each = new DTScore();
                    each.Start = DateTime.Parse(tbStartDateTime.Text);
                    each.End   = DateTime.Parse(tbEndDateTime.Text);
                    list.Add(each);
                    try
                    {
                        //刪掉原有資料
                        _AccessHelper.DeletedValues(Low_DTClubList);

                        //New
                        _AccessHelper.InsertValues(list);

                        //LOG
                        StringBuilder sb = new StringBuilder();
                        sb.AppendLine("已修改成績輸入時間");
                        string start = each.Start.HasValue ? each.Start.Value.ToString("yyyy/MM/dd HH:mm") : "";
                        string end   = each.End.HasValue ? each.End.Value.ToString("yyyy/MM/dd HH:mm") : "";
                        sb.AppendLine(string.Format("開始時間「{0}」結束時間「{1}」", start, end));
                        FISCA.LogAgent.ApplicationLog.Log("社團", "修改成績輸入時間", sb.ToString());
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("儲存失敗!!\n" + ex.Message);
                        SmartSchool.ErrorReporting.ReportingService.ReportException(ex);
                        return;
                    }
                    MsgBox.Show("儲存成功!!");
                    this.Close();
                }
                else
                {
                    MsgBox.Show("[結束時間]不可小於[開始時間]!!");
                    return;
                }
            }
            else
            {
                MsgBox.Show("請輸入正確資料\n再進行儲存動作!!");
                return;
            }
        }
        // 複製評分紀錄
        public static void SnapshotScoreSheet(List <string> listScoreSheetID)
        {
            AccessHelper access = new AccessHelper();

            // 取得原快照資料並刪除
            if (listScoreSheetID.Count > 0)
            {
                access.DeletedValues(access.Select <UDT.SnapshotScoreSheet>(string.Format("ref_score_sheet_id IN({0})", string.Join(",", listScoreSheetID))));

                // 取得計算週排名的評分紀錄
                List <UDT.ScoreSheet>         listData       = access.Select <UDT.ScoreSheet>(string.Format("uid IN({0})", string.Join(",", listScoreSheetID)));
                List <UDT.SnapshotScoreSheet> listInsertData = new List <UDT.SnapshotScoreSheet>();
                // Data Sync
                foreach (UDT.ScoreSheet data in listData)
                {
                    UDT.SnapshotScoreSheet ss = new UDT.SnapshotScoreSheet();
                    ss.RefScoreSheetID        = int.Parse(data.UID);
                    ss.SchoolYear             = data.SchoolYear;
                    ss.Semester               = data.Semester;
                    ss.RefPeriodID            = data.RefPeriodID;
                    ss.RefPlaceID             = data.RefPlaceID;
                    ss.RefDeductionItemID     = data.RefDeductionItemID;
                    ss.RefDeductionStandardID = data.RefDeductionStandardID;
                    ss.Remark         = data.Remark;
                    ss.Picture1       = data.Picture1;
                    ss.Pic1Comment    = data.Pic1Comment;
                    ss.Pic1Size       = data.Pic1Size;
                    ss.Pic1LocalUrl   = data.Pic1LocalUrl;
                    ss.Picture2       = data.Picture2;
                    ss.Pic2Comment    = data.Pic2Comment;
                    ss.Pic2Size       = data.Pic2Size;
                    ss.Pic2LocalUrl   = data.Pic2LocalUrl;
                    ss.Acount         = data.Acount;
                    ss.CreateTime     = data.CreateTime;
                    ss.LastUpdateName = data.LastUpdateName;
                    ss.LastUpdateBy   = data.LastUpdateBy;
                    ss.CheckedTime    = data.CheckedTime;
                    ss.CheckedName    = data.CheckedName;
                    ss.CanceledBy     = data.CanceledBy;
                    ss.CanceledReason = data.CanceledReason;


                    listInsertData.Add(ss);
                }
                // 新增快照資料
                access.InsertValues(listInsertData);
            }
        }
        private void calculateRank()
        {
            // 1.刪除學年度學期 學期排名資料
            AccessHelper            access           = new AccessHelper();
            List <UDT.SemesterRank> listSemesterRank = access.Select <UDT.SemesterRank>(string.Format("school_year ={0} AND semester = {1}", this._schoolYear, this._semester));

            access.DeletedValues(listSemesterRank);

            // 2.按年級排名
            for (int gradeYear = 1; gradeYear <= 3; gradeYear++)
            {
                List <UDT.SemesterStats> listSemesterStats = _dicSemesterStatsByGradeYear[gradeYear];

                //建立分數名次清單
                // 計算規則: 名次加總*100 - 週總分平均
                List <int> listScore = new List <int>();

                foreach (UDT.SemesterStats semesterStats in _dicSemesterStatsByGradeYear[gradeYear])
                {
                    int score = semesterStats.RankTotal * 100 - semesterStats.AverageScore;
                    listScore.Add(score);
                }
                listScore = listScore.OrderBy(e => e).ToList(); // 遞增排: 最小的為第一名

                foreach (UDT.SemesterStats ss in listSemesterStats)
                {
                    int rank = listScore.IndexOf(ss.RankTotal * 100 - ss.AverageScore) + 1;

                    // 建立排名物件
                    UDT.SemesterRank sr = new UDT.SemesterRank();
                    sr.RefSemesterStatsID = int.Parse(ss.UID);
                    sr.SchoolYear         = ss.SchoolYear;
                    sr.Semester           = ss.Semester;
                    sr.RefClassID         = ss.RefClassID;
                    sr.GradeYear          = ss.GradeYear;
                    sr.CreateTime         = DateTime.Now;
                    sr.RankTotal          = ss.RankTotal;
                    sr.AverageScore       = ss.AverageScore;
                    sr.Rank      = rank;
                    sr.CreatedBy = this._userAccount;

                    this.listInsertSemesterRank.Add(sr);
                }
            }

            // 資料庫更新
            access.InsertValues(listInsertSemesterRank);
        }
        /// <summary>
        /// 更新設定
        /// </summary>
        /// <param name="rec"></param>
        public static void SaveByRecordList(List <TagMappingRecord> recList)
        {
            List <TagMappingRecord> dataList = new List <TagMappingRecord>();

            AccessHelper accessHelper = new AccessHelper();

            // 先刪除所有資料
            dataList = accessHelper.Select <TagMappingRecord>();
            accessHelper.DeletedValues(dataList);

            if (recList.Count > 0)
            {
                // 新增此次所有資料
                accessHelper.InsertValues(recList);
            }
        }
        /// <summary>
        /// 更新設定
        /// </summary>
        /// <param name="rec"></param>
        public static void SaveByRecordList(List<TagMappingRecord> recList)
        {
            List<TagMappingRecord> dataList = new List<TagMappingRecord>();

            AccessHelper accessHelper = new AccessHelper();

            // 先刪除所有資料
            dataList = accessHelper.Select<TagMappingRecord>();
            accessHelper.DeletedValues(dataList);

            if (recList.Count > 0)
            {
                // 新增此次所有資料
                accessHelper.InsertValues(recList);
            }
        }
Esempio n. 32
0
        private void calculateScore()
        {
            // 1.刪除學年度學期的學期統計資料
            AccessHelper             access            = new AccessHelper();
            List <UDT.SemesterStats> listSemesterStats = access.Select <UDT.SemesterStats>(string.Format("school_year = {0} AND semester = {1}", _schoolYear, _semester));

            access.DeletedValues(listSemesterStats);

            // 2.針對每個班級
            foreach (string classID in this._dicWeeklyRankByClassID.Keys)
            {
                int rankTotal    = 0;
                int totalScore   = 0;
                int averageScore = 0;
                int weekNo       = 0;
                int gradeYear    = 0;
                // 2.1 找出該班級所有週排名資料
                foreach (UDT.WeeklyRank weeklyRank in this._dicWeeklyRankByClassID[classID])
                {
                    // 2.2 計算學期週排名次加總
                    rankTotal += weeklyRank.Rank;
                    // 2.3 計算學期週排總分平均
                    totalScore += weeklyRank.WeekTotal;

                    gradeYear = weeklyRank.GradeYear;
                    weekNo++;
                }
                averageScore = totalScore / weekNo;
                UDT.SemesterStats stats = new UDT.SemesterStats();
                stats.SchoolYear   = int.Parse(_schoolYear);
                stats.Semester     = int.Parse(_semester);
                stats.RefClassID   = int.Parse(classID);
                stats.GradeYear    = gradeYear;
                stats.RankTotal    = rankTotal;
                stats.AverageScore = averageScore;
                stats.CreateTime   = DateTime.Now;
                stats.CreatedBy    = _userAccount;


                listInsertSemesterStats.Add(stats);
            }

            // 寫入資料庫
            access.InsertValues(listInsertSemesterStats);
        }
Esempio n. 33
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            AccessHelper      access      = new AccessHelper();
            List <AbsenceUDT> absenceList = access.Select <AbsenceUDT>();

            access.DeletedValues(absenceList);

            List <AbsenceUDT> InsertAbList = new List <AbsenceUDT>();

            foreach (DataGridViewRow dr in dataGridViewX1.Rows)
            {
                AbsenceUDT    udt      = new AbsenceUDT();
                List <string> jsonList = new List <string>();

                for (int i = 2; i < dr.Cells["actor"].ColumnIndex; i++)
                {
                    if (dr.Cells[i].Value != null)
                    {
                        if (bool.Parse("" + dr.Cells[i].Value) == true)
                        {
                            string name = dataGridViewX1.Columns[i].HeaderText;
                            string abbr = dataGridViewX1.Columns[i].Name;
                            jsonList.Add("{" + string.Format("\"Abbr\":\"{0}\",\"Name\":\"{1}\"", abbr, name) + "}");
                        }
                    }
                }

                if (jsonList.Count > 0)
                {
                    udt.Absence = "[" + string.Join(",", jsonList) + "]";
                    udt.Period  = "" + dr.Cells["period"].Value;
                    InsertAbList.Add(udt);
                }

                udt.Actor    = "" + dr.Cells["actor"].Value;
                udt.StarTime = DateTime.Parse(("" + dr.Cells["star_time"].Value) == "" ? "00:00:00" : ("" + dr.Cells["star_time"].Value));
                udt.EndTime  = DateTime.Parse(("" + dr.Cells["end_time"].Value) == "" ? "00:00:00" : ("" + dr.Cells["end_time"].Value));
            }
            access.InsertValues(InsertAbList);
            MsgBox.Show("儲存成功!!");
            this.Close();
        }
        private void calculateScore()
        {
            // 0. 刪除日期區間週統計
            AccessHelper           access          = new AccessHelper();
            List <UDT.WeeklyStats> listWeeklyStats = access.Select <UDT.WeeklyStats>(string.Format("school_year = {0} AND semester = {1} AND week_number = {2}", this._schoolYear, this._semester, this._weekNo));

            access.DeletedValues(listWeeklyStats);

            // 1. 針對每個班級
            foreach (string classID in dicClassDataByID.Keys)
            {
                decimal score = _baseScore;
                //  1.1 找出該班級的所有評分紀錄
                if (dicRecordsByClassID.ContainsKey(classID))
                {
                    //  1.2 計算總分
                    foreach (UDT.ScoreSheet sheet in dicRecordsByClassID[classID])
                    {
                        if (this._listExistCheckItem.Contains("" + sheet.RefCheckItemID))// 如果評分項目存在系統的話採計扣分
                        {
                            score += sheet.Score;
                        }
                    }
                }
                UDT.WeeklyStats weeklyStats = new UDT.WeeklyStats();
                weeklyStats.SchoolYear = int.Parse(this._schoolYear);
                weeklyStats.semester   = int.Parse(this._semester);
                weeklyStats.RefClassID = int.Parse(classID);
                weeklyStats.GradeYear  = int.Parse("" + dicClassDataByID[classID]["grade_year"]);
                weeklyStats.WeekTotal  = (int)score;
                weeklyStats.WeekNumber = this._weekNo;
                weeklyStats.CreateTime = DateTime.Now;
                weeklyStats.CreatedBy  = "";
                weeklyStats.StartDate  = this._startDate;
                weeklyStats.EndDate    = this._endDate;

                _listInsertWeeklyStats.Add(weeklyStats);
            }
            //  1.3 更新資料庫
            access.InsertValues(_listInsertWeeklyStats);
        }
        private void button4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("您確定要刪除這個系所組別?", "注意!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != System.Windows.Forms.DialogResult.Yes)
                return;

            List<ActiveRecord> recs = new List<ActiveRecord>();
            foreach(DataGridViewRow row in this.dataGridView1.SelectedRows)
            {
                recs.Add((UDT.DepartmentGroup)row.Tag);
            }
            AccessHelper ah = new AccessHelper();
            try
            {
                ah.DeletedValues(recs);
                this.RefreshData();
            }
            catch (Exception ex)
            {
                Util.ShowMsg("刪除科目資料時發生錯誤!", "注意!");
            }
        }
Esempio n. 36
0
 /// <summary>
 /// 刪除多筆學生輔導老師
 /// </summary>
 /// <param name="CounselStudent_List"></param>
 public void DeleteCounselStudentList(List<DAO.UDT_CounselStudent_ListDef> CounselStudent_List)
 {
     List<UDT_CounselStudent_ListDef> DelCounselStudentList = new List<UDT_CounselStudent_ListDef>();
     foreach (UDT_CounselStudent_ListDef rec in CounselStudent_List)
     {
         rec.Deleted = true;
         DelCounselStudentList.Add(rec);
     }
     AccessHelper accessHelper = new AccessHelper();
     accessHelper.DeletedValues(DelCounselStudentList.ToArray());
 }
 /// <summary>
 /// 刪除 UDT_StudTypeWeight 內資料
 /// </summary>
 /// <param name="data"></param>
 public static void DeleteDataToUDT_StudTypeWeight(List<UserDefData_StudTypeWeight> data)
 {
     AccessHelper accHelper = new AccessHelper();
     accHelper.DeletedValues(data.ToArray());
 }
Esempio n. 38
0
 /// <summary>
 /// 刪除單筆關懷
 /// </summary>
 /// <param name="CareRecordDef"></param>
 public void DeleteCareRecord(UDT_CounselCareRecordDef CareRecordDef)
 {
     AccessHelper accHelper = new AccessHelper();
     List<UDT_CounselCareRecordDef> CareRecordDefList = new List<UDT_CounselCareRecordDef>();
     CareRecordDef.Deleted = true;
     CareRecordDefList.Add(CareRecordDef);
     accHelper.DeletedValues(CareRecordDefList.ToArray());
 }
Esempio n. 39
0
        private static void DeleteCourse()
        {
            if (RetakeAdmin.Instance.SelectedSource.Count > 0)
            {
                DialogResult dr = MsgBox.Show("您確定要刪除課程?\n\n本功能將會串連刪除:\n(課程,修課學生,成績,缺曠)", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);
                if (dr == DialogResult.Yes)
                {
                    AccessHelper _accessHelper = new AccessHelper();

                    //刪缺曠
                    List<UDTAttendanceDef> attendanceList = _accessHelper.Select<UDTAttendanceDef>("ref_course_id in ('" + string.Join("','", RetakeAdmin.Instance.SelectedSource) + "')");
                    _accessHelper.DeletedValues(attendanceList);

                    //時間區間
                    List<UDTTimeSectionDef> timeSectionList = _accessHelper.Select<UDTTimeSectionDef>("ref_course_id in ('" + string.Join("','", RetakeAdmin.Instance.SelectedSource) + "')");
                    _accessHelper.DeletedValues(timeSectionList);

                    //刪學生
                    List<UDTScselectDef> cselectList = _accessHelper.Select<UDTScselectDef>("ref_course_id in ('" + string.Join("','", RetakeAdmin.Instance.SelectedSource) + "')");
                    _accessHelper.DeletedValues(cselectList);

                    //刪課程
                    List<UDTCourseDef> courseList = _accessHelper.Select<UDTCourseDef>("UID in ('" + string.Join("','", RetakeAdmin.Instance.SelectedSource) + "')");
                    _accessHelper.DeletedValues(courseList);

                    MsgBox.Show("刪除成功!!");
                    RetakeEvents.RaiseAssnChanged();
                }
            }
            else
            {
                MsgBox.Show("請選擇課程!!");
            }
        }
Esempio n. 40
0
        /// <summary>
        /// 刪除輔導系統設定內容
        /// </summary>
        /// <param name="RecList"></param>
        public static void DeleteSystemList(List<UDT_SystemListDef> RecList)
        {
            AccessHelper accessHelper = new AccessHelper();
            foreach (UDT_SystemListDef rec in RecList)
                rec.Deleted = true;

            accessHelper.DeletedValues(RecList);
        }
        /// <summary>
        /// 刪除學生體適能資料
        /// </summary>
        /// <param name="rec"></param>
        public static void DeleteByRecord(StudentFitnessRecord rec)
        {
            if (rec != null)
            {
                // Deleted 設成 true 才會真刪除
                rec.Deleted = true;

                List<StudentFitnessRecord> recList = new List<StudentFitnessRecord>();
                recList.Add(rec);

                AccessHelper accessHelper = new AccessHelper();
                accessHelper.DeletedValues(recList);
            }
        }
Esempio n. 42
0
 /// <summary>
 /// 刪除多筆輔導使用者自訂欄位
 /// </summary>
 /// <param name="dataList"></param>
 public void DeleteCounselUserDefineDataList(List<UDT_CounselUserDefDataDef> dataList)
 {
     List<UDT_CounselUserDefDataDef> dtList = new List<UDT_CounselUserDefDataDef>();
     foreach (UDT_CounselUserDefDataDef rec in dataList)
     {
         rec.Deleted = true;
         dtList.Add(rec);
     }
     AccessHelper accessHelper = new AccessHelper();
     accessHelper.DeletedValues(dtList);
 }
 /// <summary>
 /// 刪除多筆課表
 /// </summary>
 /// <param name="dataList"></param>
 public static void UDTCourseTimetableDelete(List<UDTCourseTimetableDef> dataList)
 {
     if (dataList.Count > 0)
     {
         AccessHelper accessHelper = new AccessHelper();
         foreach (UDTCourseTimetableDef data in dataList)
             data.Deleted = true;
             
         accessHelper.DeletedValues(dataList);
     }
 }
Esempio n. 44
0
        /// <summary>
        /// 刪除ABCard樣板內容
        /// </summary>
        /// <param name="RecList"></param>
        public static void DeleteABCardTemplate(List<UDT_ABCardTemplateDefinitionDef> RecList)
        {
            AccessHelper accHelper = new AccessHelper();
            foreach (UDT_ABCardTemplateDefinitionDef rec in RecList)
                rec.Deleted = true;

            accHelper.DeletedValues(RecList);
        }
        /// <summary>
        /// 刪除 成績輸入時間
        /// </summary>
        /// <param name="dataList"></param>
        public static void UDTScoreInputDateDelete(List<UDTScoreInputDateDef> dataList)
        {
            AccessHelper accessHelper = new AccessHelper();
            foreach (UDTScoreInputDateDef data in dataList)
                data.Deleted = true;

            accessHelper.DeletedValues(dataList);
        }
        /// <summary>
        /// 刪除成績計算比例原則
        /// </summary>
        /// <param name="dataList"></param>
        public static void UDTWeightProportionDelete(List<UDTWeightProportionDef> dataList)
        {
            foreach (UDTWeightProportionDef data in dataList)
                data.Deleted = true;

            AccessHelper _accessHelper = new AccessHelper();
                _accessHelper.DeletedValues(dataList);
        }
        //原本被標為退選的,按下退選後沒有反應。
        //原本被標為加選的,按下退選後刪除該加退選紀錄。
        //原本沒有標示的,按下退選後會加入一筆退選紀錄。
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (this.dataGridViewX1.SelectedRows.Count < 1)
            {
                return;
            }

            List<ActiveRecord> addRecs = new List<ActiveRecord>();
            List<ActiveRecord> delRecs = new List<ActiveRecord>();
            this.btnRemove.Enabled = false;

            foreach (DataGridViewRow row in this.dataGridViewX1.SelectedRows)
            {
                SHCourseRecord course = (SHCourseRecord)row.Tag;
                if (row.Cells[0].Value.ToString() == "")
                {
                    UDT.AddDropCourse ad = new UDT.AddDropCourse();
                    ad.CourseID = int.Parse(course.ID);
                    ad.StudentID = int.Parse(this.PrimaryKey);
                    ad.AddOrDrop = this.dropCourse;
                    addRecs.Add(ad);
                }

                if (row.Cells[0].Value.ToString() == this.addCourse)
                {
                    UDT.AddDropCourse ad = this.dicAddDropList[course.ID];
                    delRecs.Add(ad);
                }
            }

            try
            {
                AccessHelper ah = new AccessHelper();
                if (delRecs.Count > 0) ah.DeletedValues(delRecs);
                if (addRecs.Count > 0) ah.InsertValues(addRecs);
                this.OnPrimaryKeyChanged(EventArgs.Empty);
                this.saveLogs(delRecs, addRecs);
            }
            catch (Exception ex)
            {
                Util.ShowMsg(ex.Message, "退選課程");
                this.btnRemove.Enabled = true;
            }

            //this.btnRemove.Enabled = true;
        }
Esempio n. 48
0
 /// <summary>
 /// 刪除測驗資料
 /// </summary>
 /// <param name="QuizName"></param>
 public void DeleteQuizData(UDT_QuizDef QuizData)
 {
     AccessHelper accHelper = new AccessHelper();
     QuizData.Deleted = true;
     List<UDT_QuizDef> delList = new List<UDT_QuizDef>();
     delList.Add(QuizData);
     accHelper.DeletedValues(delList.ToArray());
 }
Esempio n. 49
0
 /// <summary>
 /// 刪除一筆 UDT 晤談紀錄
 /// </summary>
 /// <param name="StudentInterviewRecord"></param>
 public void DeleteCounselStudentInterviewRecord(DAO.UDT_CounselStudentInterviewRecordDef StudentInterviewRecord)
 {
     StudentInterviewRecord.Deleted = true;
     AccessHelper accHelper = new AccessHelper();
     List<UDT_CounselStudentInterviewRecordDef> delList = new List<UDT_CounselStudentInterviewRecordDef>();
     delList.Add(StudentInterviewRecord);
     accHelper.DeletedValues(delList.ToArray());
 }
Esempio n. 50
0
        /// <summary>
        ///  刪除多筆學生測驗
        /// </summary>
        /// <param name="studQuizDataList"></param>
        /// <param name="isInsert"></param>
        public void DeleteStudQuizDataLlist(List<UDT_StudQuizDataDef> studQuizDataList)
        {
            AccessHelper accHelper = new AccessHelper();
            foreach (UDT_StudQuizDataDef rec in studQuizDataList)
                rec.Deleted = true;

            accHelper.DeletedValues(studQuizDataList.ToArray());
        }
Esempio n. 51
0
 /// <summary>
 /// 刪除 UDT 內資料
 /// </summary>
 /// <param name="data"></param>
 public static void DeleteDataToUDT(List<DAL.UserDefData> data)
 {
     AccessHelper accHelper = new AccessHelper();
     accHelper.DeletedValues(data.ToArray());
 }
 /// <summary>
 /// 刪除多筆修課
 /// </summary>
 /// <param name="DataList"></param>
 public static void UDTSCSelectDelete(List<UDTScselectDef> DataList)
 {
     if (DataList.Count > 0)
     {
         AccessHelper accessHelper = new AccessHelper();
         foreach (UDTScselectDef data in DataList)
             data.Deleted = true;
         accessHelper.DeletedValues(DataList);
     }
 }
        protected override void OnSaveData()
        {
            if (!this.is_validated())
            {
                MessageBox.Show("請先修正錯誤再儲存。");
                return;
            }
            //Delete All Records
            List<ActiveRecord> deleteRecs = new List<ActiveRecord>();
            foreach (UDT.CourseInstructor ci in this.records)
            {
                deleteRecs.Add(ci);
            }

            //Save new Record
            List<ActiveRecord> insertRecs = new List<ActiveRecord>();

            foreach (DataGridViewRow row in this.dataGridViewX1.Rows)
            {
                if (!row.IsNewRow)
                {
                    UDT.CourseInstructor ins = new UDT.CourseInstructor();
                    //SHSchool.Data.SHTCInstructRecord tcr = new SHTCInstructRecord();
                    ins.CourseID = int.Parse(this.PrimaryKey);
                    ins.TeacherID = int.Parse(row.Cells[1].Value.ToString());
                    ins.TagID = int.Parse(row.Cells[0].Value.ToString());
                    //ins.Role = row.Cells[1].Value.ToString(); //此欄位已不再使用。2012/3/16, kevin.
                    ins.IsScored = (row.Cells["IsScored"].Value != null && (bool)row.Cells["IsScored"].Value);
                    /*
                    if (row.Cells["IsScored"].Value != null && (bool)row.Cells["IsScored"].Value)
                    {
                        // item is checked
                        ins.IsScored = true;
                    }
                    else
                    {
                        // item is null
                        ins.IsScored = false;
                    }
                    */
                    insertRecs.Add(ins);
                }
            }

            AccessHelper ah = new AccessHelper();
            //delete
            //if (this.deletedList.Count > 0)
            ah.DeletedValues(deleteRecs);

            //insert
            if (insertRecs.Count > 0)
                ah.SaveAll(insertRecs);

            this.OnPrimaryKeyChanged(EventArgs.Empty);

            ResetDirtyStatus();

            /* ====  Log  for deleted records =====*/
            /*
            foreach (UDT.CourseInstructor ci in this.records)
            {
                Log.LogAgent agt = new Log.LogAgent();
                agt.ActionType = Log.LogActionType.Delete;
                this.AddLog(ci, agt);
               agt.Save("授課教師.課程", "刪除","", Log.LogTargetCategory.Course, ci.CourseID.ToString());
            }
             * */
            /* ====  Log  for inserted records =====*/
            K12.Data.CourseRecord course = K12.Data.Course.SelectByID(this.PrimaryKey);
            StringBuilder sb = new StringBuilder(string.Format("課程「{0}」,學年度「{1}」,學期「{2}」 \n", course.Name, course.SchoolYear, EMBACore.DataItems.SemesterItem.GetSemesterByCode(course.Semester + "").Name));
            sb.Append("授課教師更改為: \n");
            foreach (UDT.CourseInstructor ci in insertRecs)
            {
                string teacherName = this.dicTeachers[ci.TeacherID.ToString()].Name;
                string role = this.dicTags[ci.TagID.ToString()].TagFullName;
                sb.Append(string.Format("教師:{0} , 角色:{1} , 成績管理:{2} \n ", teacherName, role, ci.IsScored ? "是" : "否"));

                //Log.LogAgent agt = new Log.LogAgent();
                //agt.ActionType = Log.LogActionType.AddNew;
                //this.AddLog(ci, agt);
                //agt.Save("授課教師.課程", "新增", "", Log.LogTargetCategory.Course, ci.CourseID.ToString());
            }

            FISCA.LogAgent.ApplicationLog.Log("課程.資料項目.教授 / 助教 / 助理", "修改", "course", this.PrimaryKey, sb.ToString());
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.dataGridViewX2.SelectedRows.Count < 1)
            {
                return;
            }

            List<ActiveRecord> addRecs = new List<ActiveRecord>();
            List<ActiveRecord> delRecs = new List<ActiveRecord>();
            this.btnAdd.Enabled = false;

            foreach (DataGridViewRow row in this.dataGridViewX2.SelectedRows)
            {
                SHCourseRecord course = (SHCourseRecord)row.Tag;
                //如果原本是被標註退選的,應該要把該退選紀錄移除
                if (this.dicAddDropList.ContainsKey(course.ID))
                {
                    if (this.dicAddDropList[course.ID].AddOrDrop.ToUpper() == this.dropCourse)
                    {
                        delRecs.Add(this.dicAddDropList[course.ID]);
                    }
                }
                else
                {
                    UDT.AddDropCourse ad = new UDT.AddDropCourse();
                    ad.StudentID = int.Parse(this.PrimaryKey);
                    ad.CourseID = int.Parse(course.ID);
                    ad.AddOrDrop = this.addCourse;
                    addRecs.Add(ad);
                }
            }
            try
            {
                AccessHelper ah = new AccessHelper();
                if (delRecs.Count > 0)  ah.DeletedValues(delRecs);
                if (addRecs.Count > 0) ah.InsertValues(addRecs);
                this.OnPrimaryKeyChanged(EventArgs.Empty);
                this.saveLogs(delRecs, addRecs);
            }
            catch (Exception ex)
            {
                Util.ShowMsg(ex.Message, "加選課程");
                this.btnAdd.Enabled = true;
            }

            //this.btnAdd.Enabled = true ;    //應該要等資料讀取完後才 enabled,  2012/5/2, kevin.
        }
Esempio n. 55
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("您確定要刪除這個科目?", "注意!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != System.Windows.Forms.DialogResult.Yes)
                return;

            StringBuilder sb = new StringBuilder("刪除科目如下:");
            List<ActiveRecord> recs = new List<ActiveRecord>();
            foreach(DataGridViewRow row in this.dataGridView1.SelectedRows)
            {
                UDT.Subject subj = (UDT.Subject)row.Tag;
                sb.Append( makeSubjMsg(subj));
                recs.Add(subj);
            }

            AccessHelper ah = new AccessHelper();
            try
            {
                ah.DeletedValues(recs);
                FISCA.LogAgent.ApplicationLog.Log("科目管理", "刪除", "", "", sb.ToString());
                this.RefreshData();
            }
            catch (Exception ex)
            {
                Util.ShowMsg("刪除科目資料時發生錯誤!", "注意!");
            }
        }
Esempio n. 56
0
 /// <summary>
 /// 刪除1筆個案會議
 /// </summary>
 /// <param name="CaseMeetingRecord"></param>
 public void DeleteCaseMeetingRecord(DAO.UDT_CounselCaseMeetingRecordDef CaseMeetingRecord)
 {
     CaseMeetingRecord.Deleted = true;
     List<DAO.UDT_CounselCaseMeetingRecordDef> DelCaseMeetingRecordList = new List<UDT_CounselCaseMeetingRecordDef>();
     DelCaseMeetingRecordList.Add(CaseMeetingRecord);
     AccessHelper accessHelper = new AccessHelper();
     accessHelper.DeletedValues(DelCaseMeetingRecordList.ToArray());
 }