1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
namespace UEDISurvey
{
public partial class Form1 : Form
{
BindingSource bsFil = new BindingSource();
public Form1()
{
filView.DataSource = bsFil;
timer1.Enabled = true;
timer1.Start();
timer1_Tick(null, null);
}
private void timer1_Tick(object sender, EventArgs e)
{
filViewFill();
}
private void filViewFill()
{
using (OleDbConnection cnx = new OleDbConnection(string.Format("Provider=msdaora;Data Source={0};User Id={1};Password={2};", DataSource, Login, Password)))
{
DataTable dt = new DataTable();
cnx.Open();
using (OleDbCommand cmd = cnx.CreateCommand())
{
cmd.CommandText = "select f.fil, decode(automanu, 'E', 0, round((to_date(heudeb, 'hh24mi') - to_date(heuact, 'hh24mi')) * 1440, 0)) bloquee, substr(heudeb, 1, 2) || ':' || substr(heudeb, 3, 2) heudeb, (select count(*) from ut_spl s where s.codsoc = m2.codsoc and s.batch = f.fil and s.st1 = 1 and s.eshs = 'ES') attente, s.numero from mev m1 inner join mev m2 on m2.codsoc = m1.codsoc and m2.codent = 'UT_SPL' and m2.segment = ' ' inner join ut_fil f on f.codsoc = m1.codsoc_phy inner join ut_spl s on s.codsoc = m2.codsoc_phy and s.batch = f.fil where m1.codsoc = ? and m1.codent = 'UT_FIL' and m1.segment = ' ' and f.eshs = 'ES' and f.nbrpro > 0 and s.st1 < 4 and s.datdeb != ' ' and (s.automanu != 'E' or s.st1 != 1) order by fil";
OleDbParameter p1 = cmd.CreateParameter();
p1.ParameterName = "codsoc";
p1.DbType = DbType.VarNumeric;
p1.Value = Codsoc;
cmd.Parameters.Add(p1);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(dt);
}
bsFil.DataSource = dt;
cnx.Close();
}
}
}
} |
Partager