Пример #1
0
    protected void btnEditCriterion_Click(object sender, DirectEventArgs e)
    {
        try
        {
            DAL.TieuChiDanhGia tieuChi = new TieuChiDanhGiaController().GetById(hdfRecordID.Text);
            if (tieuChi != null)
            {
                // get criterion information
                txtCriterionCode.Text = tieuChi.MaNhom;
                txtCriterionWeight.SetValue(tieuChi.HeSo);
                txtCriterionName.Text = tieuChi.TenNhom;
                cbxCriterionGroup.SetValue(tieuChi.ParentID);
                txtNote.Text = tieuChi.GhiChu;
                // get test information
                List <TracNghiemInfo> tests = new TracNghiemController().GetByCriterionID(tieuChi.MaNhom);
                grpTestListStore.DataSource = tests;
                grpTestListStore.DataBind();

                wdAddNewEstimateCriterion.Show();
            }
        }
        catch (Exception ex)
        {
            Dialog.ShowError("Có lỗi xảy ra: " + ex.Message);
        }
    }
Пример #2
0
    protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e)
    {
        try
        {
            TracNghiemController           tracNghiemController = new TracNghiemController();
            ChangeRecords <TracNghiemInfo> tracNghiems          = e.DataHandler.ObjectData <TracNghiemInfo>();

            // insert
            foreach (TracNghiemInfo created in tracNghiems.Created)
            {
                try
                {
                    DAL.TracNghiem info = new DAL.TracNghiem();
                    info.CriterionID = hdfInsertedID.Text;
                    info.ExplainName = created.ExplainName;
                    info.MaxPoint    = created.MaxPoint;
                    info.MinPoint    = created.MinPoint;
                    info.Order       = created.Order;
                    tracNghiemController.Insert(info);
                }
                catch (Exception ex)
                {
                }
            }

            // update
            foreach (TracNghiemInfo updated in tracNghiems.Updated)
            {
                try
                {
                    DAL.TracNghiem info = new DAL.TracNghiem();
                    info.CriterionID = hdfInsertedID.Text;
                    info.ExplainName = updated.ExplainName;
                    info.MaxPoint    = updated.MaxPoint;
                    info.MinPoint    = updated.MinPoint;
                    info.Order       = updated.Order;
                    tracNghiemController.Update(info);
                }
                catch (Exception ex)
                {
                }
            }

            // delete
            foreach (TracNghiemInfo deleted in tracNghiems.Deleted)
            {
                try
                {
                    tracNghiemController.Delete(deleted.ID);
                }
                catch (Exception ex)
                {
                }
            }
            if (hdfTypeCommand.Text == "Insert")
            {
                Dialog.ShowNotification("Thêm mới thành công tiêu chí đánh giá");
                if (hdfClose.Text == "True")
                {
                    wdAddNewEstimateCriterion.Hide();
                }
                else
                {
                    RM.RegisterClientScriptBlock("rsform", "ResetCriterionWindow();");
                }
            }
            else if (hdfTypeCommand.Text == "Edit")
            {
                Dialog.ShowNotification("Cập nhật thông tin tiêu chí đánh giá thành công");
                wdAddNewEstimateCriterion.Hide();
            }
            GridPanel1.Reload();
        }
        catch (Exception ex)
        {
            Dialog.ShowError("Có lỗi xảy ra: " + ex.Message);
        }
    }