В моей форме есть раскрывающийся список, который должен отфильтровывать или отображать мое облако тегов для всего проекта или для конкретной итерации.Это странно, потому что я получаю разные результаты, когда выбираю определенные итерации из списка.Иногда элемент управления ascx вообще не отображается, иногда он отображает облако тегов, но оно некорректно, а иногда отображает правильное.Я понятия не имею, почему это происходит ... Заранее спасибо за вашу помощь!
displaycloud.aspx:
<asp:DropDownList ID="filteroptions" runat="server" onselectedindexchanged="filteroptions_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
<asp:UpdatePanel ID="UpdateIteration" runat="server">
<ContentTemplate>
<TagCloud:TagCloudControl ID="TagCloudControl1" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="filteroptions" />
</Triggers>
</asp:UpdatePanel>
displaycloud.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
proj_name = Request.QueryString["project"].ToString();
proj_id = Request.QueryString["id"].ToString();
SqlConnection conn = new SqlConnection(GetConnectionString());
conn.Open();
cmd = new SqlCommand("Select CONVERT(VARCHAR(10), StartDate, 103) + ' - ' + CONVERT(VARCHAR(10), EndDate, 103) AS Iteration, ProjectIterationID FROM Iterations WHERE ProjectID = '" + proj_id + "'", conn);
cmd.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);;
conn.Close();
if (!Page.IsPostBack)
{
filteroptions.DataSource = ds;
filteroptions.DataTextField = "Iteration";
filteroptions.DataValueField = "ProjectIterationID";
filteroptions.DataBind();
filteroptions.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Entire Project", "0"));
}
}
protected void filteroptions_SelectedIndexChanged(object sender, EventArgs e)
{
string selected_iteration = filteroptions.SelectedValue;
Session["iteration"] = selected_iteration;
}
ASCX CS FILE:
protected void Page_Load(object sender, EventArgs e)
{
proj_name = Request.QueryString["project"].ToString();
proj_id = Request.QueryString["id"].ToString();
if (String.IsNullOrEmpty((string)Session["iteration"]))
{
iteration = "0";
}
else
{
iteration = (string)Session["iteration"];
}
BindTagCloud();
}
private void BindTagCloud()
{
int pro_id = Convert.ToInt32(proj_id);
int iteration_id = Convert.ToInt32(iteration);
var tagSummaryNegative = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 1 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
tagCount = tagGroup.Count()
};
var tagSummaryNegativeIteration = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == iteration_id &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 1 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
tagCount = tagGroup.Count()
};
var tagSummaryPositive = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 0 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
tagCount = tagGroup.Count()
};
var tagSummaryPositiveIteration = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == iteration_id &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 0 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
tagCount = tagGroup.Count()
};
int maxTagFrequencyNegative = (from t in tagSummaryNegative select (int?)t.tagCount).Max() ?? 0;
int maxTagFrequencyPositive = (from t in tagSummaryPositive select (int?)t.tagCount).Max() ?? 0;
int maxTagFrequencyNegativeIteration = (from t in tagSummaryNegativeIteration select (int?)t.tagCount).Max() ?? 0;
int maxTagFrequencyPositiveIteration = (from t in tagSummaryPositiveIteration select (int?)t.tagCount).Max() ?? 0;
var tagCloudNegative = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 1 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
weight = (double)tagGroup.Count() / maxTagFrequencyNegative * 100
};
var tagCloudNegativeIteration = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == iteration_id &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 1 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
weight = (double)tagGroup.Count() / maxTagFrequencyNegative * 100
};
var tagCloudPositive = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 0 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
weight = (double)tagGroup.Count() / maxTagFrequencyNegative * 100
};
var tagCloudPositiveIteration = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == iteration_id &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 0 &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
weight = (double)tagGroup.Count() / maxTagFrequencyNegative * 100
};
if (iteration_id != 0)
{
ListView1.DataSource = tagCloudNegativeIteration;
ListView1.DataBind();
ListView2.DataSource = tagCloudPositiveIteration;
ListView2.DataBind();
}
else
{
ListView1.DataSource = tagCloudNegative;
ListView1.DataBind();
ListView2.DataSource = tagCloudPositive;
ListView2.DataBind();
}
}