public Graph(agency a, NpgsqlConnection con, double s) { InitializeComponent(); this.agent = a; this.conn = con; chart.Height = s - 120; datepick1.Text = datepick1.DisplayDate.ToString(); // rewrite datepick2.Text = datepick2.DisplayDate.AddDays(3).ToString(); // rewrite4 adapter = new NpgsqlDataAdapter("select date_trunc('day',( select min(time) from value_elec where id_counter = " + agent.counterid + "))", conn); datepick1.DisplayDateStart = (DateTime)adapter.SelectCommand.ExecuteScalar(); datepick2.DisplayDateStart = datepick1.DisplayDateStart; adapter = new NpgsqlDataAdapter("select date_trunc('day',( select max(time) from value_elec where id_counter = " + agent.counterid + "))", conn); datepick1.DisplayDateEnd = (DateTime)adapter.SelectCommand.ExecuteScalar(); datepick2.DisplayDateEnd = datepick1.DisplayDateEnd; chart.Visibility = Visibility.Hidden; }
public Adress(int select, NpgsqlConnection con, Frame f, agency a, double s) { InitializeComponent(); DB.IsReadOnly = true; table = select; conn = con; if (select == 0) { DB.ContextMenu.Visibility = Visibility.Hidden; } else { DB.ContextMenu.Visibility = Visibility.Visible; } far = f; this.agent = a; size = s; }
private void mainWindow_Loaded(object sender, RoutedEventArgs e) { conn = new NpgsqlConnection(File.ReadAllText("connection.ini")); conn.Open(); agent = new agency(); }