protected override void RunQuery() { long OldPONo = 0; string RecordCountLimit = string.Empty; if ( !( UserData.HasPermission( BPSPerm.BPS_Perm_UnLimitedDataSetSize ) ) ) RecordCountLimit = " Top 1000 "; query = "select " + RecordCountLimit + " swo.*, "; query = query + " est_time_hr + (est_time_min / 60.0) as est_time, "; query = query + " m.machine_name from slitter_wo swo "; query = query + " left outer join slitter_machine m on swo.machine_no = m.machine_no "; if ( RAll.Checked ) { query = query + " where swo.status <> 98776 "; if ( RCOne.Checked ) query = query + " and swo.from_name like '" + EditCustName.Text + "%'"; if ( !( COpen.Checked ) ) query = query + " and swo.status <> " + BPSConst.WX_SWOStatus_Open; if ( !( CPr.Checked ) ) query = query + " and swo.status <> " + BPSConst.WX_SWOStatus_Printed; if ( !( CComplete.Checked ) ) query = query + " and swo.status <> " + BPSConst.WX_SWOStatus_Complete; if ( !( CInv.Checked ) ) query = query + " and swo.status <> " + BPSConst.WX_SWOStatus_Invoiced; query = query + " and swo.date_entry >= '" + dateSelectionFrame1.GetDateStart() + "' "; query = query + " and swo.date_entry <= '" + dateSelectionFrame1.GetDateEnd() + "' "; if ( RMOnly.Checked ) query = query + " and machine_name = " + cbMachine.Text; } else query = query + " where swo.swo_no = " + EditOne.Text; query = query + " order by swo.date_entry desc"; DataSet ds = new DataSet(); DataTable table = new DataTable("slitter_wo"); ds.Tables.Add( table ); SqlDataAdapter da = new SqlDataAdapter( query, BPSConst.ConnStringTest ); da.Fill( ds ); BindingSource bs = new BindingSource(); bs.DataMember = "slitter_wo"; bs.DataSource = ds; GridWO.DataSource = bs; SetRecordCount(); PanelTop1000Only.Visible =((GridWOView.RowCount >= 1000) && (RecordCountLimit != string.Empty)); this.qMachineTA.Fill( this.sCDataSet.qMachine ); FillWOInputGrid(); }