Example #1
0
        private void Load_LichSu()
        {
            clsCongViec_LichSu cls = new clsCongViec_LichSu();

            cls.ID_CongViec_LichSu = Convert.ToInt32(m_iID_CongViec_LichSu);
            DataTable dt = cls.SelectOne();

            txtMaCVCu.EditValue        = dt.Rows[0]["Ma_CongViec"];
            txtTieuDeCu.EditValue      = dt.Rows[0]["TieuDe"];
            txtMoTaCu.EditValue        = dt.Rows[0]["MoTa"];
            cmbLoaiCVCu.EditValue      = dt.Rows[0]["ID_LoaiCV"];
            cmbDoUuTienCu.EditValue    = int.Parse(dt.Rows[0]["ID_MucDoUuTien"].ToString());
            cmbCVGocCu.EditValue       = dt.Rows[0]["ID_CongViec_Goc"].ToString();
            cmbNguoiYCCu.EditValue     = dt.Rows[0]["ID_NguoiYeuCau"].ToString();
            dtNgayDenHanCu.Value       = dt.Rows[0]["Ngay_DenHan"];
            dtNgayYeuCauCu.Value       = dt.Rows[0]["Ngay_YeuCau"];
            txtThoiGian_DKCu.EditValue = dt.Rows[0]["ThoiGian_DuKien"];
            cmbDVTGCu.SelectedValue    = short.Parse(dt.Rows[0]["ID_ThoiGian"].ToString());
            dtNgayBatDauCu.Value       = dt.Rows[0]["Ngay_BatDau"];
            dtNgayHoanThanhCu.Value    = dt.Rows[0]["Ngay_HoanThanh"];
            cmbTrangThaiCu.EditValue   = int.Parse(dt.Rows[0]["ID_TrangThai"].ToString());
            txtDiaDiemCu.EditValue     = dt.Rows[0]["DiaDiem"];
            string[] nhanviencu = dt.Rows[0]["DS_ID_NhanVien"].ToString().Split(',');
            cmbNhanVienCu.EditValue = nhanviencu[0];

            cmbNguoiTHCu.SetEditValue(dt.Rows[0]["DS_ID_NhanVien"].ToString());
        }
Example #2
0
        private void Load_fgLichSu()
        {
            var fg = fgLichSu;

            fg.Tag = 0;
            fg.BeginUpdate();
            clsCongViec_LichSu lichSu = new clsCongViec_LichSu();
            DataTable          dt     = lichSu.Select_ID_CongViec(m_iID_CongViec);

            fg.ClearRows();
            fg.SetDataSource(dt);

            //for (int i = fg.Rows.Fixed; i < fg.Rows.Count; i++)
            //{
            //    if (fg.GetDataDisplay(i, "MoTa").Length > 100)
            //    {
            //        fg[i, "MoTa"] = HelperMethods.TruncateString(fg.GetDataDisplay(i, "MoTa"), 100) + " ...";
            //    }
            //    for (int j = i + 1; j < fg.Rows.Count; j++)
            //    {
            //        if (fg.GetDataDisplay(i, "TieuDe").ToLower().Trim() != fg.GetDataDisplay(j, "TieuDe").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["TieuDe"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "MoTa").ToLower().Trim() != fg.GetDataDisplay(j, "MoTa").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["MoTa"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ngay_YeuCau").ToLower().Trim() != fg.GetDataDisplay(j, "Ngay_YeuCau").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ngay_YeuCau"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ngay_DenHan").ToLower().Trim() != fg.GetDataDisplay(j, "Ngay_DenHan").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ngay_DenHan"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "ThoiGian_DuKien").ToLower().Trim() != fg.GetDataDisplay(j, "ThoiGian_DuKien").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["ThoiGian_DuKien"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ngay_BatDau").ToLower().Trim() != fg.GetDataDisplay(j, "Ngay_BatDau").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ngay_BatDau"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ngay_HoanThanh").ToLower().Trim() != fg.GetDataDisplay(j, "Ngay_HoanThanh").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ngay_HoanThanh"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "PhanTramHoanThanh").ToLower().Trim() != fg.GetDataDisplay(j, "PhanTramHoanThanh").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["PhanTramHoanThanh"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "TenNguoiLap").ToLower().Trim() != fg.GetDataDisplay(j, "TenNguoiLap").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["TenNguoiLap"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ngay_Lap").ToLower().Trim() != fg.GetDataDisplay(j, "Ngay_Lap").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ngay_Lap"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "TenNguoiSuaCuoi").ToLower().Trim() != fg.GetDataDisplay(j, "TenNguoiSuaCuoi").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["TenNguoiSuaCuoi"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ngay_SuaCuoi").ToLower().Trim() != fg.GetDataDisplay(j, "Ngay_SuaCuoi").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ngay_SuaCuoi"].Index, csThayDoi);
            //        }
            //        if (fg.GetDataDisplay(i, "Ten_CongViecGoc").ToLower().Trim() != fg.GetDataDisplay(j, "Ten_CongViecGoc").ToLower().Trim())
            //        {
            //            fg.SetCellStyle(j, fg.Cols["Ten_CongViecGoc"].Index, csThayDoi);
            //        }
            //    }
            //}

            for (int i = 1; i < dt.Rows.Count; i++)
            {
                if (dt.Rows.Count == 1)
                {
                    if (dt.Rows[i]["MoTa"].ToString().Trim().Length > 100)
                    {
                        fg[i, "MoTa"] = HelperMethods.TruncateString(fg.GetDataDisplay(i, "MoTa"), 100) + " ...";
                    }
                }
                if (i < dt.Rows.Count - 1)
                {
                    if (dt.Rows[i]["MoTa"].ToString().Length > 100)
                    {
                        fg[i, "MoTa"]     = HelperMethods.TruncateString(fg.GetDataDisplay(i, "MoTa"), 100) + " ...";
                        fg[i + 1, "MoTa"] = HelperMethods.TruncateString(fg.GetDataDisplay(i, "MoTa"), 100) + " ...";
                        fg[i + 2, "MoTa"] = HelperMethods.TruncateString(fg.GetDataDisplay(i, "MoTa"), 100) + " ...";
                    }
                    if (dt.Rows[i]["TieuDe"].ToString().ToLower() != dt.Rows[i - 1]["TieuDe"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["TieuDe"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["MoTa"].ToString().ToLower() != dt.Rows[i - 1]["MoTa"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["MoTa"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ngay_YeuCau"].ToString().ToLower() != dt.Rows[i - 1]["Ngay_YeuCau"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ngay_YeuCau"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ngay_DenHan"].ToString().ToLower() != dt.Rows[i - 1]["Ngay_DenHan"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ngay_DenHan"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["ThoiGian_DuKien"].ToString().ToLower() != dt.Rows[i - 1]["ThoiGian_DuKien"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["ThoiGian_DuKien"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ngay_BatDau"].ToString().ToLower() != dt.Rows[i - 1]["Ngay_BatDau"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ngay_BatDau"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ngay_HoanThanh"].ToString().ToLower() != dt.Rows[i - 1]["Ngay_HoanThanh"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ngay_HoanThanh"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["PhanTramHoanThanh"].ToString().ToLower() != dt.Rows[i - 1]["PhanTramHoanThanh"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["PhanTramHoanThanh"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["TenNguoiLap"].ToString().ToLower() != dt.Rows[i - 1]["TenNguoiLap"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["TenNguoiLap"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ngay_Lap"].ToString().ToLower() != dt.Rows[i - 1]["Ngay_Lap"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ngay_Lap"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["TenNguoiSuaCuoi"].ToString().ToLower() != dt.Rows[i - 1]["TenNguoiSuaCuoi"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["TenNguoiSuaCuoi"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ngay_SuaCuoi"].ToString().ToLower() != dt.Rows[i - 1]["Ngay_SuaCuoi"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ngay_SuaCuoi"].Index, csThayDoi);
                    }
                    if (dt.Rows[i]["Ten_CongViecGoc"].ToString().ToLower() != dt.Rows[i - 1]["Ten_CongViecGoc"].ToString().ToLower())
                    {
                        fg.SetCellStyle(i + 1, fg.Cols["Ten_CongViecGoc"].Index, csThayDoi);
                    }
                }
            }


            fg.Row = -1;
            fg.AutoSizeRows();
            fg.EndUpdate();
            fg.Tag = 1;
        }