From: <ro...@us...> - 2006-08-09 21:13:21
|
Revision: 292 Author: rouquin Date: 2006-08-09 14:13:16 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=292&view=rev Log Message: ----------- Had to fix what values were being passed to session for assignments filtering. Modified Paths: -------------- Website/Includes/ActionItems.ascx.cs Website/Includes/Assignments.ascx.cs Website/Includes/AssignmentsTree.ascx.cs Website/Includes/Products.ascx.cs Website/Includes/Rights.ascx.cs Website/Includes/UserRoles.ascx.cs Modified: Website/Includes/ActionItems.ascx.cs =================================================================== --- Website/Includes/ActionItems.ascx.cs 2006-08-09 20:32:34 UTC (rev 291) +++ Website/Includes/ActionItems.ascx.cs 2006-08-09 21:13:16 UTC (rev 292) @@ -484,7 +484,8 @@ tcdbDataSetTableAdapters.db_actionItemsTableAdapter aiAdapter = new tcdbDataSetTableAdapters.db_actionItemsTableAdapter(); aiAdapter.Delete(Convert.ToInt32(item_id), deleted); - Response.Redirect(Request.RawUrl); + if (ActionItemsView.CurrentMode != FormViewMode.Edit) + Response.Redirect(Request.RawUrl); } } } Modified: Website/Includes/Assignments.ascx.cs =================================================================== --- Website/Includes/Assignments.ascx.cs 2006-08-09 20:32:34 UTC (rev 291) +++ Website/Includes/Assignments.ascx.cs 2006-08-09 21:13:16 UTC (rev 292) @@ -22,7 +22,7 @@ { private static Logger m_logg = new Logger("TCDB.Assignments"); - private String uid = null; + private int uid = 0; private String mode = null; private int productID = 0; private const int MAX_NAME_LENGTH = 30; @@ -33,29 +33,31 @@ { return; } + Session.Remove("uid"); + Session.Remove("myID"); m_logg.Debug("Loading assignments for [" + m_user.ToString() + "]"); // Load session data try { - uid = (String)Session[Constants.CODE_USER]; + uid = Convert.ToInt32(Session[Constants.CODE_USER]); } catch { } try { - mode = (String)Session["mode"]; + mode = Session[Constants.CODE_MODE].ToString(); } catch { } try { - productID = (int)Session[Constants.CODE_PRODUCT]; + productID = Convert.ToInt32(Session[Constants.CODE_PRODUCT]); } catch { } if (productID == 0) productID = Constants.PRODUCT_ANYID; - if (uid == null) + if (uid == 0) { m_logg.Debug("UserID not specified in the session data, checking for permissions to view multiple users assignments"); if (m_user.HasRight("view_other_ai", productID) || m_user.HasRight("view_created_ai", productID) || @@ -77,7 +79,7 @@ if (m_user.HasRight("view_my_ai") || m_user.HasRight("view_my_wo")) { m_logg.Debug("User has no special privledges, only display own assignments"); - uid = m_user.ID.ToString(); + uid = m_user.ID; Page.Title = "TCDB: My Assignments"; header.Text = "My Assignments"; } @@ -85,7 +87,7 @@ Response.Redirect("~/Default.aspx"); } } - else if (uid == m_user.ID.ToString()) + else if (uid == m_user.ID) { if (m_user.HasRight("view_my_ai") || m_user.HasRight("view_my_wo")) { @@ -98,7 +100,7 @@ } else { - User user = UserDB.GetUserInfo(Convert.ToInt32(uid)); + User user = UserDB.GetUserInfo(uid); if (user.HasRights(productID) && (m_user.HasRight("view_other_ai", productID) || m_user.HasRight("view_other_wo", productID) || @@ -110,10 +112,11 @@ header.Text = name + "'s Assignments"; } } - if (mode == Constants.ASSIGNMENT_CREATED) + if (mode == Constants.CODE_CREATED) Session.Add("myID", m_user.ID); - Session.Add("uid", uid); + if (uid != 0) + Session.Add("uid", uid); m_logg.Debug("Databinding the AssignmentsGridView"); if (Session["refresh"] != null) AssignmentsGridView.DataBind(); @@ -156,7 +159,7 @@ ) return false; - if (mode == "created" && ai.CREATOR.ID != m_user.ID) + if (mode == Constants.CODE_CREATED && ai.CREATOR.ID != m_user.ID) return false; if (cboTypeFilter.Checked && !cboShowActionItems.Checked) @@ -180,7 +183,7 @@ ) return false; - if (mode == "created" && wo.CREATOR.ID != m_user.ID) + if (mode == Constants.CODE_CREATED && wo.CREATOR.ID != m_user.ID) return false; if (cboTypeFilter.Checked && !cboShowWorkOrders.Checked) Modified: Website/Includes/AssignmentsTree.ascx.cs =================================================================== --- Website/Includes/AssignmentsTree.ascx.cs 2006-08-09 20:32:34 UTC (rev 291) +++ Website/Includes/AssignmentsTree.ascx.cs 2006-08-09 21:13:16 UTC (rev 292) @@ -74,57 +74,6 @@ m_logg.Debug("Collapsing node [" + nodes[index].ToString() + "]"); nodes.RemoveAt(index); } - - if (e.Node.Selected && AssignmentTree.ShowExpandCollapse == false) - { - e.Node.Selected = false; - String nodeType = GetValue(e.Node, "NodeType"); - if (nodeType == null) nodeType = "Root"; - String nodeValue = GetValue(e.Node, "Value"); - switch (nodeType) - { - case "Root": - Session.Remove(PREFIX + Constants.CODE_USER); - Session.Remove(PREFIX + Constants.CODE_PRODUCT); - Response.Redirect("~/Assignments.aspx"); - break; - case "Product": - Session.Remove(PREFIX + Constants.CODE_USER); - Session[PREFIX + Constants.CODE_PRODUCT] = nodeValue; - Response.Redirect("~/Assignments.aspx"); - break; - case "User": - Session[PREFIX + Constants.CODE_USER] = nodeValue; - Session[PREFIX + Constants.CODE_PRODUCT] = GetValue(e.Node.Parent, "Value"); - try - { - if (bool.Parse(GetValue(e.Node, "IsCreated"))) - { - Session.Remove(Constants.CODE_PRODUCT); - Session[Constants.CODE_CREATED] = true; - } - } - catch { } - Response.Redirect("~/Assignments.aspx"); - break; - case "Created": - Session.Remove(Constants.CODE_USER); - Session.Remove(Constants.CODE_PRODUCT); - Session[Constants.CODE_CREATED] = true; - Response.Redirect("~/Assignments.aspx"); - break; - case "ActionItem": - Session[Constants.CODE_AI] = nodeValue; - Response.Redirect("~/ActionItem.aspx"); - break; - case "WorkOrer": - Session[Constants.CODE_WO] = nodeValue; - Response.Redirect("~/WorkOrder.aspx"); - break; - default: - break; - } - } } protected void AssignmentTree_TreeNodeExpanded(object sender, TreeNodeEventArgs e) @@ -136,85 +85,25 @@ nodes.Add(e.Node.ValuePath); m_logg.Debug("Expanding node [" + nodes[nodes.IndexOf(e.Node.ValuePath)].ToString() + "]"); } - - if (e.Node.Selected && AssignmentTree.ShowExpandCollapse == false) - { - e.Node.Selected = false; - String nodeType = GetValue(e.Node, "NodeType"); - if (nodeType == null) nodeType = "Root"; - String nodeValue = GetValue(e.Node, "Value"); - switch (nodeType) - { - case "Root": - Session.Remove(PREFIX + Constants.CODE_USER); - Session.Remove(PREFIX + Constants.CODE_PRODUCT); - Response.Redirect("~/Assignments.aspx"); - break; - case "Product": - Session.Remove(PREFIX + Constants.CODE_USER); - Session[PREFIX + Constants.CODE_PRODUCT] = nodeValue; - Response.Redirect("~/Assignments.aspx"); - break; - case "User": - Session[PREFIX + Constants.CODE_USER] = nodeValue; - Session[PREFIX + Constants.CODE_PRODUCT] = GetValue(e.Node.Parent, "Value"); - try - { - if (bool.Parse(GetValue(e.Node, "IsCreated"))) - { - Session.Remove(Constants.CODE_PRODUCT); - Session[Constants.CODE_CREATED] = true; - } - } - catch { } - Response.Redirect("~/Assignments.aspx"); - break; - case "Created": - Session.Remove(Constants.CODE_USER); - Session.Remove(Constants.CODE_PRODUCT); - Session[Constants.CODE_CREATED] = true; - Response.Redirect("~/Assignments.aspx"); - break; - case "ActionItem": - Session[Constants.CODE_AI] = nodeValue; - Response.Redirect("~/ActionItem.aspx"); - break; - case "WorkOrer": - Session[Constants.CODE_WO] = nodeValue; - Response.Redirect("~/WorkOrder.aspx"); - break; - default: - break; - } - } } - protected void AssignmentTree_SelectedNodeChanged(object sender, EventArgs e) { TreeNode node = AssignmentTree.SelectedNode; - - node.Selected = false; - if (AssignmentTree.ShowExpandCollapse == false) - { - if (node.Expanded == true) - node.Collapse(); - else - node.Expand(); - }/* - else - {*/ String nodeType = GetValue(node, "NodeType"); if (nodeType == null) nodeType = "Root"; + String nodeValue = GetValue(node, "Value"); + node.Selected = false; + + Session.Remove(Constants.CODE_USER); + Session.Remove(Constants.CODE_PRODUCT); + Session.Remove(Constants.CODE_MODE); switch (nodeType) { case "Root": - Session.Remove(Constants.CODE_USER); - Session.Remove(Constants.CODE_PRODUCT); Response.Redirect("~/Assignments.aspx"); break; case "Product": - Session.Remove(Constants.CODE_USER); Session[Constants.CODE_PRODUCT] = nodeValue; Response.Redirect("~/Assignments.aspx"); break; @@ -225,24 +114,21 @@ { if (bool.Parse(GetValue(node, "IsCreated"))) { - Session.Remove(Constants.CODE_PRODUCT); - Session[Constants.CODE_CREATED] = true; + Session[Constants.CODE_MODE] = Constants.CODE_CREATED; } } catch { } Response.Redirect("~/Assignments.aspx"); break; case "Created": - Session.Remove(Constants.CODE_USER); - Session.Remove(Constants.CODE_PRODUCT); - Session[Constants.CODE_CREATED] = true; + Session[Constants.CODE_MODE] = Constants.CODE_CREATED; Response.Redirect("~/Assignments.aspx"); break; case "ActionItem": Session[Constants.CODE_AI] = nodeValue; Response.Redirect("~/ActionItem.aspx"); break; - case "WorkOrer": + case "WorkOrder": Session[Constants.CODE_WO] = nodeValue; Response.Redirect("~/WorkOrder.aspx"); break; Modified: Website/Includes/Products.ascx.cs =================================================================== --- Website/Includes/Products.ascx.cs 2006-08-09 20:32:34 UTC (rev 291) +++ Website/Includes/Products.ascx.cs 2006-08-09 21:13:16 UTC (rev 292) @@ -246,9 +246,9 @@ { tcdbDataSetTableAdapters.db_productsTableAdapter pAdapter = new tcdbDataSetTableAdapters.db_productsTableAdapter(); pAdapter.Update(product.ID, product.NAME, product.DESCRIPTION, null, null, null, null, null, product.CODENAME, activeBox.Checked); + + Response.Redirect(Request.RawUrl); } - - Response.Redirect(Request.RawUrl); } protected void ProductsView_DataBound(object sender, EventArgs e) { Modified: Website/Includes/Rights.ascx.cs =================================================================== --- Website/Includes/Rights.ascx.cs 2006-08-09 20:32:34 UTC (rev 291) +++ Website/Includes/Rights.ascx.cs 2006-08-09 21:13:16 UTC (rev 292) @@ -125,7 +125,9 @@ { tcdbDataSetTableAdapters.db_rightsTableAdapter rAdapter = new tcdbDataSetTableAdapters.db_rightsTableAdapter(); rAdapter.Update(right.ID, right.CODE, right.NAME, right.DESCRIPTION, activeBox.Checked); - } + + Response.Redirect(Request.RawUrl); + } } protected void FormView1_DataBound(object sender, EventArgs e) Modified: Website/Includes/UserRoles.ascx.cs =================================================================== --- Website/Includes/UserRoles.ascx.cs 2006-08-09 20:32:34 UTC (rev 291) +++ Website/Includes/UserRoles.ascx.cs 2006-08-09 21:13:16 UTC (rev 292) @@ -263,6 +263,8 @@ { tcdbDataSetTableAdapters.db_roleTableAdapter rAdapter = new tcdbDataSetTableAdapters.db_roleTableAdapter(); rAdapter.Update(role.ID, role.NAME, role.DESCRIPTION, activeBox.Checked); + + Response.Redirect(Request.RawUrl); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |