Пример #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 btnEdit_Click(object sender, DirectEventArgs e)
    {
        string maNhom = string.Empty;

        if (e.ExtraParams["EditNhomTC"] == "True")
        {
            maNhom = hdfMaNhom.Text;
            if (maNhom.LastIndexOf(',') != -1)
            {
                maNhom = maNhom.Substring(0, maNhom.LastIndexOf(','));
            }
        }
        else
        {
            maNhom = hdfRecordID.Text;
        }
        DataTable record = new TieuChiDanhGiaController().GetByPrkey(maNhom);

        txtMaNhom.Text  = record.Rows[0]["MaNhom"].ToString();
        txtTenNhom.Text = record.Rows[0]["TenNhom"].ToString();
        txtHeSo.Text    = record.Rows[0]["HeSo"].ToString();
        txtGhiChu.Text  = record.Rows[0]["GhiChu"].ToString();
        cbxTieuChiCha.SetValue(record.Rows[0]["ParentID"].ToString());
        txtMaNhom.Disabled = true;

        hdfCommand.Text   = "Update";
        wdAddWindow.Icon  = Icon.Pencil;
        wdAddWindow.Title = "Sửa thông tin tiêu chí đánh giá";
        wdAddWindow.Show();
    }
Пример #3
0
    //private void LoadNhomTieuChi()
    //{
    //    Ext.Net.TreeNode root = new Ext.Net.TreeNode();

    //    // tao node goc
    //    Ext.Net.TreeNode node = new Ext.Net.TreeNode("Các nhóm tiêu chí đánh giá");
    //    node.Icon = Ext.Net.Icon.House;
    //    root.Nodes.Add(node);
    //    node.Expanded = true;
    //    node.NodeID = "-1";
    //    node.Listeners.Click.Handler = @"#{hdfMaNhom}.setValue('-1');PagingToolbar1.pageIndex=0;PagingToolbar1.doLoad();#{Store1}.reload();";
    //    LoadNhomTieuChiCon(node);

    //    TreeDMTieuChiDanhGia.Root.Clear();
    //    TreeDMTieuChiDanhGia.Root.Add(root);
    //}

    //private void LoadNhomTieuChiCon(Ext.Net.TreeNode parentNode)
    //{
    //    var data = new TieuChiDanhGiaController().GetByParentID(parentNode.NodeID, Session["MaDonVi"].ToString());
    //    foreach (DataRow item in data.Rows)
    //    {
    //        Ext.Net.TreeNode node = new Ext.Net.TreeNode(item["TenNhom"].ToString());
    //        node.Icon = Ext.Net.Icon.Folder;
    //        node.Expanded = true;
    //        node.NodeID = item["MaNhom"].ToString();
    //        node.Listeners.Click.Handler = "#{hdfMaNhom}.setValue('" + node.NodeID + "'); PagingToolbar1.pageIndex=0; PagingToolbar1.doLoad(); #{Store1}.reload();";
    //        parentNode.Nodes.Add(node);

    //        //LoadNhomTieuChiCon(node);
    //    }
    //}

    #endregion

    protected void btnChuyenTiep_Click(object sender, DirectEventArgs e)
    {
        RowSelectionModel sm = GridPanel1.SelectionModel.Primary as RowSelectionModel;

        foreach (var item in sm.SelectedRows)
        {
            DataTable table = new TieuChiDanhGiaController().GetByPrkey(item.RecordID);

            if (table.Rows.Count > 0)
            {
                TieuChiDanhGiaInfo tc = new TieuChiDanhGiaInfo();
                tc.MaNhom      = table.Rows[0]["MaNhom"].ToString();
                tc.TenNhom     = table.Rows[0]["TenNhom"].ToString();
                tc.HeSo        = decimal.Parse(table.Rows[0]["HeSo"].ToString());
                tc.MaDonVi     = table.Rows[0]["MaDonVi"].ToString();
                tc.ParentID    = cbxChuyenTiepNhomTC.SelectedItem.Value;
                tc.GhiChu      = table.Rows[0]["GhiChu"].ToString();
                tc.CreatedDate = DateTime.Parse(table.Rows[0]["CreatedDate"].ToString());
                tc.CreatedBy   = int.Parse(table.Rows[0]["CreatedBy"].ToString());

                new TieuChiDanhGiaController().Update(tc);
            }
        }
        GridPanel1.Reload();
        wdChuyenTiep.Hide();
    }
Пример #4
0
 protected void btnOK_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DataTable record = new TieuChiDanhGiaController().GetByPrkey(txtmaloaihdcoppy.Text);
         if (record.Rows.Count > 0)
         {
             Dialog.ShowNotification("Mã đã tồn tại");
         }
         else
         {
             record = new TieuChiDanhGiaController().GetByPrkey(hdfRecordID.Text);
             record.Rows[0]["MaNhom"] = txtmaloaihdcoppy.Text;
             TieuChiDanhGiaInfo item = new TieuChiDanhGiaInfo()
             {
                 MaNhom      = record.Rows[0]["MaNhom"].ToString(),
                 TenNhom     = record.Rows[0]["TenNhom"].ToString(),
                 HeSo        = decimal.Parse(record.Rows[0]["HeSo"].ToString()),
                 GhiChu      = record.Rows[0]["GhiChu"].ToString(),
                 CreatedDate = DateTime.Parse(record.Rows[0]["CreatedDate"].ToString()),
                 CreatedBy   = int.Parse(record.Rows[0]["CreatedBy"].ToString()),
                 MaDonVi     = record.Rows[0]["MaDonVi"].ToString(),
                 ParentID    = record.Rows[0]["ParentID"].ToString(),
             };
             new TieuChiDanhGiaController().Insert(item);
             GridPanel1.Reload();
         }
         wdInputNewPrimaryKey.Hide();
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message.ToString());
     }
 }
Пример #5
0
    protected void btnCapNhat_Click(object sender, DirectEventArgs e)
    {
        TieuChiDanhGiaInfo       obj = new TieuChiDanhGiaInfo();
        TieuChiDanhGiaController ctr = new TieuChiDanhGiaController();

        obj.MaNhom  = txtMaNhom.Text;
        obj.TenNhom = txtTenNhom.Text;
        if (!string.IsNullOrEmpty(txtHeSo.Text))
        {
            obj.HeSo = decimal.Parse(txtHeSo.Text.Replace('.', ','));
        }
        obj.GhiChu      = txtGhiChu.Text;
        obj.CreatedDate = DateTime.Now;
        obj.CreatedBy   = CurrentUser.ID;
        obj.MaDonVi     = Session["MaDonVi"].ToString();

        if (cbxTieuChiCha.Value != null)
        {
            obj.ParentID = cbxTieuChiCha.Value.ToString();
        }
        else
        {
            obj.ParentID = "-1";
        }

        if (e.ExtraParams["Command"] == "Edit")
        {
            obj.MaNhom = hdfRecordID.Text;
            ctr.Update(obj);
            wdAddWindow.Hide();
            GridPanel1.Reload();
        }
        else
        {
            DataTable tmp = new TieuChiDanhGiaController().GetByPrkey(obj.MaNhom);
            if (tmp.Rows.Count == 0)
            {
                ctr.Insert(obj);
                GridPanel1.Reload();
            }
            else
            {
                X.Msg.Alert("Thông báo", "Mã tiêu chí đã tồn tại").Show();
            }
            if (e.ExtraParams["Close"] == "True")
            {
                wdAddWindow.Hide();
                cbxTieuChiCha.Reset();
            }
        }
        grp_NhomTC.Reload();
    }
Пример #6
0
    protected void cbxTieuChiCha_Store_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
    {
        string        maDv  = string.Empty;//Session["MaDonVi"].ToString()
        DataTable     table = new TieuChiDanhGiaController().GetByParentID("-1", maDv);
        List <object> obj   = new List <object>();

        //obj.Add(new { MaNhom = "-1", TenNhom = "Là nhóm tiêu chí"});

        foreach (DataRow item in table.Rows)
        {
            obj.Add(new { MaNhom = item["MaNhom"].ToString(), TenNhom = item["TenNhom"].ToString() });
        }
        cbxTieuChiCha_Store.DataSource = obj;
        cbxTieuChiCha_Store.DataBind();
    }
Пример #7
0
    protected void btnDongYThemTieuChi_Click(object sender, DirectEventArgs e)
    {
        SelectedRowCollection    SelectedRow         = checkboxSelectionTieuChiDG.SelectedRows;
        TieuChiDanhGiaController tieuChiDGController = new TieuChiDanhGiaController();
        string str = "";

        foreach (var item in SelectedRow)
        {
            DataTable emp = tieuChiDGController.GetByPrkey(item.RecordID.ToString());
            if (emp.Rows.Count > 0)
            {
                string maTieuChi = emp.Rows[0]["MaNhom"].ToString();
                if (new TieuChi_DotDanhGiaController().CheckExistTieuChi_DotDanhGia(emp.Rows[0]["MaNhom"].ToString(), hdfRecordID.Text) == false)
                {
                    TieuChi_DotDanhGiaInfo info = new TieuChi_DotDanhGiaInfo()
                    {
                        MaDotDanhGia = hdfRecordID.Text,
                        MaTieuChi    = emp.Rows[0]["MaNhom"].ToString(),
                        CreatedDate  = DateTime.Now,
                        CreatedBy    = CurrentUser.ID
                    };
                    int id = new TieuChi_DotDanhGiaController().Insert(info);
                    info.ID = id;

                    // tạo bản đánh giá trống
                    //CreateKetQuaDanhGiaByIdTieuChiDotDanhGia(info);
                }
                else
                {
                    str += emp.Rows[0]["TenNhom"].ToString() + ", ";
                }
            }
        }
        RM.RegisterClientScriptBlock("reloadst2", "#{grp_DanhSachTieuChi_Store}.reload();");
        if (!string.IsNullOrEmpty(str))
        {
            X.MessageBox.Alert("Thông báo", "Các tiêu chí sau đã tồn tại: " + str).Show();
        }
        else
        {
            X.MessageBox.Alert("Thông báo", "Đã thêm cán bộ thành công");
        }
        wdThemTieuChiDanhGia.Hide();
    }
Пример #8
0
    protected void btnUpdateCriterion_Click(object sender, DirectEventArgs e)
    {
        try
        {
            DAL.TieuChiDanhGia       tieuChi    = new DAL.TieuChiDanhGia();
            TieuChiDanhGiaController controller = new TieuChiDanhGiaController();
            if (e.ExtraParams["Edit"] == "True")
            {
                tieuChi = controller.GetById(hdfRecordID.Text);
            }
            if (!string.IsNullOrEmpty(txtCriterionWeight.Text))
            {
                tieuChi.HeSo = decimal.Parse(txtCriterionWeight.Text.Replace('.', ','));
            }
            else
            {
                tieuChi.HeSo = 1;
            }
            tieuChi.TenNhom  = txtCriterionName.Text;
            tieuChi.ParentID = cbxCriterionGroup.SelectedItem.Value;
            tieuChi.GhiChu   = txtNote.Text;
            tieuChi.MaDonVi  = Session["MaDonVi"].ToString();

            if (e.ExtraParams["Edit"] == "True")
            {
                tieuChi.MaNhom      = hdfRecordID.Text;
                hdfTypeCommand.Text = "Edit";
                hdfClose.Text       = "True";
                // update criterion
                controller.Update(tieuChi);
                hdfInsertedID.Text = tieuChi.MaNhom;
                if (hdfIsEdit.Text != "True")
                {
                    Dialog.ShowNotification("Cập nhật thông tin tiêu chí đánh giá thành công");
                    wdAddNewEstimateCriterion.Hide();
                }
            }
            else
            {
                tieuChi.MaNhom      = txtCriterionCode.Text;
                hdfTypeCommand.Text = "Insert";
                // insert criterion
                tieuChi.CreatedBy   = CurrentUser.ID;
                tieuChi.CreatedDate = DateTime.Now;
                controller.Insert(tieuChi);
                hdfInsertedID.Text = tieuChi.MaNhom;
                if (hdfIsEdit.Text != "True")
                {
                    Dialog.ShowNotification("Thêm mới thành công tiêu chí đánh giá");
                }
                if (e.ExtraParams["Close"] == "True")
                {
                    hdfClose.Text = "True";
                    if (hdfIsEdit.Text != "True")
                    {
                        wdAddNewEstimateCriterion.Hide();
                    }
                }
                else
                {
                    hdfClose.Text = "False";
                }
            }
            RM.RegisterClientScriptBlock("save", "grpTestList.save();");
            if (hdfIsEdit.Text != "True")
            {
                if (hdfClose.Text != "True")
                {
                    RM.RegisterClientScriptBlock("rsform1", "ResetCriterionWindow();");
                }
                GridPanel1.Reload();
            }
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("duplicate"))
            {
                Dialog.ShowError("Mã tiêu chí đánh giá đã bị trùng. Vui lòng nhập mã khác.");
            }
            else
            {
                Dialog.ShowError(ex.Message);
            }
        }
    }
Пример #9
0
    protected void ImportDataFromExcel(object sender, DirectEventArgs e)
    {
        try
        {
            string extension = System.IO.Path.GetExtension(FileUploadField1.PostedFile.FileName).ToLower();

            if (!extension.Equals(".xls") && !extension.Equals(".xlsx"))
            {
                X.Msg.Alert("Thông báo", "Hãy chọn file excel").Show();
                return;
            }
            string fn           = System.IO.Path.GetFileName(FileUploadField1.PostedFile.FileName);
            string saveLocation = Server.MapPath("../FilesUpload") + "\\" + fn;

            var excel = new ExcelQueryFactory();
            excel.FileName = saveLocation;

            // get config
            string startCell = "";
            string endCell   = "";
            getConfig(out startCell, out endCell);

            var datas = from x in excel.WorksheetRangeNoHeader(startCell, endCell, cbSheetName.Value.ToString())
                        select x;
            int thanhCong = 0, daTonTai = 0;
            foreach (var item in datas)
            {
                if (item[0] == "")
                {
                    break;
                }

                TieuChiDanhGiaInfo tc = new TieuChiDanhGiaInfo();
                tc.MaNhom  = item[0].ToString();
                tc.TenNhom = item[1].ToString();
                if (item[2] != null && item[2] != "")
                {
                    tc.HeSo = decimal.Parse(item[2].ToString());
                }
                else
                {
                    tc.HeSo = 1;
                }
                tc.GhiChu      = item[3].ToString();
                tc.CreatedDate = DateTime.Now;
                tc.CreatedBy   = CurrentUser.ID;
                if (cbxChonNhomTC.SelectedItem.Value != null)
                {
                    tc.ParentID = cbxChonNhomTC.SelectedItem.Value.ToString();
                }
                else
                {
                    tc.ParentID = "";
                }
                tc.MaDonVi = Session["MaDonVi"].ToString();

                DataTable tmp = new TieuChiDanhGiaController().GetByPrkey(item[0].ToString());
                if (tmp.Rows.Count > 0)
                {
                    new TieuChiDanhGiaController().Update(tc);
                    daTonTai++;
                }
                else
                {
                    if (tc.ParentID != "")
                    {
                        new TieuChiDanhGiaController().Insert(tc);
                        thanhCong++;
                    }
                }
            }
            Dialog.ShowNotification(string.Format("Đã thêm mới thành công {0} tiêu chí.\n Cập nhật thành công {1} tiêu chí!", thanhCong, daTonTai));
            wdNhapTuExcel.Hide();
            GridPanel1.Reload();
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString()).Show();
        }
    }