Esempio n. 1
0
        private string GetLogString(UDT.ScoreSheet ss)
        {
            StringBuilder logs = new StringBuilder();

            logs.AppendLine(string.Format("管理員「{0}」新增評分紀錄:\n 違規班級「{1}」\n 評分時段「{2}」 評分項目「{3}」\n 違規之座號「{4}」 違規之座標「{5}」\n 評分加減分「{6}」 \n 補充說明「{7}」\n 建立日期「{8}」"
                                          , this._userName, cbxClass.SelectedItem.ToString(), cbxPeriod.SelectedItem.ToString(), cbxCheckItem.SelectedItem.ToString(), tbxSeatNo.Text, tbxCoordinate.Text, cbxScore.SelectedItem.ToString(), tbxRemark.Text, dateTimeInput1.Value.ToString("yyyy/MM/dd HH:MM")));

            return(logs.ToString());
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                List <UDT.ScoreSheet> listInsertData = new List <UDT.ScoreSheet>();
                // 資料整理
                UDT.ScoreSheet ss = new UDT.ScoreSheet();
                ss.Account         = lbAccount.Text;
                ss.RefCheckItemID  = int.Parse(this._dicCheckItemBYName[cbxCheckItem.SelectedItem.ToString()].UID);
                ss.RefClassID      = int.Parse(this._dicClassIDBYName[cbxClass.SelectedItem.ToString()]);
                ss.SeatNo          = tbxSeatNo.Text;
                ss.Coordinate      = tbxCoordinate.Text;
                ss.Remark          = tbxRemark.Text;
                ss.CreateTime      = dateTimeInput1.Value;
                ss.ScoreLastUpdate = dateTimeInput1.Value;
                ss.Score           = int.Parse(cbxScore.SelectedItem.ToString());
                ss.SchoolYear      = int.Parse(School.DefaultSchoolYear);
                ss.Semester        = int.Parse(School.DefaultSemester);

                listInsertData.Add(ss);

                string log = GetLogString(ss);

                // 寫入資料庫
                try
                {
                    this._access.InsertValues(listInsertData);
                    FISCA.LogAgent.ApplicationLog.Log("秩序競賽", "新增評分紀錄", log);
                    MsgBox.Show("儲存成功!");
                    this.Close();
                }
                catch (Exception ex)
                {
                    MsgBox.Show(ex.Message);
                }
            }
        }