Ejemplo n.º 1
0
    protected void gvDotThi_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        dotthiDTO = new clsDotThi_DTO();
        string        strReturn = string.Empty;
        string        strMess   = string.Empty;
        int           iRow      = gvDotThi.VisibleRowCount;
        List <object> keyValues = gvDotThi.GetSelectedFieldValues("MaDotThi");

        foreach (object key in keyValues)
        {
            dotthiDTO.MaDotThi = key.ToString();
            int iReturn = dotthiDAL.Delete(dotthiDTO);
            if (iReturn < 0)
            {
                strMess += " " + key.ToString();
            }
        }
        if (strMess != string.Empty)
        {
            e.Result = "Do ràng buộc dữ liệu, không thể xóa " + strMess;
        }
        else
        {
            e.Result = string.Empty;
        }
        dotthiDTO            = new clsDotThi_DTO();
        dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
        gvDotThi.DataSource  = loadDataToUI(dotthiDTO);
        gvDotThi.Selection.SelectAll();
    }
Ejemplo n.º 2
0
    private DataTable loadDataToUI(clsDotThi_DTO dotthiDTO)
    {
        DataTable dt = new DataTable();

        dt = dotthiDAL.getDotThi(dotthiDTO);
        return(dt);
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["TenDangNhap"]) == "")
        {
            Response.Redirect("~/dangnhap.aspx");
        }
        cathiDAL = new clsCaThi_DAL();
        cathiDTO = new clsCaThi_DTO();

        dotthiDAL = new clsDotThi_DAL();
        dotthiDTO = new clsDotThi_DTO();

        cmn = new clsCommon();
        if (!IsPostBack || !IsCallback)
        {
        }
        if (!Page.IsPostBack)
        {
        }
        loadMasterData();
        if (cboDotThi.Value != null)
        {
            cathiDTO           = new clsCaThi_DTO();
            cathiDTO.MaDotThi  = cboDotThi.Value.ToString();
            gvCaThi.DataSource = loadDataToUI(cathiDTO);
            gvCaThi.DataBind();
        }
    }
Ejemplo n.º 4
0
    protected void gvDotThi_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        dotthiDTO = new clsDotThi_DTO();
        e.Cancel  = true;
        //dotthiDTO.OldID = e.OldValues["MaDotThi"].ToString();
        //dotthiDTO.MaDotThi = e.NewValues["MaDotThi"].ToString();
        dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
        dotthiDTO.NgayTao    = cmn.Convert_DMY_To_MDY(e.NewValues["NgayTao"].ToString());
        dotthiDTO.MoTa       = e.NewValues["MoTa"].ToString();
        int iReturn = dotthiDAL.InsertUpdate(dotthiDTO);

        if (iReturn >= 0)
        {
            dotthiDTO            = new clsDotThi_DTO();
            dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
            gvDotThi.DataSource  = loadDataToUI(dotthiDTO);
            gvDotThi.CancelEdit();
        }
        else if (iReturn == -2)
        {
            strMess = "Không tồn tại mã để cập nhật";
            gvDotThi.DoRowValidation();
        }
        else
        {
            strMess = "Do ràng buộc dữ liệu. Không thể thực hiện cập nhật";
            gvDotThi.DoRowValidation();
        }
    }
Ejemplo n.º 5
0
 public int Delete(clsDotThi_DTO dotthiDTO)
 {
     try
     {
         ListDictionary _list = new ListDictionary();
         _list.Add("MaDotThi", dotthiDTO.MaDotThi);
         int iReturn = obj.ExcSql("Delete_DotThi", _list, CommandType.StoredProcedure);
         return iReturn;
     }
     catch (Exception)
     {
         //return ex.Message;
         return -1111;
     }
 }
Ejemplo n.º 6
0
 public int Delete(clsDotThi_DTO dotthiDTO)
 {
     try
     {
         ListDictionary _list = new ListDictionary();
         _list.Add("MaDotThi", dotthiDTO.MaDotThi);
         int iReturn = obj.ExcSql("Delete_DotThi", _list, CommandType.StoredProcedure);
         return(iReturn);
     }
     catch (Exception)
     {
         //return ex.Message;
         return(-1111);
     }
 }
Ejemplo n.º 7
0
 protected void gvDotThi_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
 {
     dotthiDTO = new clsDotThi_DTO();
     if (e.Parameters == "Update")
     {
         dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
         gvDotThi.DataSource  = loadDataToUI(dotthiDTO);
         gvDotThi.Selection.UnselectAll();
     }
     else
     {
         dotthiDTO.MaLoaiBang = e.Parameters;
         DataTable dt = dotthiDAL.getDotThi(dotthiDTO);
         gvDotThi.DataSource = dt;
         gvDotThi.DataBind();
     }
 }
Ejemplo n.º 8
0
 public DataTable getDotThi(clsDotThi_DTO dotthiDTO)
 {
     ListDictionary _list = new ListDictionary();
     _list.Add("MaDotThi", dotthiDTO.MaDotThi);
     _list.Add("MaLoaiBang", dotthiDTO.MaLoaiBang);
     _list.Add("NgayTao", dotthiDTO.NgayTao);
     _list.Add("MoTa", dotthiDTO.MoTa);
     DataTable dt = new DataTable();
     try
     {
         dt = obj.GetDataTable("Select_Dot_Thi", _list, CommandType.StoredProcedure);
     }
     catch
     {
         dt = null;
     }
     return dt;
 }
Ejemplo n.º 9
0
    protected void gvDotThi_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        dotthiDTO = new clsDotThi_DTO();
        if (e.Parameters == "Update")
        {
            dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
            gvDotThi.DataSource = loadDataToUI(dotthiDTO);
            gvDotThi.Selection.UnselectAll();
        }
        else
        {

            dotthiDTO.MaLoaiBang = e.Parameters;
            DataTable dt = dotthiDAL.getDotThi(dotthiDTO);
            gvDotThi.DataSource = dt;
            gvDotThi.DataBind();
        }
    }
Ejemplo n.º 10
0
 public int InsertUpdate(clsDotThi_DTO dotthiDTO)
 {
     try
     {
         ListDictionary _list = new ListDictionary();
         _list.Add("old_id", dotthiDTO.OldID);
         _list.Add("MaDotThi", dotthiDTO.MaDotThi);
         _list.Add("MaLoaiBang", dotthiDTO.MaLoaiBang);
         _list.Add("NgayTao", dotthiDTO.NgayTao);
         _list.Add("MoTa", dotthiDTO.MoTa);
         int iReturn = obj.ExcSql("Insert_Update_Dot_Thi", _list, CommandType.StoredProcedure);
         return(iReturn);
     }
     catch (Exception)
     {
         //return ex.Message;
         return(-1111); // Đặt số này làm ngoại lệ ko lường trước được. ở StoredProcedure không được return có số này tránh trường hợp trùng
     }
 }
Ejemplo n.º 11
0
 public int InsertUpdate(clsDotThi_DTO dotthiDTO)
 {
     try
     {
         ListDictionary _list = new ListDictionary();
         _list.Add("old_id", dotthiDTO.OldID);
         _list.Add("MaDotThi", dotthiDTO.MaDotThi);
         _list.Add("MaLoaiBang", dotthiDTO.MaLoaiBang);
         _list.Add("NgayTao", dotthiDTO.NgayTao);
         _list.Add("MoTa", dotthiDTO.MoTa);
         int iReturn = obj.ExcSql("Insert_Update_Dot_Thi", _list, CommandType.StoredProcedure);
         return iReturn;
     }
     catch (Exception)
     {
         //return ex.Message;
         return -1111; // Đặt số này làm ngoại lệ ko lường trước được. ở StoredProcedure không được return có số này tránh trường hợp trùng
     }
 }
Ejemplo n.º 12
0
    public DataTable getDotThi(clsDotThi_DTO dotthiDTO)
    {
        ListDictionary _list = new ListDictionary();

        _list.Add("MaDotThi", dotthiDTO.MaDotThi);
        _list.Add("MaLoaiBang", dotthiDTO.MaLoaiBang);
        _list.Add("NgayTao", dotthiDTO.NgayTao);
        _list.Add("MoTa", dotthiDTO.MoTa);
        DataTable dt = new DataTable();

        try
        {
            dt = obj.GetDataTable("Select_Dot_Thi", _list, CommandType.StoredProcedure);
        }
        catch
        {
            dt = null;
        }
        return(dt);
    }
Ejemplo n.º 13
0
    private void loadMasterData()
    {
        dotthiDTO = new clsDotThi_DTO();
        DataTable dt = new DataTable();

        dt = dotthiDAL.getDotThi(dotthiDTO);

        cboDotThi.ValueField = "MaDotThi";
        cboDotThi.TextField  = "MaDotThi";

        cboDotThi.DataSource = dt;
        cboDotThi.DataBind();

        //GridViewDataComboBoxColumn gcCathi = gvCaThi.Columns["MaDotThi"] as GridViewDataComboBoxColumn;
        //gcCathi.PropertiesComboBox.DataSource = dt;
        //gclDiemThi.PropertiesComboBox.ValueField = "MaDienThi";
        //gclDiemThi.PropertiesComboBox.TextField = "TenDiemThi";

        //GridViewDataCheckColumn gclTrangThai = gvDotThi.Columns["TrangThai"] as GridViewDataCheckColumn;
        //gclTrangThai.PropertiesCheckEdit.DisplayTextChecked = "Chon";
    }
Ejemplo n.º 14
0
    protected void gvDotThi_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        dotthiDTO = new clsDotThi_DTO();
        e.Cancel = true;
        dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString() ;
        dotthiDTO.NgayTao = cmn.Convert_DMY_To_MDY(e.NewValues["NgayTao"].ToString());
        dotthiDTO.MoTa = e.NewValues["MoTa"].ToString();

        int iReturn = dotthiDAL.InsertUpdate(dotthiDTO);
        if (iReturn >= 0)
        {
            dotthiDTO = new clsDotThi_DTO();
            dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
            gvDotThi.DataSource = loadDataToUI(dotthiDTO);
            gvDotThi.CancelEdit();
        }
        else
        {
            strMess = "Lưu Dữ Liệu Không Thành Công";
            gvDotThi.DoRowValidation();
        }
    }
Ejemplo n.º 15
0
 protected void gvDotThi_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
 {
     dotthiDTO = new clsDotThi_DTO();
     string strReturn = string.Empty;
     string strMess = string.Empty;
     int iRow = gvDotThi.VisibleRowCount;
     List<object> keyValues = gvDotThi.GetSelectedFieldValues("MaDotThi");
     foreach (object key in keyValues)
     {
         dotthiDTO.MaDotThi = key.ToString();
         int iReturn = dotthiDAL.Delete(dotthiDTO);
         if (iReturn < 0)
             strMess += " " + key.ToString();
     }
     if (strMess != string.Empty)
         e.Result = "Do ràng buộc dữ liệu, không thể xóa " + strMess;
     else
         e.Result = string.Empty;
     dotthiDTO = new clsDotThi_DTO();
     dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
     gvDotThi.DataSource = loadDataToUI(dotthiDTO);
     gvDotThi.Selection.SelectAll();
 }
Ejemplo n.º 16
0
    protected void gvDotThi_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        dotthiDTO            = new clsDotThi_DTO();
        e.Cancel             = true;
        dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
        dotthiDTO.NgayTao    = cmn.Convert_DMY_To_MDY(e.NewValues["NgayTao"].ToString());
        dotthiDTO.MoTa       = e.NewValues["MoTa"].ToString();

        int iReturn = dotthiDAL.InsertUpdate(dotthiDTO);

        if (iReturn >= 0)
        {
            dotthiDTO            = new clsDotThi_DTO();
            dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
            gvDotThi.DataSource  = loadDataToUI(dotthiDTO);
            gvDotThi.CancelEdit();
        }
        else
        {
            strMess = "Lưu Dữ Liệu Không Thành Công";
            gvDotThi.DoRowValidation();
        }
    }
Ejemplo n.º 17
0
 private DataTable loadDataToUI(clsDotThi_DTO dotthiDTO)
 {
     DataTable dt = new DataTable();
     dt = dotthiDAL.getDotThi(dotthiDTO);
     return dt;
 }
Ejemplo n.º 18
0
 protected void gvDotThi_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
 {
     dotthiDTO = new clsDotThi_DTO();
     e.Cancel = true;
     //dotthiDTO.OldID = e.OldValues["MaDotThi"].ToString();
     //dotthiDTO.MaDotThi = e.NewValues["MaDotThi"].ToString();
     dotthiDTO.MaLoaiBang =cboLoaiBang.Value.ToString();
     dotthiDTO.NgayTao = cmn.Convert_DMY_To_MDY(e.NewValues["NgayTao"].ToString());
     dotthiDTO.MoTa = e.NewValues["MoTa"].ToString();
     int iReturn = dotthiDAL.InsertUpdate(dotthiDTO);
     if (iReturn >= 0)
     {
         dotthiDTO = new clsDotThi_DTO();
         dotthiDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
         gvDotThi.DataSource = loadDataToUI(dotthiDTO);
         gvDotThi.CancelEdit();
     }
     else if (iReturn == -2)
     {
         strMess = "Không tồn tại mã để cập nhật";
         gvDotThi.DoRowValidation();
     }
     else
     {
         strMess = "Do ràng buộc dữ liệu. Không thể thực hiện cập nhật";
         gvDotThi.DoRowValidation();
     }
 }
Ejemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["TenDangNhap"]) == "")
            Response.Redirect("~/dangnhap.aspx");
        cathiDAL = new clsCaThi_DAL();
        cathiDTO = new clsCaThi_DTO();

        dotthiDAL = new clsDotThi_DAL();
        dotthiDTO = new clsDotThi_DTO();

        cmn = new clsCommon();
        if (!IsPostBack || !IsCallback)
        {

        }
        if (!Page.IsPostBack)
        {

        }
        loadMasterData();
        if (cboDotThi.Value != null)
        {
            cathiDTO = new clsCaThi_DTO();
            cathiDTO.MaDotThi = cboDotThi.Value.ToString();
            gvCaThi.DataSource = loadDataToUI(cathiDTO);
            gvCaThi.DataBind();
        }
    }
Ejemplo n.º 20
0
    private void loadMasterData()
    {
        dotthiDTO = new clsDotThi_DTO();
        DataTable dt = new DataTable();
        dt = dotthiDAL.getDotThi(dotthiDTO);

        cboDotThi.ValueField = "MaDotThi";
        cboDotThi.TextField = "MaDotThi";

        cboDotThi.DataSource = dt;
        cboDotThi.DataBind();

        //GridViewDataComboBoxColumn gcCathi = gvCaThi.Columns["MaDotThi"] as GridViewDataComboBoxColumn;
        //gcCathi.PropertiesComboBox.DataSource = dt;
        //gclDiemThi.PropertiesComboBox.ValueField = "MaDienThi";
        //gclDiemThi.PropertiesComboBox.TextField = "TenDiemThi";

        //GridViewDataCheckColumn gclTrangThai = gvDotThi.Columns["TrangThai"] as GridViewDataCheckColumn;
        //gclTrangThai.PropertiesCheckEdit.DisplayTextChecked = "Chon";
    }