using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link].NTD_SC_RoadmapExpSMLwiseproductMapping
{
public partial class NTD_SC_RoadmapExpSMLwiseproductMappingUserControl :
PageBase
{
string UserID = [Link];
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
UserID = Username();
UserLog(UserID);
FillListAll("All", ddlFilterExperience,
GetDataTable("ntd_SC_GetFilterEXperiance"), "Name", "ID");
BindGrid(null);
FillListForMultiSelect("All", ddlproduct,
GetDataTable("SP_NTD_NM_GetProductList", "Flag,UserID,ProductID,ModelID", 4,
UserID, "", ""), "Product_Name", "ProductI_ID");
}
}
protected void CheckAll_CheckedChanged(object senderr, EventArgs e)
{
CheckBox headerCheckBox = (CheckBox)senderr;
foreach (GridViewRow row in [Link])
{
CheckBox itemCheckBox = (CheckBox)[Link]("ItemCheckBox");
if (itemCheckBox != null)
{
[Link] = [Link];
}
}
}
private void BindGrid(string experienceFilter)
{
// Fetch data from the database
DataTable dt = GetDataTable("ntd_SC_GetRoadmapExpSMLwiseproduct");
// If an experience filter is provided, apply it
if ( && experienceFilter != "-
1") // "-1" can be used for "All Experiences"
{
dt = [Link]()
.Where(row => [Link]<string>("AggregateName") ==
experienceFilter)
.CopyToDataTable();
}
// Group data by AggregateName, then HotspotName, and finally by Levels
var groupedData = [Link]()
.GroupBy(row => [Link]<string>("AggregateName"))
.Select(aggregateGroup => new
{
AggregateName = [Link],
Hotspots = [Link](row =>
[Link]<string>("LevelName"))
.Select(hotspotGroup => new
{
LevelName = [Link],
Levels = [Link](row =>
[Link]<long>("TermId"))
.Select(levelGroup => new
{
Level = [Link],
TechConcepts =
[Link](detail => [Link]<string>("TechConcept")).ToList()
}).ToList()
}).ToList()
}).ToList();
DataTable outputDt = new DataTable();
[Link]("AggregateName");
[Link]("LevelName");
// Find the maximum level number
int maxLevel = [Link]().Max(row => [Link]<int>("Level"));
// Dynamically add columns for each level (Level 1, Level 2, etc.)
for (int i = 1; i <= 5; i++)
{
[Link]($"Level {i}");
}
// Populate the output DataTable
foreach (var aggregate in groupedData)
{
foreach (var hotspot in [Link])
{
int maxConcepts = [Link](level =>
[Link]);
// Loop through each TechConcept and create a row for each one
for (int i = 0; i < maxConcepts; i++)
{
DataRow row = [Link]();
// Always set the AggregateName (Experience) for each row
row["AggregateName"] = [Link];
// Set the LevelName (Hotspot)
row["LevelName"] = [Link];
// Set the TechConcepts for each level
foreach (var level in [Link])
{
if (i < [Link])
{
row[$"Level {[Link]}"] =
[Link][i];
}
else
{
row[$"Level {[Link]}"] = "";
}
}
[Link](row); // Add the row to the DataTable
}
}
}
// Bind the output DataTable to the GridView
[Link] = outputDt;
[Link]();
}
private DataTable GetTermValues()
{
// Assuming you have a method to execute your stored procedure and
return a DataTable
DataSet ds = SP_GetDataSet("SP_SC_Ddl_GetTerms", "");
DataTable dt = [Link][0];
return dt;
}
public class ExperienceDetail
{
public int RMExpId { get; set; }
public string TechConcept { get; set; }
public string HotspotName { get; set; }
public int PagerID { get; set; }
public int AggregateId { get; set; }
public int TermId { get; set; }
public string AggregateName { get; set; }
public int Level { get; set; }
public string Description { get; set; }
public string Goalstmt { get; set; }
}
protected void ddlFilterExperience_SelectedIndexChanged(object sender,
EventArgs e)
{
string selectedValue = [Link];
if (selectedValue == "-1")
{
BindGrid(null); // Bind all data if "Select Experience" is selected
}
else
{
// Bind grid with the selected experience name
string selectedExperience = [Link];
BindGrid(selectedExperience); // Pass the selected experience name
for filtering
}
}
}