private void DataQuery() { String sql = @"SELECT DBC.USERS USERID,OU.USERNAME,DBC.ISSEND,DECODE(DBC.ISSEND,'N','未发送','Y','已发送','E','异常')ISSENDNAME,DBC.BRCONTENT,DBC.TIMEUP FROM DOC_BRIEF_CON DBC,SYS_OPERUSER OU WHERE DBC.USERS=OU.USERID "; int total = 0; string strwhere = ""; PubFunc.FormDataCheck(FormSearch); if (!string.IsNullOrEmpty(ddlUSERS.SelectedValue)) { strwhere += string.Format(" AND OU.USERID LIKE'%{0}%' ", ddlUSERS.SelectedValue); } if (!string.IsNullOrEmpty(ddlISSEND.SelectedValue)) { strwhere += string.Format(" AND DBC.ISSEND='{0}' ", ddlISSEND.SelectedValue); } if (dpkBegRQ.SelectedDate != null && dpkEndRQ.SelectedDate != null) { strwhere += string.Format(" AND TRUNC(DBC.TIMEUP,'DD') BETWEEN TRUNC(TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS'),'DD') AND TRUNC(TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS'),'DD') ", dpkBegRQ.SelectedDate, dpkEndRQ.SelectedDate); } DataTable dt = PubFunc.DbGetPage(GridToBrief.PageIndex, GridToBrief.PageSize, sql + strwhere + " ORDER BY DECODE(DBC.ISSEND,'1','2'),DBC.TIMEUP ", ref total); GridToBrief.DataSource = dt; GridToBrief.RecordCount = total; GridToBrief.DataBind(); }
private void DataQuery() { String sql = @"select DBD.CODE BRCODE, DBD.NAME BRNAME, DBD.FLAG, DECODE(DBD.FLAG, 'Y', '启用', 'N', '不启用','未维护') FLAGNAME, F_JOINUSERID(DBD.CODE) USERID, TO_CHAR(TIMEUP,'YYYY-MM-DD HH24:MI:SS')TIMEUP, MEMO,STR1,STR2,STR3 from DOC_BRIEF_DOC DBD where 1=1 ORDER BY DBD.CODE"; int total = 0; if (!PubFunc.StrIsEmpty(tgbSearch.Text)) { sql += string.Format(" AND (DOTYPE like '%{0}%' or DONAME like '%{0}%')", tgbSearch.Text); } DataTable dt = PubFunc.DbGetPage(GridToBrief.PageIndex, GridToBrief.PageSize, sql, ref total); GridToBrief.DataSource = dt; GridToBrief.RecordCount = total; GridToBrief.DataBind(); }