/// <summary>
 /// chấm tthi
 /// </summary>
 protected virtual void LoadGrid()
 {
     var stt = 1;
     _tbError = GetTable();
     var tbbailam = LoadData.Load(207, _idkythi);
     var tabledapan = LoadData.Load(7, _idkythi);
     if (tabledapan.Rows.Count==0)
     {
         lock (LockTotal)
         {
             OnCloseDialog();
         }
         Invoke(
                 (Action)(() => MessageBox.Show(@"Chưa Import đáp án của mã đề", @"Thông báo",
                     MessageBoxButtons.OK, MessageBoxIcon.Warning)));
         lock (LockTotal)
         {
             OnCloseDialog();
         }
         return;
     }
     if (tbbailam.Rows.Count>0)
     {
         foreach (DataRow dataRow in tbbailam.Rows)
         {
             double diem = 0;
             var listbailam = dataRow["KetQua"].ToString();
             var tbdapan = SearchData.Timkiemmade2(dataRow["MaDe"].ToString(), _idkythi);
             if (listbailam.Length != tbdapan.Rows.Count)
             {
                 _tbError.Rows.Add(stt++,
                     dataRow["MaSV"].ToString(),
                     dataRow["MaDe"].ToString(),
                     dataRow["KetQua"].ToString()
                     );
                 continue;
             }
             for (var i = 0; i < tbdapan.Rows.Count; i++)
             {
                 var a = listbailam[i].ToString();
                 var s = tbdapan.Rows[i]["Dapan"].ToString();
                 var c = tbdapan.Rows[i]["ThangDiem"].ToString();
                 if (a == s)
                 {
                     diem = diem + double.Parse(c);
                 }
             }
             var d = Math.Round(diem, 1);
             var hs = new BaiLam
             {
                 IdKyThi = _idkythi,
                 MaSV = int.Parse(dataRow["MaSV"].ToString()),
                 DiemThi = d
             };
             _listUpdate.Add(hs);
             dataRow["DiemThi"] = d;
         }
         Invoke((Action)(() => dgv_DanhSach.DataSource = tbbailam));
         lock (LockTotal)
         {
             OnCloseDialog();
         }
     }
     else
     {
         lock (LockTotal)
         {
             OnCloseDialog();
         }
         Invoke(
                 (Action)(() => MessageBox.Show(@"Chưa Import bài làm của sinh viên", @"Thông báo",
                     MessageBoxButtons.OK, MessageBoxIcon.Warning)));
     }
 }
Beispiel #2
0
 /// <summary>
 /// sửa lại điểm thi trong bản BAILAM
 /// </summary>
 /// <returns>true</returns>
 private static void UpdateDiemThi(BaiLam item)
 {
     try
     {
         var diemthi = item.DiemThi.ToString().Replace(',', '.');
         var str = "update BAILAM set DiemThi = " + diemthi + " WHERE MaSV = " + item.MaSV +
                   " and IdKyThi = " + item.IdKyThi + "";
         Conn.ExcuteQuerySql(str);
     }
     catch (Exception ex)
     {
         Log2File.LogExceptionToFile(ex);
     }
 }
        /// <summary>
        /// Lưu dữ liệu trên UltraGrid
        /// </summary>
        protected override void SaveDetail()
        {
            try
            {
                foreach (var row in dgv_DanhSach.Rows)
                {
                    var hs = new BaiLam
                    {
                        MaSV = int.Parse(row.Cells["MaSV"].Text),
                        MaDe = row.Cells["MaDe"].Text,
                        KetQua = row.Cells["KetQua"].Text,
                        IdKyThi = _idKythi,
                        MaHoiDong = row.Cells["MaHoiDong"].Text,
                        MaLoCham = row.Cells["MaLoCham"].Text,
                        TenFile = row.Cells["TenFile"].Text,
                    };
                    _listAdd.Add(hs);
                }

                InsertData.ThemBaiLam(_listAdd);
                Invoke((Action) (() => MessageBox.Show(@"Đã lưu vào CSDL", FormResource.MsgCaption, MessageBoxButtons.OK,
                        MessageBoxIcon.Information)));
            }
            catch (Exception ex)
            {
                Log2File.LogExceptionToFile(ex);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Thêm 1 bài làm của sinh viên
 /// </summary>
 /// <returns></returns>
 private static bool ThemBaiLam(BaiLam item)
 {
     try
     {
         var str = "insert into BAILAM(IdKyThi,MaSV,MaDe,KetQua,MaHoiDong,MaLoCham,TenFile) values(" +
                   item.IdKyThi + "," + item.MaSV + ",N'" + item.MaDe + "',N'" +
                   item.KetQua + "','" + item.MaHoiDong + "','" + item.MaLoCham + "','" + item.TenFile + "')";
         Conn.ExcuteQuerySql(str);
         return true;
     }
     catch (Exception ex)
     {
         Log2File.LogExceptionToFile(ex);
         return false;
     }
 }