public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg wait = new FWWaitingMsg(); if (dtRecipient == null) dtRecipient = HelpDB.getDatabase().LoadDataSet("SELECT ID,NAME FROM DM_NHAN_VIEN").Tables[0]; DataSet ds; QueryBuilder filter = new QueryBuilder(UpdateRow()); StringBuilder cond = new StringBuilder(""); if (NhanVien._getSelectedID() != -1) cond.Append(string.Format("NGUOI_GUI = {0}", NhanVien._getSelectedID())); long[] arrNguoiNhan = cmbNguoiNhan._SelectedIDs; if (arrNguoiNhan.Length > 0 && cond.Length > 0) cond.Append(" OR "); int temp = arrNguoiNhan.Length; foreach (long id in arrNguoiNhan) { cond.Append(string.Format(@"(NGUOI_NHAN LIKE '{0}%') OR (NGUOI_NHAN LIKE '%,{0},%') OR (NGUOI_NHAN LIKE '%,{0}')", id)); temp--; if (temp > 0) { cond.Append(" OR "); } } if (cond.Length > 0) { filter.addCondition(cond.ToString()); } filter.addID("LOAI_VAN_DE", loaiVanDe._getSelectedID()); filter.addID("TINH_TRANG", Tinh_Trang._getSelectedID()); filter.addDateFromTo("NGAY_GUI", ngayLamViec.FromDate, ngayLamViec.ToDate); ds = HelpDB.getDatabase().LoadDataSet(filter, "BUG"); DataTable Bang_tinh_trang = DAYeuCau.Bang_tinh_trangBug(); ds.Tables.AddRange(new DataTable[] { Bang_tinh_trang.Copy() }); ds.Relations.Add("TEN_TINH_TRANG", ds.Tables["DMC_TINH_TRANG"].Columns["ID"], ds.Tables["BUG"].Columns["TINH_TRANG"]); ds.Tables[0].Columns.Add("TEN_TT", Type.GetType("System.String"), "Parent(TEN_TINH_TRANG).NAME"); foreach (DataRow row in ds.Tables[0].Rows) row["TEN_NGUOI_NHAN"] = GetNameOfRecipient(row["NGUOI_NHAN"].ToString()); gridControlMaster.DataSource = ds.Tables[0]; Web_Mo_Ta.DocumentText = null; wait.Finish(); return null; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg wait = new FWWaitingMsg(); try { QueryBuilder query = new QueryBuilder(UpdateRow()); query.addID("LOAI_DU_AN", LoaiDA._getSelectedID()); query.addID("MUC_UU_TIEN", mucuutien._getSelectedID()); query.addID("TINH_TRANG", tintrang._getSelectedID()); query.addID("NGUOI_QUAN_LY", NhanVien._getSelectedID()); if (mruEditTenDuAn.Text.Trim() != "" && mruEditTenDuAn.Text.Trim() != null) { query.addCondition(string.Format("NAME = '{0}'", mruEditTenDuAn.Text.Trim())); } query.addCondition(string.Format("((NGAY_BAT_DAU BETWEEN '{0}' AND '{1}') OR (NGAY_KET_THUC BETWEEN '{0}' AND '{1}'))", ngayBD.FromDate.ToString("MM/dd/yyyy"), ngayBD.ToDate.ToString("MM/dd/yyyy"))); //Chỉ hiển thị loại dự án có "VISIBLE_BIT" = 'Y' query.addCondition("LOAI_DU_AN IN (SELECT ID FROM DM_LOAI_DU_AN WHERE VISIBLE_BIT = 'Y')"); GridDataSet = HelpDB.getDatabase().LoadDataSet(query,"GridDataSet"); DataTable Bang_uu_tien = DAYeuCau.Bang_uu_tien_new(); DataTable Bang_tinh_trang = DAYeuCau.Bang_tinh_trang_DA_new(); GridDataSet.Tables.AddRange(new DataTable[] { Bang_uu_tien, Bang_tinh_trang }); GridDataSet.Relations.Add("MUC_UU_TIEN", Bang_uu_tien.Columns["ID"], GridDataSet.Tables[0].Columns["MUC_UU_TIEN"]); GridDataSet.Tables[0].Columns.Add("TEN_MUC", Type.GetType("System.String"), "Parent(MUC_UU_TIEN).NAME"); GridDataSet.Relations.Add("TEN_TINH_TRANG", Bang_tinh_trang.Columns["ID"], GridDataSet.Tables[0].Columns["TINH_TRANG"]); GridDataSet.Tables[0].Columns.Add("TEN_TT", Type.GetType("System.String"), "Parent(TEN_TINH_TRANG).NAME"); foreach (DataRow row in GridDataSet.Tables[0].Rows) { decimal tiendo = 0; int phanTram = 0; DataTable v = DADuAn.LoadCongViec(HelpNumber.ParseInt64(row["ID"])); foreach (DataRow r in v.Rows) { tiendo += (HelpNumber.ParseDecimal(r["TIEN_DO"]) * HelpNumber.ParseInt32(r["TONG_PHAN_TRAM_CV"])); phanTram += HelpNumber.ParseInt32(r["TONG_PHAN_TRAM_CV"]); } if (phanTram > 0) { tiendo = HelpNumber.RoundDecimal(tiendo /= phanTram, 2); } ////Hieutn: Lưu lại tiến độ khi thay đổi từ form công việc DADuAn.CapNhatTienDoDuAn(HelpNumber.ParseInt64(row["ID"]), tiendo); row["TIEN_DO_PT"] =DADuAn.LayTienDo(HelpNumber.ParseInt64(row["ID"])); } gridControlMaster.DataSource = GridDataSet.Tables[0]; this.splitContainerControl1.SplitterPosition = 145; wait.Finish(); return null; } catch { return null; } }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = new QueryBuilder(UpdateRow()); filter.addCondition(PhieuTamUngFields.THANG_TAM_UNG + GetStringThangTamUng(dateThangNam,dateThangNamDen)); filter.addID(PhieuTamUngFields.NGUOI_DE_NGHI_ID, NhanVien._getSelectedID()); filter.addDuyet(PhieuTamUngFields.DUYET, DuyetSelect.layTrangThai()); filter.addCondition(" 1=1 "); msg.Finish(); return filter; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); if (dtRecipient == null) dtRecipient = HelpDB.getDatabase().LoadDataSet("SELECT ID,NAME FROM DM_NHAN_VIEN").Tables[0]; QueryBuilder query = new QueryBuilder(UpdateRow()); StringBuilder cond = new StringBuilder(""); if (cmbNguoiYC._getSelectedID() != -1) cond.Append(string.Format("YC.NGUOI_GUI_ID = {0}", cmbNguoiYC._getSelectedID())); long[] arrNguoiNhan = cmbNguoiNhan._SelectedIDs; if (arrNguoiNhan.Length > 0 && cond.Length > 0) cond.Append(" OR "); int temp = arrNguoiNhan.Length; foreach (long id in arrNguoiNhan) { cond.Append(string.Format(@"(YC.NGUOI_NHAN_ID LIKE '{0}%') OR (YC.NGUOI_NHAN_ID LIKE '%,{0},%') OR (YC.NGUOI_NHAN_ID LIKE '%,{0}') OR (YCTL.NGUOI_NHAN_ID LIKE '{0}%') OR (YCTL.NGUOI_NHAN_ID LIKE '%,{0},%') OR (YCTL.NGUOI_NHAN_ID LIKE '%,{0}')", id)); temp--; if (temp > 0) { cond.Append(" OR "); } } if (cond.Length > 0) { query.addCondition(cond.ToString()); } if (mruEditYeuCau.Text.Trim() != "" && mruEditYeuCau.Text.Trim() != null) { query.addCondition(string.Format("CHU_DE = '{0}'", mruEditYeuCau.Text.Trim())); } if (PLMucuutien._getSelectedID() != -1) query.add("MUC_UU_TIEN", Operator.Equal,PLMucuutien._getSelectedID() , DbType.Int32); if (PLTinhtrang._getSelectedID() != -1) query.add("TINH_TRANG", Operator.Equal, PLTinhtrang._getSelectedID(), DbType.Int32); query.addDateFromTo("YC.NGAY_GUI", ngayLamViec.FromDate, ngayLamViec.ToDate); query.setDescOrderBy("YC.NGAY_GUI"); DataSet ds = HelpDB.getDatabase().LoadDataSet(query); foreach (DataRow row in ds.Tables[0].Rows) row["NGUOI_NHAN"] = GetNameOfRecipient(row["NGUOI_NHAN_ID"].ToString()); gridControlMaster.DataSource = ds.Tables[0]; msg.Finish(); return null; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = new QueryBuilder(UpdateRow()); gridControlMaster.DataSource = null; StringBuilder cond = new StringBuilder(""); if (nguoiGui._getSelectedID() != -1) cond.Append(string.Format("NGUOI_GOP_Y = {0}", nguoiGui._getSelectedID())); long[] arrNguoiNhan = NguoiNhan._SelectedIDs; if (arrNguoiNhan.Length > 0 && cond.Length > 0) cond.Append(" OR "); int temp = arrNguoiNhan.Length; foreach (long id in arrNguoiNhan) { cond.Append(string.Format(@"(NGUOI_NHAN_GOP_Y LIKE '{0},%') OR (NGUOI_NHAN_GOP_Y LIKE '%,{0},%') OR (NGUOI_NHAN_GOP_Y LIKE '%,{0}')", id)); ; temp--; if (temp > 0) { cond.Append(" OR "); } } if (cond.Length > 0) { filter.addCondition(cond.ToString()); } filter.addDateFromTo(HomThuGopYFiedls.NGAY, ngayKT.FromDate, ngayKT.ToDate); filter.addCondition(" 1=1 "); DsData = HelpDB.getDatabase().LoadDataSet(filter); if (DsData != null && DsData.Tables[0].Rows.Count > 0) { DsData.Tables[0].Columns.AddRange(new DataColumn[]{ new DataColumn("NOI_DUNG_TEXT",typeof(String)) ,new DataColumn("TEN_NGUOI_NHAN",typeof(String))}); DataSet dsCopy = DsData.Copy(); if (chkNguoiGopY.Checked) { foreach (DataRow row in dsCopy.Tables[0].Rows) { row["NOI_DUNG_TEXT"] = HelpByte.BytesToUTF8String((byte[])row[HomThuGopYFiedls.NOI_DUNG]); if (HelpNumber.ParseInt64(row["NGUOI_GOP_Y"]) != FrameworkParams.currentUser.employee_id) row["NGUOI_GOP_Y"] = string.Compare(row["IS_HIEN"].ToString(), "Y") == 0 ? row["NGUOI_GOP_Y"] : -1; row["TEN_NGUOI_NHAN"] = GetNameOfRecipient(row["NGUOI_NHAN_GOP_Y"].ToString()); } } else { foreach (DataRow row in dsCopy.Tables[0].Rows) { row["NOI_DUNG_TEXT"] = HelpByte.BytesToUTF8String((byte[])row[HomThuGopYFiedls.NOI_DUNG]); row["NGUOI_GOP_Y"] = string.Compare(row["IS_HIEN"].ToString(), "Y") == 0 ? row["NGUOI_GOP_Y"] : -1; row["TEN_NGUOI_NHAN"] = GetNameOfRecipient(row["NGUOI_NHAN_GOP_Y"].ToString()); } } gridControlMaster.DataSource = dsCopy.Tables[0]; } msg.Finish(); return null; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = new QueryBuilder(UpdateRow()); filter.addLike("UPPER(HO_TEN)",Filter_TenUV.Text.Trim().ToUpper()); if (Filter_VongPV.Text != "") filter.add("VONG_PHONG_VAN", Operator.Equal, (int)Filter_VongPV.Value, DbType.Int32); filter.addDateFromTo("NGAY_GIO_PHONG_VAN", ngayLamViec.FromDate, ngayLamViec.ToDate); filter.addHourFrom(Filter_GioPVTu.Time, "NGAY_GIO_PHONG_VAN"); filter.addHourTo(Filter_GioPVDen.Time, "NGAY_GIO_PHONG_VAN"); filter.addID("TTHS_ID", Filter_TinhTrangHoSo._getSelectedID()); filter.setAscOrderBy("HO_TEN"); filter.addCondition(" 1=1 "); msg.Finish(); return filter; }
private static BarButtonItem AddXemTatCa(BarManager barManager, Bar mainBar, BarButtonItem barButtonItemSearch, PopupControlContainer popUP, BarCheckItem filter, GridView gridViewMaster, string filterString, string ascSortClause, string descSortClause, string groupClause ) { int index = 0; for (int i = 0; i < mainBar.LinksPersistInfo.Count; i++) { LinkPersistInfo info = mainBar.LinksPersistInfo[i]; if (info.Item.Name == barButtonItemSearch.Name) { info.BeginGroup = false; index = i; break; } } var viewAll = new BarButtonItem { Caption = "Xem tất c&ả", PaintStyle = BarItemPaintStyle.CaptionGlyph, Glyph = FrameworkParams.imageStore.GetImage2020("Picture.png"), Visibility = BarItemVisibility.Always }; viewAll.Appearance.ForeColor = Color.Red; Font bk = viewAll.Font; viewAll.Appearance.Font = new Font(bk, FontStyle.Bold); viewAll.Appearance.Options.UseFont = true; viewAll.Appearance.Options.UseForeColor = true; mainBar.LinksPersistInfo.Insert(index, new LinkPersistInfo(viewAll, true)); barManager.Items.Add(viewAll); viewAll.ItemClick += delegate { var wait = new FWWaitingMsg(); try { var query = new QueryBuilder(filterString); if (!string.IsNullOrEmpty(groupClause)) { query.addGroupBy(groupClause); } if (ascSortClause != "") query.setAscOrderBy(ascSortClause); if (descSortClause != "") query.setDescOrderBy(descSortClause); var ds = HelpDB.getDBService().LoadDataSet(query); gridViewMaster.ClearSelection(); if (ds != null && ds.Tables.Count > 0) { gridViewMaster.GridControl.DataSource = ds.Tables[0]; if (gridViewMaster.RowCount > 0) { gridViewMaster.FocusedRowHandle = -1; gridViewMaster.SelectRow(0); gridViewMaster.FocusedRowHandle = 0; } else { gridViewMaster.SelectRow(-1); } } else gridViewMaster.GridControl.DataSource = null; filter.Checked = false; //if (frm == null // || !(frm is PhieuQuanLyBandedChange) // || ((PhieuQuanLyBandedChange)frm)._UsingCheckFiler) //{ // popUP.Visible = false; //} ClearDataCtrl(popUP.Controls); } catch (Exception ex) { PLException.AddException(ex); } finally { wait.Finish(); } }; return viewAll; }
/// <summary>Step 5: Xây dựng Query Buider cho việc tìm kiếm /// Xây dựng một QueryBuilder từ những chọn lựa trong phần filter. /// Từ QueryBuilder này ta có thể lấy được dữ liệu thỏa điều kiện. /// Nếu hỗ trợ duyệt thì trong câu truy vấn trả về /// phải có cột là DUYET_BIT /// </summary> public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); if (dtProcessor == null) dtProcessor = HelpDB.getDatabase().LoadDataSet("SELECT ID,NAME FROM DM_NHAN_VIEN").Tables[0]; QueryBuilder query = new QueryBuilder(UpdateRow()); query.addID(TiepNhanInfoFields.NGUON_THONG_TIN, cmbNguonTin._getSelectedID()); if (cmbNguoiXuLy._CountSelectedIDs > 0) { StringBuilder sbSql = new StringBuilder(); foreach (long id in cmbNguoiXuLy._SelectedIDs) { sbSql.Append(string.Format(@" {0} LIKE '{1}%' OR ({0} LIKE '%,{1},%') OR ({0} LIKE '%,{1}') OR (", TiepNhanInfoFields.NGUOI_XU_LY, id)); } sbSql = sbSql.Remove(sbSql.ToString().LastIndexOf("OR"), 4); query.addCondition(sbSql.ToString()); } query.addID(TiepNhanInfoFields.TINH_TRANG,PLTinhtrang._getSelectedID()); query.addDateFromTo(TiepNhanInfoFields.NGAY_CAP_NHAT, ngayLamViec.FromDate, ngayLamViec.ToDate); query.addCondition("1=1"); DataSet ds = HelpDB.getDatabase().LoadDataSet(query); foreach (DataRow row in ds.Tables[0].Rows) row["TEN_NGUOI_XU_LY"] = DATiepNhanInfo.I.GetNameOfProcessor(row["NGUOI_XU_LY"].ToString(), dtProcessor, "\n"); gridControlMaster.DataSource = ds.Tables[0]; msg.Finish(); return null; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder query = new QueryBuilder(UpdateRow()); if (tree != null && tree.SelectedNode != null) { if (tree.SelectedNode["IS_GROUP"].ToString() == "Y") { query.addID("ID_NHOM_DIEN_DAN", treeDienDan._getSelectedID()); } else { query.addID("ID_CHUYEN_MUC", treeDienDan._getSelectedID()); } } query.addID("NGUOI_GUI", NguoiGui._getSelectedID()); query.addDateFromTo("NGAY_GUI", ngayLamViec.FromDate, ngayLamViec.ToDate); msg.Finish(); DataSet ds = new DataSet(); if (tree != null && tree.SelectedNode != null) { if (tree.SelectedNode["IS_GROUP"].ToString() == "Y") { ds = DienDanPermission.I._LoadDataSetWithResPermission(query, "ID_NHOM_DIEN_DAN", treeDienDan._getSelectedID()); } else { ds = DienDanPermission.I._LoadDataSetWithResPermission(query, "ID_CHUYEN_MUC", treeDienDan._getSelectedID()); } } else { ds = DienDanPermission.I._LoadDataSetWithResPermission(query, "ID_CHUYEN_MUC", -1); } if (ds != null && ds.Tables.Count > 0) gridControlMaster.DataSource = ds.Tables[0]; return null; }
private void gridViewCongviec_DoubleClick(object sender, EventArgs e) { PLGridView grid = (PLGridView)sender; if (grid.RowCount <= 0) return; else if (!grid.IsGroupRow(grid.FocusedRowHandle)) { FWWaitingMsg m = new FWWaitingMsg(); Congviec obj = new Congviec(HelpNumber.ParseInt64(grid.GetDataRow(grid.FocusedRowHandle)["PCCV_ID"]), null); m.Finish(); HelpProtocolForm.ShowModalDialog(this, obj); } }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = null; string sql = @"SELECT CTCCV_ID,(SELECT NAME FROM DM_LOAI_CONG_VIECN LCV WHERE LCV.ID=CTCV.LCV_ID) TEN_CV, NV.NAME NHANVIEN,CTCV.NGAY_LAM_VIEC,CTCV.NGAY_CAP_NHAT ,CTCV.LCV_ID,CTCV.NV_ID,CTCV.MO_TA,CAST(CTCV.THOI_GIAN_THUC_HIEN AS TIME) THOI_GIAN_THUC_HIEN FROM CHI_TIET_CONG_VIEC CTCV INNER JOIN DM_NHAN_VIEN NV ON NV.ID=CTCV.NV_ID WHERE NV.VISIBLE_BIT='Y' AND 1=1"; filter = new QueryBuilder(sql); filter.addID("LCV_ID", Loai_Cv._getSelectedID()); filter.addID("NV_ID", NhanVien._getSelectedID()); filter.addDateFromTo("NGAY_LAM_VIEC", ngayLamViec.FromDate, ngayLamViec.ToDate); filter.addGroupBy("CTCCV_ID,LCV_ID,NV.NAME,NGAY_LAM_VIEC,NGAY_CAP_NHAT,NV_ID,MO_TA,THOI_GIAN_THUC_HIEN"); filter.setDescOrderBy("NGAY_LAM_VIEC"); //DataSet ds = DABase.getDatabase().LoadDataSet(filter); //gridControlMaster.DataSource = ds.Tables[0]; msg.Finish(); return filter; }
public override QueryBuilder PLBuildQueryFilter() { Application.DoEvents(); FWWaitingMsg msg = new FWWaitingMsg(); try { QueryBuilder query = new QueryBuilder(UpdateRow()); string[] ids = GetChildOfFocusedNode(treeListNhomKH.FocusedNode).TrimEnd(' ').Split(' '); StringBuilder strIds = new StringBuilder(); foreach (string id in ids) strIds.Append(string.Format("NKH_ID LIKE '%,{0},%' OR ", id)); query.addCondition(strIds.ToString().TrimEnd(' ', 'R', 'O')); DataSet ds = HelpDB.getDatabase().LoadDataSet(query, "KHACH_HANG"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { gridViewMaster.FocusedRowHandle = 0; gridControlMaster.DataSource = ds.Tables[0]; } else { gridViewMaster.FocusedRowHandle = 0; gridControlMaster.DataSource = null; } DataRow row = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle); if (barSubItem1.ItemLinks.Count > 0 && barItemThemCV == null) { barItemThemCV = barSubItem1.ItemLinks[0].Item as BarButtonItem; barItemThemDA = barSubItem1.ItemLinks[1].Item as BarButtonItem; barItemThemTL = barSubItem1.ItemLinks[2].Item as BarButtonItem; barItemThemNK = barSubItem1.ItemLinks[3].Item as BarButtonItem; } if (row != null) { InitData(HelpNumber.ParseInt64(row["KH_ID"])); splitContainerControl1.PanelVisibility = SplitPanelVisibility.Both; barButtonItemXem.Enabled = barButtonItemUpdate.Enabled = barButtonItemDelete.Enabled = true; if (barSubItem1.ItemLinks.Count > 0) barItemThemCV.Enabled = barItemThemDA.Enabled = barItemThemNK.Enabled = barItemThemTL.Enabled = true; LoadDataForSelectedTab(false); } else { gridControlCongviec.DataSource = gridControlTaiLieu.DataSource = null; splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1; gridControlMaster.DataSource = gridControlNhatKy.DataSource = null; barButtonItemXem.Enabled = barButtonItemUpdate.Enabled = barButtonItemDelete.Enabled = false; if (barSubItem1.ItemLinks.Count > 0) barItemThemCV.Enabled = barItemThemDA.Enabled = barItemThemNK.Enabled = barItemThemTL.Enabled = false; } } catch { gridControlMaster.DataSource = gridControlCongviec.DataSource = gridControlTaiLieu.DataSource = null; barButtonItemXem.Enabled = barButtonItemUpdate.Enabled = barButtonItemDelete.Enabled = false; } finally { if (msg != null) msg.Finish(); } return null; }
private void gridViewThongTinLienHe_DoubleClick(object sender, EventArgs e) { GuiMail mail = new GuiMail(); DataRow drow = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle); PLGridView grid = (PLGridView)sender; if (grid.RowCount <= 0) return; else if (!grid.IsGroupRow(grid.FocusedRowHandle)) { FWWaitingMsg m = new FWWaitingMsg(); string str = drow["NGUOI_THUC_HIEN"].ToString(); Congviec obj = new Congviec(HelpNumber.ParseInt64(grid.GetDataRow(grid.FocusedRowHandle)["PCCV_ID"]), null, mail.GetLongNguoiThucHien(str)); m.Finish(); HelpProtocolForm.ShowModalDialog(this, obj); gridControlThongTinLienHe.DataSource = DADuAn.LoadCongViec(HelpNumber.ParseInt64(drow["ID"])); } }
private void gridControlTaiLieu_Click(object sender, EventArgs e) { DataRow r = layoutView1.GetDataRow(layoutView1.FocusedRowHandle); if (r != null) { LayoutViewHitInfo gHitInfo = layoutView1.CalcHitInfo(layoutView1.GridControl.PointToClient(Control.MousePosition)); if (gHitInfo.Column == null) return; if (gHitInfo.Column.FieldName == "TEN_FILE")//Nếu cell được click thuộc _columnField { FWWaitingMsg m = new FWWaitingMsg(); frmSaveOpen frm = new frmSaveOpen(DALuuTruTapTin.Instance.Load(HelpNumber.ParseInt64(layoutView1.GetDataRow(layoutView1.FocusedRowHandle)["ID"])).NOI_DUNG, layoutView1.GetDataRow(layoutView1.FocusedRowHandle)["TEN_FILE"].ToString()); m.Finish(); HelpProtocolForm.ShowModalDialog(this, frm); } } }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); DataSet ds = new DataSet(); long nhom_tin = PLNhomTT._getSelectedID(); Feature fQuanTri = Permission.loadFeature(AppPermission.FQuanTriTinTuc.id , AppPermission.FQuanTriTinTuc.featureName, FrameworkParams.currentUser.username); if (!checkTin_noi_bat.Checked) { //Lấy tin nổi bật đã được duyệt. QueryBuilder query = new QueryBuilder ( @" SELECT ID,PRIOR,NHOM_TIN,TIEU_DE, NGAY_CAP_NHAT,NGUOI_CAP_NHAT,DUYET, CASE WHEN SO_NGAY_HIEU_LUC > 0 THEN DATEADD(DAY,SO_NGAY_HIEU_LUC,NGAY_CAP_NHAT) ELSE NULL END AS NGAY_HIEU_LUC, CASE WHEN PRIOR='Y' THEN 'Tin tức nổi bật' ELSE NULL END TIN_NOI_BAT FROM TIN_TUC WHERE PRIOR = 'Y' AND DUYET = '2' AND 1=1" ); query.addDateFromTo("NGAY_CAP_NHAT", ngay.FromDate, ngay.ToDate); if (fQuanTri.isRead)//(DATinTuc.Instance.getNguoiDuyet(DATinTuc.quyenDuyet).Contains(FrameworkParams.currentUser.employee_id)) query.addDuyet(PLConst.FIELD_DUYET, DuyetSelect.layTrangThai()); else query.addCondition(string.Format("1=1 or NGUOI_CAP_NHAT = {0}", FrameworkParams.currentUser.employee_id)); query.addCondition("NHOM_TIN IN (SELECT ID FROM DM_NHOM_TIN_TUC WHERE VISIBLE_BIT ='Y')"); ds = TinTucPermission.I._LoadDataSetWithResGroupPermission(query, "NHOM_TIN", nhom_tin); //Lấy tin mới nhất đã được duyệt. QueryBuilder query1 = new QueryBuilder ( @" SELECT ID,PRIOR,NHOM_TIN,TIEU_DE, NGAY_CAP_NHAT,NGUOI_CAP_NHAT,DUYET,CASE WHEN SO_NGAY_HIEU_LUC > 0 THEN DATEADD(DAY,SO_NGAY_HIEU_LUC,NGAY_CAP_NHAT) ELSE NULL END AS NGAY_HIEU_LUC, CASE WHEN PRIOR='Y' THEN 'Tin tức nổi bật' ELSE NULL END TIN_NOI_BAT FROM TIN_TUC WHERE PRIOR = 'N' AND DUYET = '2' AND NGAY_CAP_NHAT = (SELECT MAX(NGAY_CAP_NHAT) FROM TIN_TUC WHERE PRIOR = 'N' AND DUYET = '2') AND 1=1" ); query1.addDateFromTo("NGAY_CAP_NHAT", ngay.FromDate, ngay.ToDate); query1.addCondition("NHOM_TIN IN (SELECT ID FROM DM_NHOM_TIN_TUC WHERE VISIBLE_BIT ='Y')"); if (fQuanTri.isRead)//(DATinTuc.Instance.getNguoiDuyet(DATinTuc.quyenDuyet).Contains(FrameworkParams.currentUser.employee_id)) query1.addDuyet(PLConst.FIELD_DUYET, DuyetSelect.layTrangThai()); else query1.addCondition(string.Format("1=1 or NGUOI_CAP_NHAT = {0}", FrameworkParams.currentUser.employee_id)); DataTable dtTT_Max = TinTucPermission.I._LoadDataSetWithResGroupPermission(query1, "NHOM_TIN", nhom_tin).Tables[0]; //Lấy các tin còn lại QueryBuilder query2 = new QueryBuilder ( @" SELECT ID,PRIOR,NHOM_TIN,TIEU_DE, NGAY_CAP_NHAT,NGUOI_CAP_NHAT,DUYET,CASE WHEN SO_NGAY_HIEU_LUC > 0 THEN DATEADD(DAY,SO_NGAY_HIEU_LUC,NGAY_CAP_NHAT) ELSE NULL END AS NGAY_HIEU_LUC, CASE WHEN PRIOR='Y' THEN 'Tin tức nổi bật' ELSE NULL END TIN_NOI_BAT FROM TIN_TUC WHERE NGAY_CAP_NHAT <> (SELECT MAX(NGAY_CAP_NHAT) FROM TIN_TUC WHERE PRIOR = 'N' AND DUYET = '2') AND 1=1" ); query2.addDateFromTo("NGAY_CAP_NHAT", ngay.FromDate, ngay.ToDate); query2.addCondition("NHOM_TIN IN (SELECT ID FROM DM_NHOM_TIN_TUC WHERE VISIBLE_BIT ='Y')"); query2.setDescOrderBy("NGAY_CAP_NHAT"); if (ds.Tables[0].Rows.Count > 0) query2.addCondition(string.Format("ID != '{0}'", ds.Tables[0].Rows[0]["ID"].ToString())); if (fQuanTri.isRead)//(DATinTuc.Instance.getNguoiDuyet(DATinTuc.quyenDuyet).Contains(FrameworkParams.currentUser.employee_id)) query2.addDuyet(PLConst.FIELD_DUYET, DuyetSelect.layTrangThai()); else query2.addCondition(string.Format("{0}='2' or NGUOI_CAP_NHAT = {1}", PLConst.FIELD_DUYET, FrameworkParams.currentUser.employee_id)); DataTable dtTT = TinTucPermission.I._LoadDataSetWithResGroupPermission(query2, "NHOM_TIN", nhom_tin).Tables[0]; foreach (DataRow row in dtTT_Max.Rows) ds.Tables[0].ImportRow(row); foreach (DataRow row in dtTT.Rows) ds.Tables[0].ImportRow(row); gridControlMaster.DataSource = ds.Tables[0]; barSubItem1.Enabled = ds.Tables[0].Rows.Count > 0; HookFocusRow(); } else { ds = DATinTuc.Instance.Get_5_tin(PLNhomTT._getSelectedID(), ngay.FromDate, ngay.ToDate, DuyetSelect); barSubItem1.Enabled = ds.Tables[0].Rows.Count > 0; gridControlMaster.DataSource = ds.Tables[0]; barSubItem1.Enabled = ds.Tables[0].Rows.Count > 0; HookFocusRow(); } if (ds.Tables[0].Rows.Count == 0) { this.ThongTinNoiBat(null); barButtonItemDuyet.Enabled = false; barButtonItemK_Duyet.Enabled = false; } msg.Finish(); return null; }
private void gridViewCongviec_DoubleClick(object sender, EventArgs e) { PLGridView grid = (PLGridView)sender; if (grid.RowCount <= 0) return; else if (!grid.IsGroupRow(grid.FocusedRowHandle)) { if (_IsAdd == null) { FWWaitingMsg m = new FWWaitingMsg(); Congviec obj = new Congviec(HelpNumber.ParseInt64(grid.GetDataRow(grid.FocusedRowHandle)["PCCV_ID"]), null); m.Finish(); HelpProtocolForm.ShowModalDialog(this, obj); } ////HIEUNT:mới thêm sửa công việc từ khách hàng else if (_IsAdd == false) { if (HelpNumber.ParseInt64(grid.GetDataRow(grid.FocusedRowHandle)["TINH_TRANG_ID"]) != 4) { FWWaitingMsg m = new FWWaitingMsg(); Congviec obj = new Congviec(HelpNumber.ParseInt64(grid.GetDataRow(grid.FocusedRowHandle)["PCCV_ID"]), false); m.Finish(); HelpProtocolForm.ShowModalDialog(this, obj); LoadGridViewCongViec(); } else { HelpMsgBox.ShowNotificationMessage("Công việc đã hoàn tất không được sửa!"); } } } }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg wait = new FWWaitingMsg(); QueryBuilder query = new QueryBuilder(UpdateRow()); try { StringBuilder cond = new StringBuilder(""); if (cboNguoi_gui._getSelectedID() != -1) cond.Append(string.Format("NGUOI_GUI_ID = {0}", cboNguoi_gui._getSelectedID())); long[] arrNguoiNhan = cboNguoi_nhan._SelectedIDs; if (arrNguoiNhan.Length > 0 && cond.Length > 0) cond.Append(" OR "); int temp = arrNguoiNhan.Length; foreach (long id in arrNguoiNhan) { cond.Append(string.Format(@"(NGUOI_NHAN_ID LIKE '{0}%') OR (NGUOI_NHAN_ID LIKE '%,{0},%') OR (NGUOI_NHAN_ID LIKE '%,{0}')", id)); temp--; if (temp > 0) { cond.Append(" OR "); } } if (cond.Length > 0) { query.addCondition(cond.ToString()); } query.addDateFromTo("THOI_GIAN_CAP_NHAT", ngayKT.FromDate, ngayKT.ToDate); query.addID("MUC_DO_UU_TIEN_ID", cboMuc_uu_tien._getSelectedID()); query.addID("TINH_TRANG_IN_ID", PLImgTinhTrang._getSelectedID()); query.addCondition(" 1=1 "); DataSet Master_ds = HelpDB.getDatabase().LoadDataSet(query); gridControlMaster.DataSource = Master_ds.Tables[0]; if (splitContainerControl1.SplitterPosition == 308) splitContainerControl1.SplitterPosition = 257; } catch (Exception ex) { PLException.AddException(ex); } wait.Finish(); return null; }
private void gridViewTaiLieu_Click(object sender, EventArgs e) { GridHitInfo gHitInfo = gridViewTaiLieu.CalcHitInfo(gridViewTaiLieu.GridControl.PointToClient(Control.MousePosition)); if (gHitInfo.InRowCell)//Nếu vị trí click là cell trong row { if (gHitInfo.Column.FieldName == "TEN_FILE")//Nếu cell được click thuộc _columnField { FWWaitingMsg m = new FWWaitingMsg(); frmSaveOpen frm = new frmSaveOpen(DALuuTruTapTin.Instance.Load(HelpNumber.ParseInt64(gridViewTaiLieu.GetDataRow(gridViewTaiLieu.FocusedRowHandle)["TAP_TIN_ID"])).NOI_DUNG, gridViewTaiLieu.GetDataRow(gridViewTaiLieu.FocusedRowHandle)["TEN_FILE"].ToString()); m.Finish(); HelpProtocolForm.ShowModalDialog(this, frm); } } }
private void NodeChanged(FocusedNodeChangedEventArgs nodeChanged) { FWWaitingMsg msg = new FWWaitingMsg(); loaiTaiLieu = HelpNumber.ParseInt64(nodeChanged.Node["ID"]); dt = DADocument.getDM_TAI_LIEU(loaiTaiLieu); gridDSCongviec.DataSource = dt; xem.Enabled = (gridDSCongviec.DataSource as DataTable).Rows.Count > 0; DataRow r = gridViewDSCongviec.GetDataRow(gridViewDSCongviec.FocusedRowHandle); if (r != null) { Load_gridview(HelpNumber.ParseInt64(r["ID"])); } else gridControlTaiLieu.DataSource = null; ButtonState(r); if (msg != null) msg.Finish(); msg.Finish(); }
private void gridViewTaiLieu_DoubleClick(object sender, EventArgs e) { PLGridView grid = (PLGridView)sender; if (grid.RowCount <= 0) return; else if (!grid.IsGroupRow(grid.FocusedRowHandle)) { FWWaitingMsg m = new FWWaitingMsg(); frmThemTaiLieu frm = new frmThemTaiLieu(HelpNumber.ParseInt64(grid.GetDataRow(grid.FocusedRowHandle)["TAP_TIN_ID"]), (_IsAdd == null ? _IsAdd : false), _KhachHang.KH_ID, (long)LoaiTapTin.KhachHangTaptin); m.Finish(); HelpProtocolForm.ShowModalDialog(this, frm); } }
private void btnLuu_Click(object sender, EventArgs e) { if (GetData()) { FWWaitingMsg m = new FWWaitingMsg(); try { if (UpdateTapTinIn != null) { this.UpdateTapTinIn(_IsAdd, do_InAn); this.Tag = "Q"; HelpXtraForm.CloseFormNoConfirm(this); } else { //HelpMsgBox.ShowNotificationMessage("Lưu không thành công."); } } catch (Exception ex) { PLException.AddException(ex); ErrorMsg.ErrorSave(this); } finally { m.Finish(); } } }
private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DataRow row = layoutView1.GetDataRow(layoutView1.FocusedRowHandle); DOLuuTruTapTin do_tt = DALuuTruTapTin.Instance.Load(HelpNumber.ParseInt64(row["ID"])); try { FWWaitingMsg m = new FWWaitingMsg(); frmSaveOpen frm = new frmSaveOpen(do_tt.NOI_DUNG, do_tt.TEN_FILE); m.Finish(); HelpProtocolForm.ShowModalDialog(this, frm); } catch (Exception ex) { PLException.AddException(ex); HelpSysLog.AddException(ex, ""); } }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg wait = new FWWaitingMsg(); //Viết theo cách này không áp dụng tìm kiếm nâng cao được QueryBuilder query = new QueryBuilder(UpdateRow()); query.addID("PC.LCV_ID", LoaiCV._getSelectedID()); if (mruEditTenCongViec.Text.Trim() != "" && mruEditTenCongViec.Text.Trim() != null) { query.addCondition(string.Format("PC.CONG_VIEC = '{0}'", mruEditTenCongViec.Text.Trim())); } StringBuilder cond = new StringBuilder(""); if (NhanVien._getSelectedID() != -1) cond.Append(string.Format("NGUOI_GIAO = {0}", NhanVien._getSelectedID())); long [] NTH_ID=NguoiThucHien._SelectedIDs; if (NTH_ID.Length > 0 && cond.Length > 0) cond.Append(" OR "); int temp = NTH_ID.Length; foreach (long id in NTH_ID) { cond.Append("CT.MA_NV = " + id + ""); temp--; if (temp > 0) { cond.Append(" OR "); } } if (cond.Length > 0) { query.addCondition(cond.ToString()); } query.addID("TINH_TRANG", Tinhtrang._getSelectedID()); query.addID("MUC_UU_TIEN", cmbDoUuTien._getSelectedID()); query.setDescOrderBy("PC.NGAY_BAT_DAU"); query.addDateFromTo("PC.NGAY_BAT_DAU", ngayLamViec.FromDate, ngayLamViec.ToDate); GridDataSet = HelpDB.getDatabase().LoadDataSet(query); GridDataSet.Tables[0].Columns.Add("NV_THAM_GIA"); //DataSet dùng cho việc tính tiến độ công việc string sql = @"SELECT C.PCCV_ID,PHAN_TRAM_THAM_GIA,MAX(TIEN_DO) TIEN_DO,T.TONG_PHAN_TRAM FROM CHI_TIET_PHAN_CONG C, (SELECT PCCV_ID,SUM(PHAN_TRAM_THAM_GIA) TONG_PHAN_TRAM FROM CHI_TIET_PHAN_CONG WHERE TIEN_DO = 0 GROUP BY PCCV_ID) T WHERE TIEN_DO > 0 AND T.PCCV_ID = C.PCCV_ID AND C.THOI_GIAN_CAP_NHAT IN (SELECT MAX(CT.THOI_GIAN_CAP_NHAT) FROM CHI_TIET_PHAN_CONG CT WHERE CT.PCCV_ID=T.PCCV_ID GROUP BY CT.MA_NV) GROUP BY C.PCCV_ID,C.MA_NV,PHAN_TRAM_THAM_GIA,T.TONG_PHAN_TRAM"; DataSet ds = HelpDB.getDatabase().LoadDataSet(sql); foreach (DataRow dr in GridDataSet.Tables[0].Rows) { String ten = ""; String sqlString = "SELECT CT.MA_NV, NV.NAME, CT.PHAN_TRAM_THAM_GIA FROM CHI_TIET_PHAN_CONG CT, DM_NHAN_VIEN NV WHERE CT.MA_NV = NV.ID AND CT.PCCV_ID = " + dr["PCCV_ID"].ToString() + " GROUP BY MA_NV,NAME, PHAN_TRAM_THAM_GIA"; DataTable dt = HelpDB.getDatabase().LoadDataSet(sqlString).Tables[0]; foreach (DataRow row in dt.Rows) { if (ten == "") ten = ten + row["NAME"].ToString() + " (" + row["PHAN_TRAM_THAM_GIA"].ToString() + "%)"; else ten = ten + "\n" + row["NAME"].ToString() + " (" + row["PHAN_TRAM_THAM_GIA"].ToString() + "%)"; } dr["NV_THAM_GIA"] = ten; //Tính giá trị cho cột tính độ dựa vào DataSet (ds) ở trên long tam=HelpNumber.ParseInt64(dr["PCCV_ID"]); DataRow[] arrRow = ds.Tables[0].Select(string.Format("PCCV_ID = {0}", HelpNumber.ParseInt64(dr["PCCV_ID"]))); decimal tongTienDo = 0; foreach (DataRow row in arrRow) tongTienDo += (HelpNumber.ParseInt64(row["TIEN_DO"]) * HelpNumber.ParseInt64(row["PHAN_TRAM_THAM_GIA"])); if (arrRow.Length > 0) HelpNumber.RoundDecimal(tongTienDo /= HelpNumber.ParseInt64(arrRow[0]["TONG_PHAN_TRAM"]),2); dr["TONG_TIEN_DO"] = tongTienDo.ToString() + "%"; } try { if (GridDataSet != null && GridDataSet.Tables[0].Rows.Count > 0) { gridControlMaster.DataSource = GridDataSet.Tables[0]; splitContainerControl1.SplitterPosition = 171; } else { gridControlMaster.DataSource = null; } } catch {} wait.Finish(); return null; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = new QueryBuilder(UpdateRow()); filter.addID("NLV.NV_ID", NhanVien._getSelectedID()); if (this.getISChamCong().Length == 3) filter.addCondition("(IS_CHAM_CONG in ('Y','N','') or IS_CHAM_CONG is null )"); else filter.addIn("IS_CHAM_CONG", this.getISChamCong()); if (chkBinhThuong.Checked == true && chkDi_tre.Checked == true && chkVe_som.Checked == true) goto Nhan; StringBuilder s_condition = new StringBuilder(""); if (chkDi_tre.Checked) s_condition.Append("GIO_BAT_DAU>='" + AppGetSysParam.GetGIO_BAT_DAU_SANG.ToString() + "'"); if (chkVe_som.Checked && chkDi_tre.Checked) s_condition.Append(" OR GIO_KET_THUC<CASE WHEN EXTRACT(WEEKDAY FROM NLV.NGAY_LAM_VIEC)=6 THEN '" + AppGetSysParam.GetGIO_KET_THUC_SANG.ToString() + "' ELSE '" + ((DateTime)frmAppParamsHelp.GetThamSo("GIO_KET_THUC_CHIEU")).TimeOfDay.ToString() + "' END"); else if (chkVe_som.Checked) s_condition.Append("GIO_KET_THUC<CASE WHEN EXTRACT(WEEKDAY FROM NLV.NGAY_LAM_VIEC)=6 THEN '" + AppGetSysParam.GetGIO_KET_THUC_SANG.ToString() + "' ELSE '" + ((DateTime)frmAppParamsHelp.GetThamSo("GIO_KET_THUC_CHIEU")).TimeOfDay.ToString() + "' END"); if (s_condition.Length > 0) { if (chkBinhThuong.Checked) s_condition.Append(" OR (GIO_BAT_DAU<'" + AppGetSysParam.GetGIO_BAT_DAU_SANG.ToString() + "' AND GIO_KET_THUC >=CASE WHEN EXTRACT(WEEKDAY FROM NLV.NGAY_LAM_VIEC)=6 THEN '" + AppGetSysParam.GetGIO_KET_THUC_SANG.ToString() + "' ELSE '" + ((DateTime)frmAppParamsHelp.GetThamSo("GIO_KET_THUC_CHIEU")).TimeOfDay.ToString() + "'END)"); } else { if (chkBinhThuong.Checked) s_condition.Append("(GIO_BAT_DAU<'" + AppGetSysParam.GetGIO_BAT_DAU_SANG.ToString() + "' AND GIO_KET_THUC >=CASE WHEN EXTRACT(WEEKDAY FROM NLV.NGAY_LAM_VIEC)=6 THEN '" + AppGetSysParam.GetGIO_KET_THUC_SANG.ToString() + "' ELSE '" + ((DateTime)frmAppParamsHelp.GetThamSo("GIO_KET_THUC_CHIEU")).TimeOfDay.ToString() + "' END)"); } filter.addCondition(s_condition.ToString()); //if (this.chkDi_tre.Checked || chkVe_som.Checked) //filter.addID("LOAI", 1); Nhan: if (ngayLamViec.Types != SelectionTypes.None) filter.addDateFromTo("NLV.NGAY_LAM_VIEC", ngayLamViec.FromDate, ngayLamViec.ToDate); filter.setDescOrderBy("NLV.NGAY_LAM_VIEC"); filter.setAscOrderBy("NAME"); msg.Finish(); return filter; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = new QueryBuilder(UpdateRow()); filter.addID("NV_ID", NhanVien._getSelectedID()); filter.addDateFromTo("NGAY_LAM_VIEC", ngayLamViec.FromDate, ngayLamViec.ToDate); filter.addDuyet(PLConst.FIELD_DUYET, DuyetSelect.layTrangThai()); filter.addIn("LOAI_XAC_NHAN", this.getLoaiXacNhan()); msg.Finish(); return filter; }
public override QueryBuilder PLBuildQueryFilter() { FWWaitingMsg msg = new FWWaitingMsg(); QueryBuilder filter = new QueryBuilder(UpdateRow()); filter.addID("NLV.NV_ID", NhanVien._getSelectedID()); filter.addCondition("NLV.LOAI=" + (Int32)TimeInOutType.NghiPhep); if (ngayLamViec.Types != SelectionTypes.None) filter.addDateFromTo("NLV.NGAY_LAM_VIEC", ngayLamViec.FromDate, ngayLamViec.ToDate); filter.setDescOrderBy("NLV.NGAY_LAM_VIEC"); filter.setAscOrderBy("NAME"); filter.addDuyet(PLConst.FIELD_DUYET, DuyetSelect.layTrangThai()); StringBuilder str = new StringBuilder(); if (chkNghi_KLuong.Checked && checkNghi_Nam.Checked) filter.addCondition("NGHI_KHONG_LUONG = 'Y' OR NGHI_PHEP_NAM ='Y'"); else { if (chkNghi_KLuong.Checked) filter.addBoolean("NGHI_KHONG_LUONG", true); if (checkNghi_Nam.Checked) filter.addBoolean("NGHI_PHEP_NAM", true); } DataSet ds = HelpDB.getDatabase().LoadDataSet(filter); //ds.Tables[0].Columns.Add("IS_NGHI_BUOI_SANG",typeof(Int32)); if (ds == null || ds.Tables[0].Rows.Count == 0) barButtonItemDuyet.Enabled = barButtonItemK_Duyet.Enabled = false; else { barButtonItemDuyet.Enabled = barButtonItemK_Duyet.Enabled = true; } msg.Finish(); return filter; }