当前位置: 首页>>代码示例>>C#>>正文


C# QueryBuilder.addDateFromTo方法代码示例

本文整理汇总了C#中QueryBuilder.addDateFromTo方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.addDateFromTo方法的具体用法?C# QueryBuilder.addDateFromTo怎么用?C# QueryBuilder.addDateFromTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder.addDateFromTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnView_Click

        private void btnView_Click(object sender, EventArgs e)
        {
            if(KenhPhat._getSelectedID()<=1)
            {
                HelpMsgBox.ShowNotificationMessage("Vui lòng chọn kênh phát");
                return;
            }

            var sql =
                string.Format(
                    @"select ct.time_start,ct.time_end,ct.kenh_phat,iif(c.ct_id is null, tct.noi_dung, c.noi_dung) noi_dung,
            c.nuoc_san_xuat, ct.rate_group,datediff(minute,ct.time_start,ct.time_end) timesplit
            from tns_programs_grid_scr_ct ct
            left join tns_chuong_trinh tct on tct.tct_id=ct.chuong_trinh
            left join chuong_trinh c on c.ct_id=tct.ct_id
            where 1=1");
            var query = new QueryBuilder(sql);

            AppCtrl.addID(query, "ct.PGS_id", FileNguon);
            query.addID("CT.KENH_PHAT", KenhPhat._getSelectedID());
            var dt = NgayPhatSong.DateTime;
            query.addDateFromTo("CT.NGAY_PHAT", new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0),
                                new DateTime(dt.Year, dt.Month, dt.Day, 23, 59, 59));

            query.setAscOrderBy("ct.time_start, ct.kenh_phat");

            var ds = HelpDB.getDBService().LoadDataSet(query, KE_HOACH_LPS_CT.TABLE_NAME);
            gridControlDetail.DataSource = ds.Tables[0];
            gridBand1.Caption = dt.ToString("ddd " + FrameworkParams.option.dateFormat);
        }
开发者ID:khanhdtn,项目名称:did-vlib-2011,代码行数:30,代码来源:frmTNSGridTracking.cs

示例2: btnView_Click

        private void btnView_Click(object sender, EventArgs e)
        {
            var sql =
                string.Format(
                    @"select right(  '00'||extract(hour from ct.time_start),2) ||':00 '|| ' - ' ||right('00'||(extract(hour from ct.time_start)  +1),2)    ||':00' VET,
            kp.name kenh_phat,avg(ct.rate_group)
            from tns_programs_grid_scr_ct ct
            left join tns_kenh_phat kp on ct.kenh_phat=kp.id
            where 1=1");
            var query = new QueryBuilder(sql);

            AppCtrl.addID(query, "ct.PGS_id", FileNguon);
            AppCtrl.addID(query, "CT.KENH_PHAT", KenhPhat);
            query.addDateFromTo("CT.NGAY_PHAT", TuNgay.DateTime, DenNgay.DateTime);

            query.addGroupBy(@"right(  '00'||extract(hour from ct.time_start),2) ||':00 '|| ' - ' ||right('00'||(extract(hour from ct.time_start)  +1),2)    ||':00',
            kp.name");
            query.setAscOrderBy("ct.time_start, ct.kenh_phat");

            var ds = HelpDB.getDBService().LoadDataSet(query, KE_HOACH_LPS_CT.TABLE_NAME);
            if (ds != null && ds.Tables.Count > 0)
            {
                var dt = ds.Tables[0];
                var dtS = dt.DefaultView.ToTable(true, "VET");

            }

            gridControlDetail.DataSource = ds.Tables[0];
        }
开发者ID:khanhdtn,项目名称:did-vlib-2011,代码行数:29,代码来源:frmTNSDailyRatingTracking.cs

示例3: GetSumDaysWorked

        /// <summary>CHAUTV : Tính tổng số giờ nhân viên làm được trong khoảng thời gian xác định
        /// </summary>
        public static double GetSumDaysWorked(DateTime from, DateTime to, long employKey)
        {
            QueryBuilder query = new QueryBuilder(@"SELECT distinct NV_ID,NGAY,SANG,CHIEU
                                                    FROM BANG_CHAM_CONG_AUTO
                                                    WHERE 1=1");
            query.addID("NV_ID", employKey);
            query.addDateFromTo("NGAY", from, to);
            DataSet ds = HelpDB.getDatabase().LoadDataSet(query, "BANG_CHAM_CONG_AUTO");

            double cntV = 0;
            double sumTime = 0;
            double cntN = 0;
            //Duyệt đếm thời gian, vắng, nghỉ
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (ds.Tables[0].Rows[i]["SANG"].ToString() == "V")
                    cntV++;
                if (ds.Tables[0].Rows[i]["CHIEU"].ToString() == "V")
                    cntV++;
                if (ds.Tables[0].Rows[i]["SANG"].ToString() == "N")
                    cntN++;
                if (ds.Tables[0].Rows[i]["CHIEU"].ToString() == "N")
                    cntN++;
                if (checkNumber(ds.Tables[0].Rows[i]["SANG"].ToString()))
                    sumTime += double.Parse(ds.Tables[0].Rows[i]["SANG"].ToString());
                if (checkNumber(ds.Tables[0].Rows[i]["CHIEU"].ToString()))
                    sumTime += double.Parse(ds.Tables[0].Rows[i]["CHIEU"].ToString());
            }
            //Làm tròn 4 chữ số
            return Math.Round(sumTime / 8 - cntV / 2, 4);
        }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:33,代码来源:HelpLuongAuto.cs

示例4: DsChamCongNhanVien

 public DataSet DsChamCongNhanVien(string strThangNam,string Table)
 {
     string[] M = strThangNam.Split('/');
     int mm = HelpNumber.ParseInt32(M[0]);
     int yy = HelpNumber.ParseInt32(M[1]);
     QueryBuilder query = new QueryBuilder(@"SELECT NV_ID FROM " + Table + " WHERE 1=1" );
     query.addDateFromTo("NGAY", HelpDate.GetStartOfMonth(mm, yy), HelpDate.GetEndOfMonth(mm, yy));
     query.addGroupBy("NV_ID");
     DataSet ds = HelpDB.getDatabase().LoadDataSet(query, Table);
     return ds;
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:11,代码来源:DABangChamCong.cs

示例5: btnView_Click

 private void btnView_Click(object sender, EventArgs e)
 {
     var sql =string.Format(@"SELECT PGS_ID,NAME,
         TU_NGAY, DEN_NGAY, MA_PGS,IS_DELETE,FILE_NAME, NGUOI_TAO,
         NGAY_TAO, NGUOI_CAP_NHAT, NGAY_CAP_NHAT,CONG_TY,
         PHONG_BAN,GHI_CHU,NULL CONTENT_FILE,'' PATH_FILE
         FROM TNS_PROGRAMS_GRID_SCR pgs
         WHERE (is_delete='N' or is_delete is null) and 1=1");
     var query = new QueryBuilder(sql);
     query.addLike("LOWER(" + TNS_PROGRAMS_GRID_SCR.NAME + ")", TenNguon.Text.ToLower());
     query.addLike("LOWER(" + TNS_PROGRAMS_GRID_SCR.FILE_NAME + ")", TenFile.Text.ToLower());
     AppCtrl.addID(query, TNS_PROGRAMS_GRID_SCR.NGUOI_TAO, NguoiLap);
     AppCtrl.addFilterFromTo(query, TNS_PROGRAMS_GRID_SCR.NGAY_TAO, NgayLap);
     query.addDateFromTo(TNS_PROGRAMS_GRID_SCR.TU_NGAY, StartDateFrom.DateTime, StartDateTo.DateTime);
     query.addDateFromTo(TNS_PROGRAMS_GRID_SCR.DEN_NGAY, EndDateFrom.DateTime, EndDateTo.DateTime);
     query.addCondition("1=1");
     query.setDescOrderBy("NGAY_TAO");
     var ds = HelpDB.getDBService().LoadDataSet(query);
     if(ds!=null&&ds.Tables.Count>0)
     {
         gridControlDetail.DataSource = ds.Tables[0];
     }
 }
开发者ID:khanhdtn,项目名称:did-vlib-2011,代码行数:23,代码来源:frmTNSProgramGrid.cs

示例6: MoChotBangChamCong

 public void MoChotBangChamCong(DateTime []dsNgayMoChot,string TableName)
 {
     //foreach (DateTime item in dsNgayMoChot)
     //{
     //    DOChot info = new DOChot { Ngay = item };
     //    MoChot(info,TableName);
     //}
     QueryBuilder query = new QueryBuilder("DELETE FROM " + DAChamCongAutoChot.TABLE_MAP + " WHERE 1=1");
     query.addDateFromTo("NGAY", dsNgayMoChot[0], dsNgayMoChot[dsNgayMoChot.Length - 1]);
     DatabaseFB db = HelpDB.getDatabase();
     DbCommand cmd = db.GetSQLStringCommand(query.generateParamSQL());
     cmd.Parameters.AddRange(query.generateDbParam().ToArray());
     db.ExecuteNonQuery(cmd);
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:14,代码来源:DAChot.cs

示例7: btnView_Click

        private void btnView_Click(object sender, EventArgs e)
        {
            var sql = string.Format(
                @"select ct.time_start ||' - '|| ct.time_end timeline,ct.kenh_phat, dth.name kenh_phat_name, avg(ct.rate_group) RATE,
               list( distinct nsx.name,'; ') nuoc_sx,
               list( distinct c.noi_dung,'; ') chuong_trinh
               from tns_programs_grid_scr_ct  ct
               inner join tns_programs_grid_scr t on t.pgs_id=ct.pgs_id
               left join tns_chuong_trinh c on c.tct_id=ct.chuong_trinh
               left join tns_nuoc_sx nsx on ct.nuoc_sx=nsx.id
               left join dm_dai_truyen_hinh dth on dth.id=ct.kenh_phat
               where  (t.is_delete='N' or t.is_delete is null) and  ct.chuong_trinh is not null and 1=1");
            var query = new QueryBuilder(sql);
            AppCtrl.addID(query, "CT.PGS_id", FileNguon);
            AppCtrl.addID(query, "CT.KENH_PHAT", KenhPhat);
            query.addDateFromTo("CT.NGAY_PHAT", TuNgay.DateTime, DenNgay.DateTime);

            var minStart = TimeSpanHelper.Parse(TuVet.EditValue.ToString()).TotalMinutes;
            var minEnd = TimeSpanHelper.Parse(DenVet.EditValue.ToString()).TotalMinutes;
            query.add("CT.MINS_START", Operator.GreaterEqual, minStart, DbType.Decimal);
            query.add("CT.MINS_END", Operator.LessEqual, minEnd, DbType.Decimal);

            query.addGroupBy(@"ct.time_start ||' - '|| ct.time_end, ct.kenh_phat,dth.name");
            query.addCondition("1=1");

            var ds = HelpDB.getDBService().LoadDataSet(query, KE_HOACH_LPS_CT.TABLE_NAME);
            RemoveCols();
            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable dtSource = ds.Tables[0];
                DataTable dtKenh = dtSource.DefaultView.ToTable(true, "kenh_phat", "kenh_phat_name");
                GenColumn(dtKenh);
                DataTable dtRp = CreateReportTable(dtSource, dtKenh);
                gridControlDetail.DataSource = dtRp;
            }
        }
开发者ID:khanhdtn,项目名称:did-vlib-2011,代码行数:36,代码来源:frmTNSChart.cs

示例8: InitMRUEditYeuCau

 private void InitMRUEditYeuCau()
 {
     mruEditYeuCau.Text = "";
     mruEditYeuCau.Properties.Items.Clear();
     QueryBuilder sql = new QueryBuilder(@"SELECT CHU_DE FROM YEU_CAU YC LEFT JOIN YEU_CAU_TRA_LOI YCTL ON YCTL.YEU_CAU_ID = YC.ID WHERE 1=1");
     sql.addDateFromTo("YC.NGAY_GUI", ngayLamViec.FromDate, ngayLamViec.ToDate);
     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)
     {
         sql.addCondition(cond.ToString());
     }
     if (PLTinhtrang._getSelectedID() > 0)
     {
         sql.addID("TINH_TRANG", PLTinhtrang._getSelectedID());
     }
     if (PLMucuutien._getSelectedID() > 0)
     {
         sql.addID("MUC_UU_TIEN", PLMucuutien._getSelectedID());
     }
     DataSet ds = HelpDB.getDatabase().LoadDataSet(sql);
     foreach (DataRow row in ds.Tables[0].Rows)
     {
         mruEditYeuCau.Properties.Items.Add(row["CHU_DE"]);
     }
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:41,代码来源:frmQLHoTro.cs

示例9: PLBuildQueryFilter

        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;
        }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:45,代码来源:frmQLHoTro.cs

示例10: PLBuildQueryFilter

 /// <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()
 {
     QueryBuilder query = null;
     query = new QueryBuilder(
         "SELECT * " +
         "FROM PHIEU_THU_CHI " +
         "WHERE 1=1"
     );
     query.addDateFromTo(PhieuThuChiExtFields.NGAY_PHAT_SINH, this.dateFrom.DateTime, this.dateTo.DateTime);
     query.addSoPhieu(PhieuThuChiExtFields.CODE, this.txtCode.Text.Trim());
     query.addID(PhieuThuChiExtFields.EMP_ID, this.cmbEmp._getSelectedID());
     if (this.chkThu.Checked != this.chkChi.Checked)
     {
         if(this.chkThu.Checked)
             query.addBoolean(PhieuThuChiExtFields.THU_CHI_BIT, true);
         else
             query.addBoolean(PhieuThuChiExtFields.THU_CHI_BIT, false);
     }
     query.addCondition("(1=1)");
     return query;
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:27,代码来源:frmPhieuThuChiMan.cs

示例11: PLBuildQueryFilter

 public override QueryBuilder PLBuildQueryFilter()
 {
     DataSet ds;
     if (!checkTin_noi_bat.Checked)
     {
         QueryBuilder query = new QueryBuilder
         (
             " SELECT ID,PRIOR,TT.NHOM_TIN,TIEU_DE, NGAY_CAP_NHAT,TT.NGUOI_CAP_NHAT,NHOM_TIN,DUYET," +
             " CASE WHEN PRIOR='Y' THEN 'Tin tức nổi bật' ELSE NULL END TIN_NOI_BAT" +
             " FROM TIN_TUC TT WHERE 1=1"
         );
         query.addID("NHOM_TIN", PLNhomTT._getSelectedID());
         query.addDateFromTo("NGAY_CAP_NHAT", dateTungay.DateTime, dateDenngay.DateTime);
         query.setDescOrderBy("NGAY_CAP_NHAT");
         if (DATinTuc.Instance.getNguoiDuyet(DATinTuc.quyenDuyet).Contains(FrameworkParams.currentUser.employee_id))
             query.addDuyet(PLDBUtil.FIELD_DUYET, DuyetSelect.layTrangThai());
         else
             query.addCondition(string.Format("{0} = 2 or NGUOI_CAP_NHAT = {1}", PLDBUtil.FIELD_DUYET, FrameworkParams.currentUser.employee_id));
         ds = DABase.getDatabase().LoadDataSet(query);
         barSubItem1.Enabled = ds.Tables[0].Rows.Count > 0;
         gridControlMaster.DataSource = ds.Tables[0];
         HookFocusRow();
     }
     else
     {
         ds = DATinTuc.Instance.Get_5_tin(PLNhomTT._getSelectedID(), dateTungay.DateTime, dateDenngay.DateTime,DuyetSelect);
         barSubItem1.Enabled = ds.Tables[0].Rows.Count > 0;
         gridControlMaster.DataSource = ds.Tables[0];
         HookFocusRow();
     }
     if (ds.Tables[0].Rows.Count == 0)
     {
         this.ThongTinNoiBat(null, null);
         barButtonItemDuyet.Enabled = false;
         barButtonItemK_Duyet.Enabled = false;
     }
     return null;
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:38,代码来源:frmNewsPaperQL.cs

示例12: PLBuildQueryFilter

        public override QueryBuilder PLBuildQueryFilter()
        {
            string chuoi = @"Select ID,NAME,
                    (Select Name from dm_nhan_vien Nv where Nv.id=B.NGUOI_QUAN_LY) TEN_NGUOI_QL,
                    (Select Name from DM_LOAI_DU_AN Da where Da.id=B.LOAI_DU_AN) TEN_DA,
                    NGAY_BAT_DAU,NGAY_KET_THUC,
                    MUC_UU_TIEN,TIEN_DO,TINH_TRANG
                    from DU_AN B where 1=1";
            if (LoaiCV._getSelectedID() != -1 && LoaiCV._getSelectedID() != 0)
                chuoi = @"Select ID,NAME,
                    (Select Name from dm_nhan_vien Nv where Nv.id=B.NGUOI_QUAN_LY) TEN_NGUOI_QL,
                    (Select Name from DM_LOAI_DU_AN Da where Da.id=B.LOAI_DU_AN) TEN_DA,
                    NGAY_BAT_DAU,NGAY_KET_THUC,
                    MUC_UU_TIEN,TIEN_DO,TINH_TRANG
                    from DU_AN B where exists(SELECT * FROM CONG_VIEC_DU_AN cvda,phan_cong_cong_viec pccv  where B.ID=cvda.DU_AN_ID and cvda.PCCV_ID=pccv.pccv_id and pccv.lcv_id='" + LoaiCV._getSelectedID() + "') and 1=1";
            QueryBuilder query = new QueryBuilder(chuoi);

            query.addID("LOAI_DU_AN", LoaiDA._getSelectedID());
            query.addID("MUC_UU_TIEN", mucuutien._getSelectedID());
            query.addID("TINH_TRANG", tintrang._getSelectedID());
            query.addDateFromTo("NGAY_BAT_DAU", Tungay.DateTime, denngay.DateTime);
            query.addDateFromTo("NGAY_KET_THUC", KetThucTu.DateTime, KetThucTu.DateTime);
            GridDataSet = DABase.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");
            gridControlMaster.DataSource = GridDataSet.Tables[0];
            return null;
        }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:33,代码来源:frmDuAnQL.cs

示例13: PLBuildQueryFilter

        /// <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()
        {
            error.ClearErrors();
            gridViewMaster.ClearGrouping();
            if (TruongCap1.Text != string.Empty)
            {
                gridViewMaster.Columns[(int)TruongCap1._getSelectedID()].Group();
                gridViewMaster.Columns[(int)TruongCap1._getSelectedID()].Visible = false;
            }

            if (TruongCap2.Text != string.Empty)
            {
                if (TruongCap2.Text != TruongCap1.Text)
                {
                    gridViewMaster.Columns[(int)TruongCap2._getSelectedID()].Group();
                    gridViewMaster.Columns[(int)TruongCap2._getSelectedID()].Visible = false;
                }
                else TruongCap2.SetError(error, "Trường thống kê này đã được sử dụng!");
            }
            if (TruongCap3.Text != string.Empty)
            {
                if (TruongCap3.Text != TruongCap1.Text && TruongCap3.Text != TruongCap2.Text)
                {
                    gridViewMaster.Columns[(int)TruongCap3._getSelectedID()].Group();
                    gridViewMaster.Columns[(int)TruongCap3._getSelectedID()].Visible = false;
                }
                else TruongCap3.SetError(error, "Trường thống kê này đã được sử dụng!");
            }

            QueryBuilder filter = new QueryBuilder(UpdateRow());
            filter.addSoPhieu(BIEN_MUC.MA_BANG, MaBang.Text);
            filter.addLike("LOWER(" + BIEN_MUC.NOI_DUNG + ")", NoiDung.Text.ToLower());
            filter.addID(BIEN_MUC.SO_DKCB_HD, SoDKHDCB._getSelectedIDs());
            filter.addID(BIEN_MUC.TIET_MUC, TietMuc._getSelectedIDs());
            filter.addID(BIEN_MUC.LOAI_LUU_TRU, LoaiBang._getSelectedIDs());
            filter.addIn(BIEN_MUC.POST_MASTER, AppCtrl.GetCheckedValues(TinhTrang, true));
            filter.addID(BIEN_MUC.DON_VI_CUNG_CAP, DonViCungCap._getSelectedIDs());
            filter.addID(BIEN_MUC.DON_VI_SO_HUU, DonViSoHuu._getSelectedIDs());
            filter.addDateFromTo(BIEN_MUC.NGAY_NHAP, ngayNhap.FromDate, ngayNhap.ToDate);
            long[] IDs = QuocGia._getSelectedIDs();
            if (IDs.Length > 0 && IDs.Length < QuocGia.Properties.GetItems().Count)
            {
                string cond = "(";
                foreach (long id in IDs)
                {
                    cond += BIEN_MUC.NUOC_SAN_XUAT + " like '%," + id + "' or " + BIEN_MUC.NUOC_SAN_XUAT + " like '" + id + ",%' or " + BIEN_MUC.NUOC_SAN_XUAT + " like '%," + id + ",%' or ";
                }
                cond = cond.TrimEnd(' ', 'r', 'o');
                cond = cond += ")";
                filter.addCondition(cond);
            }
            filter.addCondition("1=1");
            filter.setDescOrderBy(BIEN_MUC.NGAY_CAP_NHAT);
            return filter;
        }
开发者ID:khanhdtn,项目名称:did-vlib-2011,代码行数:61,代码来源:frmTKTongHopTrenThuocTinh.cs

示例14: InitMRUEditTenCongViec

 private void InitMRUEditTenCongViec()
 {
     mruEditTenCongViec.Text = "";
     mruEditTenCongViec.Properties.Items.Clear();
     QueryBuilder sql = new QueryBuilder(@"SELECT CONG_VIEC FROM PHAN_CONG_CONG_VIEC where 1=1");
     sql.addDateFromTo("NGAY_BAT_DAU", ngayLamViec.FromDate, ngayLamViec.ToDate);
     DataSet ds = HelpDB.getDatabase().LoadDataSet(sql);
     foreach (DataRow row in ds.Tables[0].Rows)
     {
         mruEditTenCongViec.Properties.Items.Add(row["CONG_VIEC"]);
     }
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:12,代码来源:frmQLCongviecQL1N.cs

示例15: Load_Data

 private void Load_Data(DateTime Ngay_lam_viec)
 {
     string sql = @"Select CN.ID,D.NAME as PHONG_BAN,NV.ID as NV_ID,NV.NAME as TEN_NV,NGAY_LAM_VIEC,GIO_BAT_DAU,GIO_KET_THUC,THOI_GIAN_LAM_VIEC,THOI_GIAN_SANG,THOI_GIAN_CHIEU
                     from (DM_NHAN_VIEN NV inner join CAPNHAT_NGAYLAMVIEC CN on NV.ID=CN.NV_ID) left join DEPARTMENT D on D.ID=NV.DEPARTMENT_ID where CN.LOAI=1 and 1=1";
     QueryBuilder query = new QueryBuilder(sql);
     query.addDateFromTo("NGAY_LAM_VIEC", dateNgay_LV.DateTime, dateNgay_LV.DateTime);
     ds = DABase.getDatabase().LoadDataSet(query);
     ds.Tables[0].Columns.Add("TGDC_1", Type.GetType("System.DateTime"));
     ds_updated = ds.Clone();
     gridControlSource.DataSource = ds.Tables[0];
 }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:11,代码来源:frmChangeTimeInOut.cs


注:本文中的QueryBuilder.addDateFromTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。