protected void dgrKhoiLuongCV2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex < 0)
            {
                return;
            }

            TextBox txtTyTrongCV = (TextBox)e.Row.FindControl("txtTyTrongCV");
            TextBox txtThoiGian  = (TextBox)e.Row.FindControl("txtThoiGian");

            Label   txtTenCongViec  = (Label)e.Row.FindControl("txtTenCongViec");
            Label   txtSoLieuCamKet = (Label)e.Row.FindControl("txtSoLieuCamKet");
            Label   txtYeuCauHoTro  = (Label)e.Row.FindControl("txtYeuCauHoTro");
            ListBox dropBoPhanHoTro = (ListBox)e.Row.FindControl("dropBoPhanHoTro");
            TextBox txtTBPDanhGia   = (TextBox)e.Row.FindControl("txtTBPDanhGia");

            txtTyTrongCV.ReadOnly = true;

            if (CurrentUser.RoleID == (int)Constants.Role.NhanVien || CurrentUser.RoleID == (int)Constants.Role.NhanVienKD)
            {
                txtTBPDanhGia.ReadOnly = true;
                txtThoiGian.ReadOnly   = true;
            }
            else
            {
                txtTBPDanhGia.ReadOnly = false;
                txtThoiGian.ReadOnly   = false;
            }

            DataRowView crrData = (DataRowView)e.Row.DataItem;

            int idDotDanhGia = ConvertUtility.ToInt32(crrData["IDDotDanhGia"]);
            int idCongViec   = ConvertUtility.ToInt32(crrData["IDCongViec"]);

            dropBoPhanHoTro.Items.Clear();
            dropBoPhanHoTro.DataSource = dtBoPhanHoTro;
            dropBoPhanHoTro.DataBind();

            DataTable dtBoPhanHoTroSelected = DanhGiaThang_DGCBCNVDanhGiaTTCVController.GetKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec);

            if (dtBoPhanHoTroSelected != null && dtBoPhanHoTroSelected.Rows.Count > 0)
            {
                foreach (ListItem item in dropBoPhanHoTro.Items)
                {
                    DataRow[] row = dtBoPhanHoTroSelected.Select("IDBoPhanHoTro = " + item.Value);
                    if (row.Length > 0)
                    {
                        item.Selected = true;
                    }
                }
            }
        }
Esempio n. 2
0
        protected void dgrKhoiLuongCV3_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex < 0)
            {
                return;
            }

            TextBox txtTyTrongCV    = (TextBox)e.Row.FindControl("txtTyTrongCV");
            TextBox txtTenCongViec  = (TextBox)e.Row.FindControl("txtTenCongViec");
            TextBox txtSoLieuCamKet = (TextBox)e.Row.FindControl("txtSoLieuCamKet");
            TextBox txtYeuCauHoTro  = (TextBox)e.Row.FindControl("txtYeuCauHoTro");
            Button  btnDelete       = (Button)e.Row.FindControl("btnDelete");
            ListBox dropBoPhanHoTro = (ListBox)e.Row.FindControl("dropBoPhanHoTro");

            txtTyTrongCV.ReadOnly    = true;
            txtSoLieuCamKet.ReadOnly = true;
            txtYeuCauHoTro.ReadOnly  = true;
            txtTenCongViec.ReadOnly  = true;

            DataRowView crrData = (DataRowView)e.Row.DataItem;

            int idDotDanhGia = ConvertUtility.ToInt32(crrData["IDDotDanhGia"]);
            int idCongViec   = ConvertUtility.ToInt32(crrData["IDCongViec"]);

            dropBoPhanHoTro.Items.Clear();
            dropBoPhanHoTro.DataSource = dtBoPhanHoTro;
            dropBoPhanHoTro.DataBind();

            DataTable dtBoPhanHoTroSelected = DanhGiaThang_DGCBCNVDanhGiaTTCVController.GetKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec);

            if (dtBoPhanHoTroSelected != null && dtBoPhanHoTroSelected.Rows.Count > 0)
            {
                foreach (ListItem item in dropBoPhanHoTro.Items)
                {
                    DataRow[] row = dtBoPhanHoTroSelected.Select("IDBoPhanHoTro = " + item.Value);
                    if (row.Length > 0)
                    {
                        item.Selected = true;
                    }
                }
            }
        }
Esempio n. 3
0
        protected void dgrKhoiLuongCV2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex < 0)
            {
                return;
            }

            DataRowView crrData         = (DataRowView)e.Row.DataItem;
            Button      btnDelete       = (Button)e.Row.FindControl("btnDelete");
            TextBox     txtSoLieuCamKet = (TextBox)e.Row.FindControl("txtSoLieuCamKet");
            TextBox     txtTenCongViec  = (TextBox)e.Row.FindControl("txtTenCongViec");
            TextBox     txtTyTrongCV    = (TextBox)e.Row.FindControl("txtTyTrongCV");

            if (CurrentUser.RoleID == (int)Constants.Role.NhanVien || CurrentUser.RoleID == (int)Constants.Role.NhanVienKD)
            {
                QuanLyCongViecKTXVaPSInfo infoCongViec = QuanLyCongViecKTXVaPSController.GetInfo(ConvertUtility.ToInt32(crrData["IDCongViec"]));

                if (infoCongViec != null)
                {
                    if (CurrentUser.UserID == infoCongViec.CreateBy)
                    {
                        if (ConvertUtility.ToInt32(dt.Rows[0]["TrangThai"]) <= (int)Constants.TrangThaiDanhGiaNhanVien.DangDanhGia)
                        {
                            btnDelete.Visible = true;
                        }
                        else
                        {
                            btnDelete.Visible = false;
                        }
                        txtSoLieuCamKet.ReadOnly = false;
                        txtTenCongViec.ReadOnly  = false;
                        txtTyTrongCV.ReadOnly    = false;
                    }
                    else
                    {
                        btnDelete.Visible        = false;
                        txtSoLieuCamKet.ReadOnly = true;
                        txtTenCongViec.ReadOnly  = true;
                        txtTyTrongCV.ReadOnly    = true;
                    }
                }
                else
                {
                    btnDelete.Visible        = false;
                    txtSoLieuCamKet.ReadOnly = true;
                    txtTenCongViec.ReadOnly  = true;
                    txtTyTrongCV.ReadOnly    = true;
                }
            }
            else
            {
                btnDelete.Visible        = true;
                txtSoLieuCamKet.ReadOnly = false;
                txtTenCongViec.ReadOnly  = false;
                txtTyTrongCV.ReadOnly    = false;
            }


            ListBox dropBoPhanHoTro = (ListBox)e.Row.FindControl("dropBoPhanHoTro");

            dropBoPhanHoTro.Items.Clear();
            dropBoPhanHoTro.DataSource = dtBoPhanHoTro;
            dropBoPhanHoTro.DataBind();


            int idDotDanhGia = ConvertUtility.ToInt32(crrData["IDDotDanhGia"]);
            int idCongViec   = ConvertUtility.ToInt32(crrData["IDCongViec"]);

            DataTable dtBoPhanHoTroSelected = DanhGiaThang_DGCBCNVDanhGiaTTCVController.GetKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec);

            if (dtBoPhanHoTroSelected != null && dtBoPhanHoTroSelected.Rows.Count > 0)
            {
                foreach (ListItem item in dropBoPhanHoTro.Items)
                {
                    DataRow[] row = dtBoPhanHoTroSelected.Select("IDBoPhanHoTro = " + item.Value);
                    if (row.Length > 0)
                    {
                        item.Selected = true;
                    }
                }
            }

            TextBox   txtNguoiThamGia = (TextBox)e.Row.FindControl("txtNguoiThamGia");
            DataTable dtTen           = DanhGiaThang_BoPhanTTCVController.GetNguoiThamGiaCongViecKTXVaPS(idDotDanhGia, idCongViec);

            if (dtTen != null && dtTen.Rows.Count > 0)
            {
                txtNguoiThamGia.Text = dtTen.Rows[0]["Ten"].ToString();
            }
            else
            {
                txtNguoiThamGia.Text = "";
            }

            btnDelete.OnClientClick = "return window.confirm('Bạn chắc chắn xóa công việc này không ?')";
        }