private void ShowNotifications() { dbh.OpenConnection(); DataTable dt = dbh.GetNotifications(); notificationsPanel.Controls.Clear(); int amount = dt.Rows.Count; if (!showallNotifications && amount > 5) { amount = 5; Button btn_showAllNotifications = new Button(); btn_showAllNotifications.Text = "Show all projects"; btn_showAllNotifications.Dock = DockStyle.Bottom; btn_showAllNotifications.Click += new System.EventHandler(this.ShowAllNotifications); notificationsPanel.Controls.Add(btn_showAllNotifications); dbh.CloseConnection(); } OverviewPanel[] overviewInfoPanel = new OverviewPanel[amount]; for (int i = 0; i < overviewInfoPanel.Length; i++) { overviewInfoPanel[i] = new OverviewPanel(i, dt); overviewInfoPanel[i].BorderStyle = BorderStyle.FixedSingle; overviewInfoPanel[i].Dock = DockStyle.Top; overviewInfoPanel[i].btn_Resolved.AccessibleName = dt.Rows[i]["notification_ID"].ToString(); overviewInfoPanel[i].btn_Resolved.Click += new System.EventHandler(this.ResolveNotification); notificationsPanel.Controls.Add(overviewInfoPanel[i]); } dbh.CloseConnection(); }
public void SearchNotificationOnDate(object sender, EventArgs e) { string fromDate = lbl_Date_From.Text; string tillDate = lbl_Date_Till.Text; dbh.OpenConnection(); notificationsPanel.Controls.Clear(); DataTable dt = dbh.FilterNotificationsBetweenDate(fromDate, tillDate, "notification_date"); int amount = dt.Rows.Count; if (!showallNotifications && amount > 5) { amount = 5; } OverviewPanel[] overviewInfoPanel = new OverviewPanel[amount]; for (int i = 0; i < overviewInfoPanel.Length; i++) { overviewInfoPanel[i] = new OverviewPanel(i, dt); overviewInfoPanel[i].BorderStyle = BorderStyle.FixedSingle; overviewInfoPanel[i].Dock = DockStyle.Top; overviewInfoPanel[i].btn_Resolved.AccessibleName = dt.Rows[i]["notification_ID"].ToString(); overviewInfoPanel[i].btn_Resolved.Click += new System.EventHandler(this.ResolveNotification); notificationsPanel.Controls.Add(overviewInfoPanel[i]); } dbh.CloseConnection(); }
private void tscmb_Overview_Department_SelectedIndexChanged(object sender, EventArgs e) { string filter = tscmb_Overview_Department.Text; dbh.OpenConnection(); notificationsPanel.Controls.Clear(); DataTable dt = dbh.FilterNotifications(filter, "notification_department"); int amount = dt.Rows.Count; if (!showallNotifications && amount > 5) { amount = 5; } MessageBox.Show(amount.ToString() + dt.Rows.Count.ToString()); OverviewPanel[] overviewInfoPanel = new OverviewPanel[amount]; for (int i = 0; i < overviewInfoPanel.Length; i++) { overviewInfoPanel[i] = new OverviewPanel(i, dt); overviewInfoPanel[i].BorderStyle = BorderStyle.FixedSingle; overviewInfoPanel[i].Dock = DockStyle.Top; overviewInfoPanel[i].btn_Resolved.AccessibleName = dt.Rows[i]["notification_ID"].ToString(); overviewInfoPanel[i].btn_Resolved.Click += new System.EventHandler(this.ResolveNotification); notificationsPanel.Controls.Add(overviewInfoPanel[i]); } dbh.CloseConnection(); }
private void SearchNotificationOnType(object sender, EventArgs e) { if (tscmb_Overview_Type.Text == "All") { dbh.OpenConnection(); notificationsPanel.Controls.Clear(); DataTable dt = dbh.GetNotifications(); int amount = dt.Rows.Count; if (!showallNotifications && amount > 5) { amount = 5; } OverviewPanel[] overviewInfoPanel = new OverviewPanel[amount]; for (int i = 0; i < overviewInfoPanel.Length; i++) { overviewInfoPanel[i] = new OverviewPanel(i, dt); overviewInfoPanel[i].BorderStyle = BorderStyle.FixedSingle; overviewInfoPanel[i].Dock = DockStyle.Top; overviewInfoPanel[i].btn_Resolved.AccessibleName = dt.Rows[i]["notification_ID"].ToString(); overviewInfoPanel[i].btn_Resolved.Click += new System.EventHandler(this.ResolveNotification); notificationsPanel.Controls.Add(overviewInfoPanel[i]); } dbh.CloseConnection(); } else { string filter = tscmb_Overview_Type.Text; dbh.OpenConnection(); notificationsPanel.Controls.Clear(); DataTable dt = dbh.FilterNotifications(filter, "notification_type"); int amount = dt.Rows.Count; OverviewPanel[] overviewInfoPanel = new OverviewPanel[amount]; for (int i = 0; i < overviewInfoPanel.Length; i++) { overviewInfoPanel[i] = new OverviewPanel(i, dt); overviewInfoPanel[i].BorderStyle = BorderStyle.FixedSingle; overviewInfoPanel[i].Dock = DockStyle.Top; overviewInfoPanel[i].btn_Resolved.AccessibleName = dt.Rows[i]["notification_ID"].ToString(); overviewInfoPanel[i].btn_Resolved.Click += new System.EventHandler(this.ResolveNotification); notificationsPanel.Controls.Add(overviewInfoPanel[i]); } dbh.CloseConnection(); } }