protected void PopulateExistingCCATree(RadTreeView tree) { tree.Nodes[0].Nodes.Clear(); // Get CCA fullnames String qry = "SELECT FullName, up.UserID " + "FROM db_userpreferences up, db_progressreport pr " + "WHERE pr.UserID = up.UserId " + "AND ProgressReportID=@ProgressReportID " + "ORDER BY FullName"; DataTable dt_user = SQL.SelectDataTable(qry, "@ProgressReportID", hf_pr_id.Value); for (int i = 0; i < dt_user.Rows.Count; i++) { RadTreeNode thisNode = new RadTreeNode(Server.HtmlEncode(dt_user.Rows[i]["FullName"].ToString()), dt_user.Rows[i]["UserID"].ToString()); tree.Nodes[0].Nodes.Add(thisNode); } tree.CollapseAllNodes(); }
protected void PopulateNewCCATree(RadTreeView tree) { tree.Nodes[0].Nodes.Clear(); String office_region = Util.GetOfficeRegion(hf_office.Value); String region_expr = "Region=@region"; if (office_region == "CA") { region_expr += " OR Region='US'"; } else if (office_region == "US") { region_expr += " OR Region='CA'"; } // Populate add CCA tree view String qry = "SELECT FullName, UserID " + "FROM db_userpreferences " + "WHERE db_userpreferences.UserID NOT IN (SELECT UserID FROM db_progressreport WHERE ProgressReportID=@ProgressReportID) " + "AND (ccalevel=2 OR ccalevel=1 OR ccalevel=-1) " + "AND (" + " Office=@office OR Secondary_Office=@office " + " OR office IN (SELECT Office FROM db_dashboardoffices WHERE " + region_expr + ") " + " OR UserID IN (SELECT UserID FROM db_commissionoffices WHERE OfficeID=(SELECT OfficeID FROM db_dashboardoffices WHERE Office=@office)) " + " OR UserID IN (SELECT UserID FROM db_add_to_pr_override WHERE OfficeID=(SELECT OfficeID FROM db_dashboardoffices WHERE Office=@office)) " + ") " + "AND Employed=1 " + "ORDER BY FullName"; DataTable dt_users = SQL.SelectDataTable(qry, new String[] { "@ProgressReportID", "@office", "@region" }, new Object[] { hf_pr_id.Value, hf_office.Value, office_region }); for (int i = 0; i < dt_users.Rows.Count; i++) { RadTreeNode thisNode = new RadTreeNode(Server.HtmlEncode(dt_users.Rows[i]["FullName"].ToString()), dt_users.Rows[i]["UserID"].ToString()); tree.Nodes[0].Nodes.Add(thisNode); } tree.CollapseAllNodes(); }