93 lines
2.8 KiB
C#
93 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Datalib.DatabaseSpecific;
|
|
using Datalib.EntityClasses;
|
|
using Datalib.HelperClasses;
|
|
using System.Linq;
|
|
using System.IO;
|
|
using Datalib.Linq;
|
|
using DocumentFormat.OpenXml;
|
|
using DocumentFormat.OpenXml.Packaging;
|
|
using DocumentFormat.OpenXml.Validation;
|
|
using OpenXmlPowerTools;
|
|
using DevExpress.XtraRichEdit;
|
|
namespace Omega.Forms
|
|
{
|
|
public partial class frmQuizMan : Omega.BasicForms.frmCommon
|
|
{ public EntityCollection<TblQuizEntity> Quizs { get; set; }
|
|
public TblQuizEntity CurrQuiz { get; set; }
|
|
public TblQuizEntity DeletedQuiz { get; set; }
|
|
|
|
public frmQuizMan()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public override void LoadData()
|
|
{
|
|
Quizs = new EntityCollection<TblQuizEntity>();
|
|
adapter.FetchEntityCollection(Quizs, null);
|
|
this.grdQuiz.DataSource = Quizs;
|
|
LinqMetaData Meta = new LinqMetaData(adapter);
|
|
this.repoQuizTemplate.DataSource = Meta.TblQuizTemplate;
|
|
}
|
|
|
|
private void Print_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
|
|
|
|
this.progressPanel.Visible = true;
|
|
if (Quizs.Count > 0)
|
|
{
|
|
|
|
CurrQuiz = (TblQuizEntity)Quizs[this.BindingContext[Quizs].Position];
|
|
Utilities.PrintQuiz(CurrQuiz);
|
|
|
|
}
|
|
this.progressPanel.Visible = false;
|
|
}
|
|
|
|
private void Create_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
frmCreateQuiz frm = new frmCreateQuiz();
|
|
frm.LoadData();
|
|
frm.Show();
|
|
}
|
|
|
|
private void barDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
DeletedQuiz = (TblQuizEntity)Quizs[this.BindingContext[Quizs].Position];
|
|
if( MessageBox.Show("Bạn có muốn xóa bản ghi này?","Chương trình quản lý đề thi",MessageBoxButtons.OKCancel)==DialogResult.OK)
|
|
{
|
|
adapter.DeleteEntity(DeletedQuiz);
|
|
Quizs.Remove(DeletedQuiz);
|
|
}
|
|
}
|
|
|
|
private void CloseForm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void barAnswerPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
|
|
this.progressPanel.Visible = true;
|
|
if (Quizs.Count > 0)
|
|
{
|
|
|
|
CurrQuiz = (TblQuizEntity)Quizs[this.BindingContext[Quizs].Position];
|
|
Utilities.PrintQuizAnswer(CurrQuiz);
|
|
|
|
}
|
|
this.progressPanel.Visible = false;
|
|
|
|
|
|
}
|
|
}
|
|
}
|