From: <m_h...@us...> - 2006-08-11 19:48:39
|
Revision: 310 Author: m_hildebrand Date: 2006-08-11 12:48:28 -0700 (Fri, 11 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=310&view=rev Log Message: ----------- Cleaned up some session state stuff Changed constants from static variables to actual constants Modified Paths: -------------- Website/App_Code/Common.cs Website/Assignments.aspx Website/Includes/ActionItems.ascx Website/Includes/ActionItems.ascx.cs Website/Includes/AdministrationTree.ascx Website/Includes/AdministrationTree.ascx.cs Website/Includes/Assignments.ascx Website/Includes/Assignments.ascx.cs Website/Includes/AssignmentsTree.ascx Website/Includes/AssignmentsTree.ascx.cs Website/Includes/Authenticate.ascx.cs Website/Includes/Header_Menu.ascx.cs Website/Includes/Header_User.ascx.cs Modified: Website/App_Code/Common.cs =================================================================== --- Website/App_Code/Common.cs 2006-08-11 19:46:14 UTC (rev 309) +++ Website/App_Code/Common.cs 2006-08-11 19:48:28 UTC (rev 310) @@ -4,6 +4,7 @@ using System.Net.Mail; using System.Web; using System.Web.Security; +using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; @@ -659,7 +660,7 @@ Dictionary<String, List<Config>> settings = new Dictionary<string, List<Config>>(); Dictionary<String, String> values; List<Config> group; - + // Start clean settings.Clear(); @@ -1270,7 +1271,7 @@ } } catch (Exception ex) - { + { m_logg.Debug("Error saving config string [" + name + " = " + value + "] for userID [" + userID.ToString() + "]", ex); } @@ -1385,125 +1386,127 @@ public static class Constants { // TODO: Load the values from the DB where appropriate - public static int FAILEDLOGIN = -2; - public static int NOTREGISTERED = -1; - public static int NEWUSER = -1; + public const int FAILEDLOGIN = -2; + public const int NOTREGISTERED = -1; + public const int NEWUSER = -1; // Defaults in the database - public static int ANONYMOUSUSERID = 1; - public static int PRODUCT_SITEID = 1; - public static int PRODUCT_ANYID = -1; - public static int PRODUCT_CREATED = -2; + public const int ANONYMOUSUSERID = 1; + public const int PRODUCT_SITEID = 1; + public const int PRODUCT_ANYID = -1; + public const int PRODUCT_CREATED = -2; - public static int ROLE_ADMIN = 1; + public const int ROLE_ADMIN = 1; public static int ROLE_BASIC_USER = 2; - public static string CODE_AI = "ai"; - public static string CODE_ASSIGNMENT = "a"; - public static string CODE_BUILD = "b"; - public static string CODE_CREATED = "created"; - public static string CODE_MODE = "m"; - public static string CODE_PRODUCT = "p"; - public static string CODE_RIGHT = "rt"; - public static string CODE_ROLE = "r"; - public static string CODE_TYPE = "t"; - public static string CODE_USER = "u"; - public static string CODE_VERSION = "v"; - public static string CODE_WO = "wo"; - + public const string CODE_ASSIGNMENT = "a"; + public const string CODE_USER = "u"; + public const string CODE_AI = "ai"; + public const string CODE_WO = "wo"; + public const string CODE_BUILD = "b"; + public const string CODE_PRODUCT = "p"; + public const string CODE_VERSION = "v"; + public const string CODE_RIGHT = "rt"; + public const string CODE_ROLE = "r"; + public const string CODE_MODE = "m"; + public const string CODE_CREATED = "created"; + public const string CODE_TYPE = "t"; + public const string CODE_VALUE = "va"; + public const string CODE_ROOT = "r"; + public const string CODE_NEW = "new"; // TODO: figure this one out - //public static bool ASSIGNMENT_PRIORITY_ALL = null; - public static bool ASSIGNMENT_PRIORITY_HIGH = true; - public static bool ASSIGNMENT_PRIORITY_NORMAL = false; - public static int ASSIGNMENT_FINISHEDANDUNFINISHED = 2; - public static int ASSIGNMENT_FINISHED = 1; - public static int ASSIGNMENT_UNFINISHED = 0; - public static int ASSIGNMENT_NEW = 3; - public static string ASSIGNMENT_MINE = "My Assignments"; - public static string ASSIGNMENT_CREATED = "My Created Assignments"; + //public const bool ASSIGNMENT_PRIORITY_ALL = null; + public const bool ASSIGNMENT_PRIORITY_HIGH = true; + public const bool ASSIGNMENT_PRIORITY_NORMAL = false; + public const int ASSIGNMENT_FINISHEDANDUNFINISHED = 2; + public const int ASSIGNMENT_FINISHED = 1; + public const int ASSIGNMENT_UNFINISHED = 0; + public const int ASSIGNMENT_NEW = 3; + public const string ASSIGNMENT_MINE = "My Assignments"; + public const string ASSIGNMENT_CREATED = "My Created Assignments"; - public static string TCDB_VERSION = "1.0.0 Alpha 3"; - public static bool IS_DEV_ENV = true; + public const string TCDB_VERSION = "1.0.0 Alpha 3"; + public const bool IS_DEV_ENV = true; // Rights - public static string RIGHTS_DEV_ACCESS = "dev_access"; + public const string RIGHTS_DEV_ACCESS = "dev_access"; - public static string RIGHTS_ADMIN_VIEW = "admin_view"; + public const string RIGHTS_ADMIN_VIEW = "admin_view"; - public static string RIGHTS_AI_VIEW_MY = "ai_view_my"; - public static string RIGHTS_AI_VIEW_CREATED = "ai_view_created"; - public static string RIGHTS_AI_VIEW_OTHER = "ai_view_other"; - public static string RIGHTS_AI_EDIT_MY = "ai_edit_my"; - public static string RIGHTS_AI_EDIT_CREATED = "ai_edit_created"; - public static string RIGHTS_AI_EDIT_OTHER = "ai_edit_other"; - public static string RIGHTS_AI_CREATE_MY = "ai_create_my"; - public static string RIGHTS_AI_CREATE_OTHER = "ai_create_other"; - public static string RIGHTS_AI_STATUS_MY = "ai_status_my"; - public static string RIGHTS_AI_STATUS_CREATED = "ai_status_created"; - public static string RIGHTS_AI_STATUS_OTHER = "ai_status_other"; - public static string RIGHTS_AI_DELETE_MY = "ai_delete_my"; - public static string RIGHTS_AI_DELETE_CREATED = "ai_delete_created"; - public static string RIGHTS_AI_DELETE_OTHER = "ai_delete_other"; - public static string RIGHTS_AI_REASSIGN_OTHER = "ai_reassign_other"; - - public static string RIGHTS_WO_VIEW_MY = "wo_view_my"; - public static string RIGHTS_WO_VIEW_CREATED = "wo_view_created"; - public static string RIGHTS_WO_VIEW_OTHER = "wo_view_other"; - public static string RIGHTS_WO_EDIT_MY = "wo_edit_my"; - public static string RIGHTS_WO_EDIT_CREATED = "wo_edit_created"; - public static string RIGHTS_WO_EDIT_OTHER = "wo_edit_other"; - public static string RIGHTS_WO_CREATE_MY = "wo_create_my"; - public static string RIGHTS_WO_CREATE_OTHER = "wo_create_other"; - public static string RIGHTS_WO_STATUS_MY = "wo_status_my"; - public static string RIGHTS_WO_STATUS_CREATED = "wo_status_created"; - public static string RIGHTS_WO_STATUS_OTHER = "wo_status_other"; - public static string RIGHTS_WO_DELETE_MY = "wo_delete_my"; - public static string RIGHTS_WO_DELETE_CREATED = "wo_delete_created"; - public static string RIGHTS_WO_DELETE_OTHER = "wo_delete_other"; - public static string RIGHTS_WO_REASSIGN_OTHER = "wo_reassign_other"; + public const string RIGHTS_AI_VIEW_MY = "ai_view_my"; + public const string RIGHTS_AI_VIEW_CREATED = "ai_view_created"; + public const string RIGHTS_AI_VIEW_OTHER = "ai_view_other"; + public const string RIGHTS_AI_EDIT_MY = "ai_edit_my"; + public const string RIGHTS_AI_EDIT_CREATED = "ai_edit_created"; + public const string RIGHTS_AI_EDIT_OTHER = "ai_edit_other"; + public const string RIGHTS_AI_CREATE_MY = "ai_create_my"; + public const string RIGHTS_AI_CREATE_OTHER = "ai_create_other"; + public const string RIGHTS_AI_STATUS_MY = "ai_status_my"; + public const string RIGHTS_AI_STATUS_CREATED = "ai_status_created"; + public const string RIGHTS_AI_STATUS_OTHER = "ai_status_other"; + public const string RIGHTS_AI_DELETE_MY = "ai_delete_my"; + public const string RIGHTS_AI_DELETE_CREATED = "ai_delete_created"; + public const string RIGHTS_AI_DELETE_OTHER = "ai_delete_other"; + public const string RIGHTS_AI_REASSIGN_OTHER = "ai_reassign_other"; - public static string RIGHTS_USER_VIEW_MY = "user_view_my"; - public static string RIGHTS_USER_VIEW_OTHER = "user_view_other"; - public static string RIGHTS_USER_EDIT_MY = "user_edit_my"; - public static string RIGHTS_USER_EDIT_OTHER = "user_edit_other"; - public static string RIGHTS_USER_CREATE = "user_create"; - public static string RIGHTS_USER_DELETE = "user_delete"; + public const string RIGHTS_WO_VIEW_MY = "wo_view_my"; + public const string RIGHTS_WO_VIEW_CREATED = "wo_view_created"; + public const string RIGHTS_WO_VIEW_OTHER = "wo_view_other"; + public const string RIGHTS_WO_EDIT_MY = "wo_edit_my"; + public const string RIGHTS_WO_EDIT_CREATED = "wo_edit_created"; + public const string RIGHTS_WO_EDIT_OTHER = "wo_edit_other"; + public const string RIGHTS_WO_CREATE_MY = "wo_create_my"; + public const string RIGHTS_WO_CREATE_OTHER = "wo_create_other"; + public const string RIGHTS_WO_STATUS_MY = "wo_status_my"; + public const string RIGHTS_WO_STATUS_CREATED = "wo_status_created"; + public const string RIGHTS_WO_STATUS_OTHER = "wo_status_other"; + public const string RIGHTS_WO_DELETE_MY = "wo_delete_my"; + public const string RIGHTS_WO_DELETE_CREATED = "wo_delete_created"; + public const string RIGHTS_WO_DELETE_OTHER = "wo_delete_other"; + public const string RIGHTS_WO_REASSIGN_OTHER = "wo_reassign_other"; - public static string RIGHTS_PREFERENCE_VIEW_MY = "preference_view_my"; - public static string RIGHTS_PREFERENCE_VIEW_OTHER = "preference_view_other"; - public static string RIGHTS_PREFERENCE_EDIT_MY = "preference_edit_my"; - public static string RIGHTS_PREFERENCE_EDIT_OTHER = "preference_edit_other"; + public const string RIGHTS_USER_VIEW_MY = "user_view_my"; + public const string RIGHTS_USER_VIEW_OTHER = "user_view_other"; + public const string RIGHTS_USER_EDIT_MY = "user_edit_my"; + public const string RIGHTS_USER_EDIT_OTHER = "user_edit_other"; + public const string RIGHTS_USER_CREATE = "user_create"; + public const string RIGHTS_USER_DELETE = "user_delete"; - public static string RIGHTS_ROLE_VIEW_MY = "role_view_my"; - public static string RIGHTS_ROLE_VIEW_OTHER = "role_view_other"; - public static string RIGHTS_ROLE_EDIT = "role_edit"; - public static string RIGHTS_ROLE_EDIT_MY = "role_edit_my"; - public static string RIGHTS_ROLE_EDIT_USERS = "role_edit_users"; - public static string RIGHTS_ROLE_CREATE = "role_create"; - public static string RIGHTS_ROLE_DELETE = "role_delete"; + public const string RIGHTS_PREFERENCE_VIEW_MY = "preference_view_my"; + public const string RIGHTS_PREFERENCE_VIEW_OTHER = "preference_view_other"; + public const string RIGHTS_PREFERENCE_EDIT_MY = "preference_edit_my"; + public const string RIGHTS_PREFERENCE_EDIT_OTHER = "preference_edit_other"; - public static string RIGHTS_RIGHTS_VIEW = "rights_view"; + public const string RIGHTS_ROLE_VIEW_MY = "role_view_my"; + public const string RIGHTS_ROLE_VIEW_OTHER = "role_view_other"; + public const string RIGHTS_ROLE_EDIT = "role_edit"; + public const string RIGHTS_ROLE_EDIT_MY = "role_edit_my"; + public const string RIGHTS_ROLE_EDIT_USERS = "role_edit_users"; + public const string RIGHTS_ROLE_CREATE = "role_create"; + public const string RIGHTS_ROLE_DELETE = "role_delete"; - public static string RIGHTS_PRODUCT_VIEW = "product_view"; - public static string RIGHTS_PRODUCT_EDIT = "product_edit"; - public static string RIGHTS_PRODUCT_CREATE = "product_create"; - public static string RIGHTS_PRODUCT_DELETE = "product_delete"; + public const string RIGHTS_RIGHTS_VIEW = "rights_view"; - public static string RIGHTS_VERSION_VIEW = "version_view"; - public static string RIGHTS_VERSION_EDIT = "version_edit"; - public static string RIGHTS_VERSION_CREATE = "version_create"; - public static string RIGHTS_VERSION_HIDE = "version_hide"; + public const string RIGHTS_PRODUCT_VIEW = "product_view"; + public const string RIGHTS_PRODUCT_EDIT = "product_edit"; + public const string RIGHTS_PRODUCT_CREATE = "product_create"; + public const string RIGHTS_PRODUCT_DELETE = "product_delete"; - public static string RIGHTS_BUILD_VIEW = "build_view"; - public static string RIGHTS_BUILD_EDIT = "build_edit"; - public static string RIGHTS_BUILD_CREATE = "build_create"; - public static string RIGHTS_BUILD_HIDE = "build_hide"; + public const string RIGHTS_VERSION_VIEW = "version_view"; + public const string RIGHTS_VERSION_EDIT = "version_edit"; + public const string RIGHTS_VERSION_CREATE = "version_create"; + public const string RIGHTS_VERSION_HIDE = "version_hide"; - public static string RIGHTS_TESTPASS_VIEW = "testpass_view"; - public static string RIGHTS_TESTPASS_EDIT = "testpass_edit"; - public static string RIGHTS_TESTPASS_CREATE = "testpass_create"; - public static string RIGHTS_TESTPASS_HIDE = "testpass_hide"; + public const string RIGHTS_BUILD_VIEW = "build_view"; + public const string RIGHTS_BUILD_EDIT = "build_edit"; + public const string RIGHTS_BUILD_CREATE = "build_create"; + public const string RIGHTS_BUILD_HIDE = "build_hide"; + + public const string RIGHTS_TESTPASS_VIEW = "testpass_view"; + public const string RIGHTS_TESTPASS_EDIT = "testpass_edit"; + public const string RIGHTS_TESTPASS_CREATE = "testpass_create"; + public const string RIGHTS_TESTPASS_HIDE = "testpass_hide"; } public static class Help @@ -1656,5 +1659,30 @@ } return result; } + + public static void Tree_SetValue(TreeNode n, string key, string value) + { + string encodedValues = n.Value; + encodedValues = encodedValues + "|" + key + ":" + value; + n.Value = encodedValues; + } + + public static string Tree_GetValue(TreeNode n, string key) + { + string encodedValues = n.Value; + char[] delim = "|".ToCharArray(); + string[] split = null; + split = encodedValues.Split(delim); + delim = ":".ToCharArray(); + string[] kvPair = null; + foreach (string s in split) + { + kvPair = s.Split(delim); + if (kvPair[0] == key) + return kvPair[1]; + } + + return null; + } } } Modified: Website/Assignments.aspx =================================================================== --- Website/Assignments.aspx 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Assignments.aspx 2006-08-11 19:48:28 UTC (rev 310) @@ -1,13 +1,29 @@ -<%@ Page Language="C#" MasterPageFile="~/TCDB.master" AutoEventWireup="true" Title="TCDB: Assignments" %> +<%@ Page Language="C#" MasterPageFile="~/TCDB.master" AutoEventWireup="true" Title="TCDB: Assignments" + ClassName="TCDB.Page.Assignments" %> +<%@ Import Namespace="TCDB.Code" %> <%@ Register Src="~/Includes/AssignmentsTree.ascx" TagPrefix="assignment" TagName="Tree" %> <%@ Register Src="~/Includes/Assignments.ascx" TagPrefix="assignment" TagName="Form" %> - +<%@ Register Src="~/Includes/ActionItems.ascx" TagPrefix="assignment" TagName="ActionItem" %> +<%@ Register Src="~/Includes/ActionItems.ascx" TagPrefix="assignment" TagName="WorkOrder" %> <asp:Content ID="TreeContent" ContentPlaceHolderID="TreeContentPlaceHolder" runat="Server"> - <assignment:Tree runat="Server" ID="Tree" /> + <assignment:Tree runat="Server" ID="Tree" /> </asp:Content> <asp:Content ID="MainContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="Server"> + <% + string tab = Convert.ToString(Session["AssignmentTab_Name"]); + if (tab == Constants.CODE_AI) + { %> + <assignment:ActionItem runat="server" ID="ActionItem" /> + <% } + else if (tab == Constants.CODE_WO) + { %> + <assignment:WorkOrder runat="server" ID="WorkOrder" /> + <% } + else + { %> <assignment:Form ID="List" runat="server" /> + <% } %> </asp:Content> <asp:Content ID="NotesContent" ContentPlaceHolderID="NotesContentPlaceHolder" runat="Server"> </asp:Content> Modified: Website/Includes/ActionItems.ascx =================================================================== --- Website/Includes/ActionItems.ascx 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Includes/ActionItems.ascx 2006-08-11 19:48:28 UTC (rev 310) @@ -324,8 +324,8 @@ TypeName="tcdbDataSetTableAdapters.db_actionItemsTableAdapter" InsertMethod="Insert" UpdateMethod="Update" DeleteMethod="Delete"> <SelectParameters> - <asp:SessionParameter Name="actionItemID" SessionField="item_id" Type="Int32" /> - <asp:SessionParameter DefaultValue="" Name="active" SessionField="active" Type="Boolean" /> + <asp:SessionParameter Name="actionItemID" SessionField="AssignmentTab_item_id" Type="Int32" /> + <asp:SessionParameter DefaultValue="" Name="active" SessionField="AssignmentTab_active" Type="Boolean" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="name" Type="String" /> Modified: Website/Includes/ActionItems.ascx.cs =================================================================== --- Website/Includes/ActionItems.ascx.cs 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Includes/ActionItems.ascx.cs 2006-08-11 19:48:28 UTC (rev 310) @@ -20,30 +20,42 @@ public partial class ActionItems : SiteUserControl { private static Logger m_logg = new Logger("TCDB.ActionItems"); + private const string PREFIX = "AssignmentTab_"; private ActionItem ai; private String item_id = ""; private int productID = 0; private String mode = ""; + private bool current = false; protected void Page_Load(object sender, EventArgs e) { + if (Convert.ToString(Session[PREFIX + "Name"]) != Constants.CODE_AI) + { + current = false; + return; + } + else + { + current = true; + } + if (productID == 0) productID = Constants.PRODUCT_SITEID; // Load session data try { - item_id = Session[Constants.CODE_AI].ToString(); + item_id = Session[PREFIX + Constants.CODE_AI].ToString(); } catch { } try { - mode = Session[Constants.CODE_MODE].ToString(); + mode = Session[PREFIX + Constants.CODE_MODE].ToString(); } catch { } try { - productID = Convert.ToInt32(Session[Constants.CODE_PRODUCT]); + productID = Convert.ToInt32(Session[PREFIX + Constants.CODE_PRODUCT]); } catch { } @@ -59,18 +71,25 @@ } else { - ai = ActionItemDB.GetActionItem(Convert.ToInt32(item_id), active); + try + { + ai = ActionItemDB.GetActionItem(Convert.ToInt32(item_id), active); + } + catch { } if (ai != null && (!m_user.HasRight(Constants.RIGHTS_AI_VIEW_OTHER, productID) && !(ai.ASSIGNED.ID == m_user.ID && m_user.HasRight(Constants.RIGHTS_AI_VIEW_MY, productID)) && !(ai.CREATOR.ID == m_user.ID && m_user.HasRight(Constants.RIGHTS_AI_VIEW_CREATED, productID)))) + { + Response.Redirect("~/Assignments.aspx?" + Constants.CODE_USER + "=" + m_user.ID); + } } - Session.Add("item_id", item_id); - Session.Add("productID", productID); - Session.Add("tableName", "tcdb_actionItem"); + Session.Add(PREFIX + "item_id", item_id); + Session.Add(PREFIX + "productID", productID); + Session.Add(PREFIX + "tableName", "tcdb_actionItem"); if (mode == "new" && (m_user.HasRight(Constants.RIGHTS_AI_CREATE_MY) || m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER))) ActionItemsView.ChangeMode(FormViewMode.Insert); @@ -120,13 +139,13 @@ if (dateFinished.SelectedValue != null) { - dateFinished.ClearDateText = "Clear Date"; + dateFinished.ClearDateText = "Clear Date"; statusList.SelectedValue = statusList.Items.FindByText("Completed").Value; percentList.SelectedValue = "100"; } else { - dateFinished.ClearDateText = ""; + dateFinished.ClearDateText = ""; if (statusList.SelectedItem.Text == "Completed") statusList.SelectedValue = statusList.Items.FindByText("Active").Value; if (percentList.SelectedValue == "100") @@ -170,7 +189,7 @@ if (dateFinished.SelectedValue == null) dateFinished.SelectedValue = DateTime.Today; - dateFinished.ClearDateText = "Clear Date"; + dateFinished.ClearDateText = "Clear Date"; } } else @@ -191,7 +210,7 @@ CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); dateFinished.Clear(); dateFinished.PostedDate = ""; - dateFinished.ClearDateText = ""; + dateFinished.ClearDateText = ""; } } if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) @@ -229,7 +248,7 @@ CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); dateFinished.SelectedValue = DateTime.Today; - dateFinished.ClearDateText = "Clear Date"; + dateFinished.ClearDateText = "Clear Date"; } } else @@ -250,7 +269,7 @@ CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); dateFinished.Clear(); dateFinished.PostedDate = ""; - dateFinished.ClearDateText = ""; + dateFinished.ClearDateText = ""; } } @@ -269,6 +288,8 @@ protected void ActionItemsView_DataBound(object sender, EventArgs e) { + if (!current) return; + DataRowView data = (DataRowView)ActionItemsView.DataItem; if (ActionItemsView.CurrentMode == FormViewMode.Insert) @@ -303,22 +324,22 @@ Page.Title = "TCDB: " + data["name"].ToString(); if (ActionItemsView.CurrentMode == FormViewMode.Edit) { - CalendarPopup dateDue = (CalendarPopup)ActionItemsView.FindControl("dateDue"); - CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); + CalendarPopup dateDue = (CalendarPopup)ActionItemsView.FindControl("dateDue"); + CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); - if (data["dateFinished"].ToString() == "") + if (data["dateFinished"].ToString() == "") { - dateFinished.SelectedValue = null; - dateFinished.ClearDateText = " "; - dateFinished.Clear(); + dateFinished.SelectedValue = null; + dateFinished.ClearDateText = " "; + dateFinished.Clear(); } else - { - dateFinished.SelectedValue = (Nullable<DateTime>)data["dateFinished"]; - dateFinished.VisibleDate = dateFinished.SelectedDate; + { + dateFinished.SelectedValue = (Nullable<DateTime>)data["dateFinished"]; + dateFinished.VisibleDate = dateFinished.SelectedDate; + } + dateDue.VisibleDate = dateDue.SelectedDate; } - dateDue.VisibleDate = dateDue.SelectedDate; - } else { Label nameLabel = (Label)ActionItemsView.FindControl("nameLbl"); @@ -378,6 +399,8 @@ protected void statusList_Init(object sender, EventArgs e) { + if (!current) return; + DropDownList statusList = (DropDownList)sender; if (ai != null && @@ -388,6 +411,8 @@ } protected void percentList_Init(object sender, EventArgs e) { + if (!current) return; + RadioButtonList percentList = (RadioButtonList)sender; if (ai != null && @@ -398,6 +423,8 @@ } protected void dateFinished_Init(object sender, EventArgs e) { + if (!current) return; + CalendarPopup dateFinished = (CalendarPopup)sender; if (ai != null && @@ -408,18 +435,22 @@ } protected void NewButton_Init(object sender, EventArgs e) { + if (!current) return; + LinkButton newBtn = (LinkButton)sender; - Label newLbl = (Label)ActionItemsView.FindControl("newLbl"); + Label newLbl = (Label)ActionItemsView.FindControl("newLbl"); if (ai != null && !m_user.HasRight(Constants.RIGHTS_AI_CREATE_MY, Constants.PRODUCT_ANYID) && !m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER, Constants.PRODUCT_ANYID)) - { + { newBtn.Visible = false; - newLbl.Visible = false; + newLbl.Visible = false; + } } - } protected void EditButton_Init(object sender, EventArgs e) { + if (!current) return; + LinkButton editBtn = (LinkButton)sender; if (ai != null && @@ -430,21 +461,25 @@ } protected void DeleteButton_Init(object sender, EventArgs e) { + if (!current) return; + LinkButton deleteBtn = (LinkButton)sender; - Label deleteLbl = (Label)ActionItemsView.FindControl("deleteLbl"); - Label deletedLbl = (Label)ActionItemsView.FindControl("deletedLbl"); + Label deleteLbl = (Label)ActionItemsView.FindControl("deleteLbl"); + Label deletedLbl = (Label)ActionItemsView.FindControl("deletedLbl"); - if (deletedLbl.Visible || (ai != null && - !m_user.HasRight(Constants.RIGHTS_AI_DELETE_OTHER, productID) && - !(ai.ASSIGNED.ID == m_user.ID && m_user.HasRight(Constants.RIGHTS_AI_DELETE_MY, productID)) && - !(ai.CREATOR.ID == m_user.ID && m_user.HasRight(Constants.RIGHTS_AI_DELETE_CREATED, productID)))) - { + if (deletedLbl.Visible || (ai != null && + !m_user.HasRight(Constants.RIGHTS_AI_DELETE_OTHER, productID) && + !(ai.ASSIGNED.ID == m_user.ID && m_user.HasRight(Constants.RIGHTS_AI_DELETE_MY, productID)) && + !(ai.CREATOR.ID == m_user.ID && m_user.HasRight(Constants.RIGHTS_AI_DELETE_CREATED, productID)))) + { deleteBtn.Visible = false; - deleteLbl.Visible = false; + deleteLbl.Visible = false; + } } - } protected void assignedTo_Init(object sender, EventArgs e) { + if (!current) return; + DropDownList assignedTo = (DropDownList)sender; if (ai == null) ai = ActionItemDB.GetActionItem(Convert.ToInt32(item_id), active); @@ -461,15 +496,15 @@ { assignedTo.Enabled = true; - List<Product> products = ProductDB.GetProductList(true); + List<Product> products = ProductDB.GetProductList(true); tcdbDataSetTableAdapters.db_roleProductUserTableAdapter rpuAdapter = new tcdbDataSetTableAdapters.db_roleProductUserTableAdapter(); - foreach (Product product in products) + foreach (Product product in products) { - if ((ActionItemsView.CurrentMode == FormViewMode.Insert && m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER, product.ID)) || - (ActionItemsView.CurrentMode == FormViewMode.Edit && m_user.HasRight(Constants.RIGHTS_AI_REASSIGN_OTHER, ai.CREATOR, product.ID))) + if ((ActionItemsView.CurrentMode == FormViewMode.Insert && m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER, product.ID)) || + (ActionItemsView.CurrentMode == FormViewMode.Edit && m_user.HasRight(Constants.RIGHTS_AI_REASSIGN_OTHER, ai.CREATOR, product.ID))) { - tcdbDataSet.db_roleProductUserDataTable rpuTable = rpuAdapter.GetData(null, product.ID, true); + tcdbDataSet.db_roleProductUserDataTable rpuTable = rpuAdapter.GetData(null, product.ID, true); int lastID = -1; foreach (tcdbDataSet.db_roleProductUserRow rpuRow in rpuTable) @@ -487,6 +522,8 @@ } protected void activeBox_Init(object sender, EventArgs e) { + if (!current) return; + CheckBox activeBox = (CheckBox)sender; Label deletedLbl = (Label)ActionItemsView.FindControl("deletedLbl"); Modified: Website/Includes/AdministrationTree.ascx =================================================================== --- Website/Includes/AdministrationTree.ascx 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Includes/AdministrationTree.ascx 2006-08-11 19:48:28 UTC (rev 310) @@ -1,11 +1,11 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdministrationTree.ascx.cs" Inherits="TCDB.AdministrationTree" %> - +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdministrationTree.ascx.cs" + Inherits="TCDB.AdministrationTree" %> <asp:TreeView ID="AdminTree" runat="server" SelectedNodeStyle-CssClass="selectednode" - OnTreeNodePopulate="AdminTree_TreeNodePopulate" ExpandDepth="1" OnTreeNodeCollapsed="AdminTree_TreeNodeCollapsed" - OnTreeNodeExpanded="AdminTree_TreeNodeExpanded" OnInit="AdminTree_Init"> + OnTreeNodePopulate="AdminTree_TreeNodePopulate" OnTreeNodeCollapsed="AdminTree_TreeNodeCollapsed" + OnTreeNodeExpanded="AdminTree_TreeNodeExpanded" OnInit="AdminTree_Init" + OnSelectedNodeChanged="AdminTree_SelectedNodeChanged" ExpandDepth="1"> <Nodes> - <asp:TreeNode Text="Administration" Value="Users" PopulateOnDemand="True" SelectAction="Expand" - NavigateUrl="~/Administration.aspx" /> + <asp:TreeNode Text="Administration" Value="Admin" PopulateOnDemand="True" SelectAction="Expand" /> </Nodes> <SelectedNodeStyle CssClass="selectednode" /> -</asp:TreeView> \ No newline at end of file +</asp:TreeView> Modified: Website/Includes/AdministrationTree.ascx.cs =================================================================== --- Website/Includes/AdministrationTree.ascx.cs 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Includes/AdministrationTree.ascx.cs 2006-08-11 19:48:28 UTC (rev 310) @@ -15,6 +15,8 @@ { public partial class AdministrationTree : SiteUserControl { + private const string PREFIX = "AdministrationTree_"; + private const string PREFIX_TAB = "AdministrationTab_"; private static Logger m_logg = new Logger("TCDB.AdministrationTree"); protected void Page_Load(object sender, EventArgs e) @@ -30,6 +32,60 @@ if (Session["AdminNodes"] == null) Session.Add("AdminNodes", new ArrayList()); } + + protected void AdminTree_SelectedNodeChanged(object sender, EventArgs e) + { + TreeNode node = AdminTree.SelectedNode; + String nodeType = Help.Tree_GetValue(node, "NodeType"); + if (nodeType == null) nodeType = "Root"; + + String nodeValue = Help.Tree_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": + Response.Redirect("~/Administration.aspx"); + break; + case "Product": + Session[Constants.CODE_PRODUCT] = nodeValue; + Response.Redirect("~/Assignments.aspx"); + break; + case "User": + Session[Constants.CODE_USER] = nodeValue; + Session[Constants.CODE_PRODUCT] = Help.Tree_GetValue(node.Parent, "Value"); + try + { + if (bool.Parse(Help.Tree_GetValue(node, "IsCreated"))) + { + Session[Constants.CODE_MODE] = Constants.CODE_CREATED; + Session[Constants.CODE_PRODUCT] = Constants.PRODUCT_ANYID; + } + } + catch { } + Response.Redirect("~/Assignments.aspx"); + break; + case "Created": + 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 "WorkOrder": + Session[Constants.CODE_WO] = nodeValue; + Response.Redirect("~/WorkOrder.aspx"); + break; + default: + break; + } + // } + } + protected void AdminTree_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { ArrayList nodes = (ArrayList)Session["AdminNodes"]; @@ -58,7 +114,7 @@ // Create the new node. TreeNode newNode = new TreeNode(); newNode.Text = "<product>" + product.NAME + "</product>"; - newNode.Value = product.ID.ToString(); + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_PRODUCT, product.ID.ToString()); // Set the PopulateOnDemand property to true so that the child nodes can be // dynamically populated. @@ -66,7 +122,7 @@ // Set additional properties for the node. newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/Product.aspx?" + Constants.CODE_PRODUCT + "=" + newNode.Value; + newNode.NavigateUrl = "~/Product.aspx"; if (!product.ACTIVE) newNode.Text = "<font class='deleted'>" + newNode.Text + "</font>"; Modified: Website/Includes/Assignments.ascx =================================================================== --- Website/Includes/Assignments.ascx 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Includes/Assignments.ascx 2006-08-11 19:48:28 UTC (rev 310) @@ -8,10 +8,10 @@ <SelectParameters> <asp:Parameter Name="aType" Type="String" /> <asp:Parameter Name="finished" Type="Int32" /> - <asp:SessionParameter Name="assignedID" SessionField="uid" Type="Int32" /> - <asp:SessionParameter Name="creatorID" SessionField="myID" Type="Int32" /> + <asp:SessionParameter Name="assignedID" SessionField="AssignmentTree_u" Type="Int32" /> + <asp:SessionParameter Name="creatorID" SessionField="AssignmentTab_myID" Type="Int32" /> <asp:Parameter Name="highPriority" Type="Boolean" /> - <asp:SessionParameter DefaultValue="" Name="active" SessionField="active" Type="Boolean" /> + <asp:SessionParameter DefaultValue="" Name="active" SessionField="AssignmentTab_active" Type="Boolean" /> </SelectParameters> </asp:ObjectDataSource> <div id="Assignments"> Modified: Website/Includes/Assignments.ascx.cs =================================================================== --- Website/Includes/Assignments.ascx.cs 2006-08-11 19:46:14 UTC (rev 309) +++ Website/Includes/Assignments.ascx.cs 2006-08-11 19:48:28 UTC (rev 310) @@ -20,33 +20,44 @@ /// </summary> public partial class Assignments : SiteUserControl { + private const string PREFIX = "AssignmentTab_"; + private const string PREFIX_TREE = "AssignmentTree_"; private static Logger m_logg = new Logger("TCDB.Assignments"); private int uid = 0; - private String mode = null; + private string mode = null; private int productID = 0; private const int MAX_NAME_LENGTH = 30; + private bool current = false; protected void Page_Load(object sender, EventArgs e) { - Session.Remove("uid"); - Session.Remove("myID"); + if (Convert.ToString(Session[PREFIX + "Name"]) != Constants.CODE_ASSIGNMENT) + { + current = false; + return; + } + else + { + current = true; + } + m_logg.Debug("Loading assignments for [" + m_user.ToString() + "]"); // Load session data try { - uid = Convert.ToInt32(Session[Constants.CODE_USER]); + uid = Convert.ToInt32(Session[PREFIX_TREE + Constants.CODE_USER]); } catch { } try { - mode = Session[Constants.CODE_MODE].ToString(); + mode = Session[PREFIX_TREE + Constants.CODE_MODE].ToString(); } catch { } try { - productID = Convert.ToInt32(Session[Constants.CODE_PRODUCT]); + productID = Convert.ToInt32(Session[PREFIX_TREE + Constants.CODE_PRODUCT]); } catch { } @@ -120,12 +131,14 @@ } } if (mode == Constants.CODE_CREATED) - Session["myID"] = m_user.ID; + Session[PREFIX + "myID"] = m_user.ID; if (uid != 0) - Session.Add("uid", uid); + Session.Add(PREFIX_TREE + Constants.CODE_USER, uid); + else + Session.Remove(PREFIX_TREE + Constants.CODE_USER); m_logg.Debug("Databinding the AssignmentsGridView"); - if (Session["refresh"] != null) + if (Session[PREFIX + "refresh"] != null) AssignmentsGridView.DataBind(); } @@ -299,22 +312,22 @@ // update Session if (date.ID == "toDate") - Session["toDate"] = date.SelectedDate; + Session[PREFIX + "toDate"] = date.SelectedDate; else if (date.ID == "fromDate") - Session["fromDate"] = date.SelectedDate; + Session[PREFIX + "fromDate"] = date.SelectedDate; else if (date.ID == "toDueDate") - Session["toDueDate"] = date.SelectedDate; + Session[PREFIX + "toDueDate"] = date.SelectedDate; else if (date.ID == "fromDueDate") - Session["fromDueDate"] = date.SelectedDate; + Session[PREFIX + "fromDueDate"] = date.SelectedDate; else if (date.ID == "toFinishedDate") - Session["toFinishedDate"] = date.SelectedDate; + Session[PREFIX + "toFinishedDate"] = date.SelectedDate; else if (date.ID == "fromFinishedDate") - Session["fromFinishedDate"] = date.SelectedDate; + Session[PREFIX + "fromFinishedDate"] = date.SelectedDate; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } - + /* protected String getURL(int cid, String type, String name) { String displayName; @@ -332,31 +345,36 @@ m_logg.Error("Bad Assignment type. Can't display URL"); return ""; } - } + }*/ + protected void AssignmentsGridView_Sorted(object sender, EventArgs e) { - Session["refresh"] = true; + Session[PREFIX + "refresh"] = true; //foreach (GridViewRow row in AssignmentsGridView.Rows) // filter(row); } protected void AssignmentsGridView_DataBinding(object sender, EventArgs e) { - if (Session["refresh"] != null) + if (!current) return; + + if (Session[PREFIX + "refresh"] != null) { AssignmentsGridView.Visible = true; NoAssignments.Visible = false; - Session["rows"] = 0; + Session[PREFIX + "rows"] = 0; } } protected void AssignmentsGridView_DataBound(object sender, EventArgs e) { - if (Session["refresh"] != null) + if (!current) return; + + if (Session[PREFIX + "refresh"] != null) { - Session.Remove("refresh"); + Session.Remove(PREFIX + "refresh"); // TODO: Figure out how to dynamically set the column head here but still have it linkable/sortable //AssignmentsGridView.Columns[0].HeaderText = "<div class=\"priority_high\" />"; - int rows = Convert.ToInt32(Session["rows"]); + int rows = Convert.ToInt32(Session[PREFIX + "rows"]); if (rows < 2) { AssignmentsGridView.Visible = false; @@ -368,11 +386,13 @@ } protected void AssignmentsGridView_RowDataBound(object sender, GridViewRowEventArgs e) { - if (Session["refresh"] != null) + if (!current) return; + + if (Session[PREFIX + "refresh"] != null) { e.Row.Visible = filter(e.Row); if (e.Row.Visible) - Session["rows"] = Convert.ToInt32(Session["rows"]) + 1; + Session[PREFIX + "rows"] = Convert.ToInt32(Session[PREFIX + "rows"]) + 1; } } protected void AssignmentsGridView_RowCommand(object sender, GridViewCommandEventArgs e) @@ -385,13 +405,14 @@ if (type == Constants.CODE_AI) { - - Session[Constants.CODE_AI] = childID; + Session[PREFIX + "Name"] = Constants.CODE_AI; + Session[PREFIX + Constants.CODE_AI] = childID; Response.Redirect("~/ActionItem.aspx"); } else if (type == Constants.CODE_WO) { - Session[Constants.CODE_WO] = childID; + Session[PREFIX + "Name"] = Constants.CODE_AI; + Session[PREFIX + Constants.CODE_WO] = childID; Response.Redirect("~/WorkOrder.aspx"); } } @@ -412,11 +433,11 @@ woStatusList.Items.FindByText("Completed").Selected = false; } // update Session - Session["showCompleted"] = cboShowCompleted.Checked; - Session["showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; - Session["showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; + Session[PREFIX + "showCompleted"] = cboShowCompleted.Checked; + Session[PREFIX + "showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; + Session[PREFIX + "showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); Response.Redirect(Request.RawUrl); } protected void cboStatusFilter_CheckedChanged(object sender, EventArgs e) @@ -431,9 +452,9 @@ aiStatusList.Enabled = false; woStatusList.Enabled = false; } - Session["filterStatus"] = cboStatusFilter.Checked; + Session[PREFIX + "filterStatus"] = cboStatusFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void aiStatusList_SelectedIndexChanged(object sender, EventArgs e) @@ -444,13 +465,13 @@ cboShowCompleted.Checked = false; // update Session - Session["showAIActive"] = aiStatusList.Items.FindByText("Active").Selected; - Session["showAIInactive"] = aiStatusList.Items.FindByText("Inactive").Selected; - Session["showAINotStarted"] = aiStatusList.Items.FindByText("Not Started").Selected; - Session["showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; - Session["showCompleted"] = cboShowCompleted.Checked; + Session[PREFIX + "showAIActive"] = aiStatusList.Items.FindByText("Active").Selected; + Session[PREFIX + "showAIInactive"] = aiStatusList.Items.FindByText("Inactive").Selected; + Session[PREFIX + "showAINotStarted"] = aiStatusList.Items.FindByText("Not Started").Selected; + Session[PREFIX + "showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; + Session[PREFIX + "showCompleted"] = cboShowCompleted.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); Response.Redirect(Request.RawUrl); } protected void woStatusList_SelectedIndexChanged(object sender, EventArgs e) @@ -460,13 +481,13 @@ else cboShowCompleted.Checked = false; // update Session - Session["showWOActive"] = woStatusList.Items.FindByText("Active").Selected; - Session["showWOInactive"] = woStatusList.Items.FindByText("Inactive").Selected; - Session["showWONotStarted"] = woStatusList.Items.FindByText("Not Started").Selected; - Session["showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; - Session["showCompleted"] = cboShowCompleted.Checked; + Session[PREFIX + "showWOActive"] = woStatusList.Items.FindByText("Active").Selected; + Session[PREFIX + "showWOInactive"] = woStatusList.Items.FindByText("Inactive").Selected; + Session[PREFIX + "showWONotStarted"] = woStatusList.Items.FindByText("Not Started").Selected; + Session[PREFIX + "showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; + Session[PREFIX + "showCompleted"] = cboShowCompleted.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboTypeFilter_CheckedChanged(object sender, EventArgs e) @@ -481,46 +502,46 @@ cboShowActionItems.Enabled = false; cboShowWorkOrders.Enabled = false; } - Session["filterType"] = cboTypeFilter.Checked; - Session["showActionItems"] = cboShowActionItems.Checked; - Session["showWorkOrders"] = cboShowWorkOrders.Checked; + Session[PREFIX + "filterType"] = cboTypeFilter.Checked; + Session[PREFIX + "showActionItems"] = cboShowActionItems.Checked; + Session[PREFIX + "showWorkOrders"] = cboShowWorkOrders.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboShowActionItems_CheckedChanged(object sender, EventArgs e) { - Session["showActionItems"] = cboShowActionItems.Checked; + Session[PREFIX + "showActionItems"] = cboShowActionItems.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboShowWorkOrders_CheckedChanged(object sender, EventArgs e) { - Session["showWorkOrders"] = cboShowWorkOrders.Checked; + Session[PREFIX + "showWorkOrders"] = cboShowWorkOrders.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboDateFilter_CheckedChanged(object sender, EventArgs e) { - Session["filterAssignedDate"] = cboDateFilter.Checked; + Session[PREFIX + "filterAssignedDate"] = cboDateFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboDueFilter_CheckedChanged(object sender, EventArgs e) { - Session["filterDueDate"] = cboDueFilter.Checked; + Session[PREFIX + "filterDueDate"] = cboDueFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboFinishedFilter_CheckedChanged(object sender, EventArgs e) { - Session["filterFinishedDate"] = cboFinishedFilter.Checked; + Session[PREFIX + "filterFinishedDate"] = cboFinishedFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboPriorityFilter_CheckedChanged(object sender, EventArgs e) @@ -535,297 +556,337 @@ cboHighPriority.Enabled = false; cboLowPriority.Enabled = false; } - Session["filterPriority"] = cboPriorityFilter.Checked; + Session[PREFIX + "filterPriority"] = cboPriorityFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboHighPriority_CheckedChanged(object sender, EventArgs e) { - Session["showHighPriority"] = cboPriorityFilter.Checked; + Session[PREFIX + "showHighPriority"] = cboPriorityFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void cboLowPriority_CheckedChanged(object sender, EventArgs e) { - Session["showLowPriority"] = cboPriorityFilter.Checked; + Session[PREFIX + "showLowPriority"] = cboPriorityFilter.Checked; - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); AssignmentsGridView.DataBind(); } protected void aiStatusList_DataBound(object sender, EventArgs e) { + if (!current) return; + if (!IsPostBack) { - if (Session["showAIActive"] == null) + if (Session[PREFIX + "showAIActive"] == null) { aiStatusList.Items.FindByText("Active").Selected = m_user.GetConfigBool("filter_show_ai_active"); - Session["showAIActive"] = aiStatusList.Items.FindByText("Active").Selected; + Session[PREFIX + "showAIActive"] = aiStatusList.Items.FindByText("Active").Selected; } else - aiStatusList.Items.FindByText("Active").Selected = Convert.ToBoolean(Session["showAIActive"]); - if (Session["showAIInactive"] == null) + aiStatusList.Items.FindByText("Active").Selected = Convert.ToBoolean(Session[PREFIX + "showAIActive"]); + if (Session[PREFIX + "showAIInactive"] == null) { aiStatusList.Items.FindByText("Inactive").Selected = m_user.GetConfigBool("filter_show_ai_inactive"); - Session["showAIInactive"] = aiStatusList.Items.FindByText("Inactive").Selected; + Session[PREFIX + "showAIInactive"] = aiStatusList.Items.FindByText("Inactive").Selected; } else - aiStatusList.Items.FindByText("Inactive").Selected = Convert.ToBoolean(Session["showAIInactive"]); - if (Session["showAICompleted"] == null) + aiStatusList.Items.FindByText("Inactive").Selected = Convert.ToBoolean(Session[PREFIX + "showAIInactive"]); + if (Session[PREFIX + "showAICompleted"] == null) { aiStatusList.Items.FindByText("Completed").Selected = m_user.GetConfigBool("filter_show_ai_complete"); - Session["showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; + Session[PREFIX + "showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; } else - aiStatusList.Items.FindByText("Completed").Selected = Convert.ToBoolean(Session["showAICompleted"]); - if (Session["showAINotStarted"] == null) + aiStatusList.Items.FindByText("Completed").Selected = Convert.ToBoolean(Session[PREFIX + "showAICompleted"]); + if (Session[PREFIX + "showAINotStarted"] == null) { aiStatusList.Items.FindByText("Not Started").Selected = m_user.GetConfigBool("filter_show_ai_not_started"); - Session["showAINotStarted"] = aiStatusList.Items.FindByText("Not Started").Selected; + Session[PREFIX + "showAINotStarted"] = aiStatusList.Items.FindByText("Not Started").Selected; } else - aiStatusList.Items.FindByText("Not Started").Selected = Convert.ToBoolean(Session["showAINotStarted"]); + aiStatusList.Items.FindByText("Not Started").Selected = Convert.ToBoolean(Session[PREFIX + "showAINotStarted"]); - if (Session["refresh"] != null) + if (Session[PREFIX + "refresh"] != null) AssignmentsGridView.DataBind(); else - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); } } protected void woStatusList_DataBound(object sender, EventArgs e) { + if (!current) return; + if (!IsPostBack) { - if (Session["showWOActive"] == null) + if (Session[PREFIX + "showWOActive"] == null) { woStatusList.Items.FindByText("Active").Selected = m_user.GetConfigBool("filter_show_wo_active"); - Session["showWOActive"] = woStatusList.Items.FindByText("Active").Selected; + Session[PREFIX + "showWOActive"] = woStatusList.Items.FindByText("Active").Selected; } else - woStatusList.Items.FindByText("Active").Selected = Convert.ToBoolean(Session["showWOActive"]); - if (Session["showWOInactive"] == null) + woStatusList.Items.FindByText("Active").Selected = Convert.ToBoolean(Session[PREFIX + "showWOActive"]); + if (Session[PREFIX + "showWOInactive"] == null) { woStatusList.Items.FindByText("Inactive").Selected = m_user.GetConfigBool("filter_show_wo_inactive"); - Session["showWOInactive"] = woStatusList.Items.FindByText("Inactive").Selected; + Session[PREFIX + "showWOInactive"] = woStatusList.Items.FindByText("Inactive").Selected; } else - woStatusList.Items.FindByText("Inactive").Selected = Convert.ToBoolean(Session["showWOInactive"]); - if (Session["showWOCompleted"] == null) + woStatusList.Items.FindByText("Inactive").Selected = Convert.ToBoolean(Session[PREFIX + "showWOInactive"]); + if (Session[PREFIX + "showWOCompleted"] == null) { woStatusList.Items.FindByText("Completed").Selected = m_user.GetConfigBool("filter_show_wo_completed"); - Session["showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; + Session[PREFIX + "showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; } else - woStatusList.Items.FindByText("Completed").Selected = Convert.ToBoolean(Session["showWOCompleted"]); - if (Session["showWONotStarted"] == null) + woStatusList.Items.FindByText("Completed").Selected = Convert.ToBoolean(Session[PREFIX + "showWOCompleted"]); + if (Session[PREFIX + "showWONotStarted"] == null) { woStatusList.Items.FindByText("Not Started").Selected = m_user.GetConfigBool("filter_show_wo_not_started"); - Session["showWONotStarted"] = woStatusList.Items.FindByText("Not Started").Selected; + Session[PREFIX + "showWONotStarted"] = woStatusList.Items.FindByText("Not Started").Selected; } else - woStatusList.Items.FindByText("Not Started").Selected = Convert.ToBoolean(Session["showWONotStarted"]); + woStatusList.Items.FindByText("Not Started").Selected = Convert.ToBoolean(Session[PREFIX + "showWONotStarted"]); - if (Session["refresh"] != null) + if (Session[PREFIX + "refresh"] != null) AssignmentsGridView.DataBind(); else - Session.Add("refresh", true); + Session.Add(PREFIX + "refresh", true); } } protected void toDate_Init(object sender, EventArgs e) { + if (!current) return; + if (!IsPostBack) { - if (Session["toDate"] == null) + if (Session[PREFIX + "toDate"] == null) { toDate.SelectedDate = m_user.GetConfigDate("filter_show_to_assigned_date"); - Session["toD... [truncated message content] |