// ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        public SupportTicketInformationTDS.ActivityInformationDataTable GetToDoNew()
        {
            activityInformation = (SupportTicketInformationTDS.ActivityInformationDataTable)Session["activityInformationDummyForST"];

            if (activityInformation == null)
            {
                activityInformation = ((SupportTicketInformationTDS)Session["supportTicketInformationTDS"]).ActivityInformation;
            }

            return activityInformation;
        }
        protected void AddToDoNewEmptyFix(GridView grdSupportTicket)
        {
            if (grdSupportTicket.Rows.Count == 0)
            {
                int companyId = Int32.Parse(hdfCompanyId.Value);
                SupportTicketInformationTDS.ActivityInformationDataTable dt = new SupportTicketInformationTDS.ActivityInformationDataTable();
                dt.AddActivityInformationRow(-1, -1, "", DateTime.Now, -1, "", false, companyId, false, "", false);
                Session["activityInformationDummyForST"] = dt;
                grdSupportTicket.DataBind();
            }

            // normally executes at all postbacks
            if (grdSupportTicket.Rows.Count == 1)
            {
                SupportTicketInformationTDS.ActivityInformationDataTable dt = (SupportTicketInformationTDS.ActivityInformationDataTable)Session["activityInformationDummyForST"];
                if (dt != null)
                {
                    grdSupportTicket.Rows[0].Visible = false;
                    grdSupportTicket.Rows[0].Controls.Clear();

                    Session.Remove("activityInformationDummyForST");
                }
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_ITTST_SUPPORTTICKET_ADMIN"])))
                {
                    if (!(Convert.ToBoolean(Session["sgLFS_ITTST_SUPPORTTICKET_VIEW"]) && Convert.ToBoolean(Session["sgLFS_ITTST_SUPPORTTICKET_EDIT"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["supportTicket_id"] == null) || ((string)Request.QueryString["action"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in supportTicket_activity.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfSupportTicketId.Value = Request.QueryString["supportTicket_id"].ToString();
                hdfAction.Value = Request.QueryString["action"].ToString();
                hdfDashboard.Value = Request.QueryString["dashboard"].ToString();

                // If coming from
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int currentSupportTicketId = Int32.Parse(hdfSupportTicketId.Value.ToString());

                Session.Remove("activityInformationDummyForST");

                // ... supportTicket_navigator2.aspx
                if (Request.QueryString["source_page"] == "supportTicket_navigator2.aspx")
                {
                    StoreNavigatorState();
                    supportTicketInformationTDS = new SupportTicketInformationTDS();
                    activityInformation = new SupportTicketInformationTDS.ActivityInformationDataTable();

                    SupportTicketInformationBasicInformation supportTicketInformationBasicInformation = new SupportTicketInformationBasicInformation(supportTicketInformationTDS);
                    supportTicketInformationBasicInformation.LoadAllBySupportTicketId(currentSupportTicketId, companyId);

                    SupportTicketInformationBasicInformationGateway supportTicketInformationBasicInformationGatewayForState = new SupportTicketInformationBasicInformationGateway(supportTicketInformationBasicInformation.Data);
                    string state = supportTicketInformationBasicInformationGatewayForState.GetState(currentSupportTicketId);
                    if (state == "Completed") hdfCompleted.Value = "True";

                    SupportTicketInformationActivityInformation supportTicketInformationActivityInformation = new SupportTicketInformationActivityInformation(supportTicketInformationTDS);
                    supportTicketInformationActivityInformation.LoadAllBySupportTicketId(currentSupportTicketId, companyId);

                    // Store dataset
                    Session["supportTicketInformationTDS"] = supportTicketInformationTDS;
                    Session["activityInformationForST"] = activityInformation;
                }

                // ... supportTicket_summary.aspx or supportTicket_edit.aspx
                if ((Request.QueryString["source_page"] == "supportTicket_summary.aspx") || (Request.QueryString["source_page"] == "supportTicket_edit.aspx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    supportTicketInformationTDS = (SupportTicketInformationTDS)Session["supportTicketInformationTDS"];
                    activityInformation = (SupportTicketInformationTDS.ActivityInformationDataTable)Session["activityInformationForST"];

                    if (ViewState["update"].ToString().Trim() == "yes")
                    {
                        SupportTicketInformationBasicInformation supportTicketInformationBasicInformation = new SupportTicketInformationBasicInformation(supportTicketInformationTDS);
                        supportTicketInformationBasicInformation.LoadAllBySupportTicketId(currentSupportTicketId, companyId);

                        SupportTicketInformationBasicInformationGateway supportTicketInformationBasicInformationGatewayForState = new SupportTicketInformationBasicInformationGateway(supportTicketInformationBasicInformation.Data);
                        string state = supportTicketInformationBasicInformationGatewayForState.GetState(currentSupportTicketId);
                        if (state == "Completed") hdfCompleted.Value = "True";

                        SupportTicketInformationActivityInformation supportTicketInformationActivityInformation = new SupportTicketInformationActivityInformation(supportTicketInformationTDS);
                        supportTicketInformationActivityInformation.LoadAllBySupportTicketId(currentSupportTicketId, companyId);

                        // Store dataset
                        Session["supportTicketInformationTDS"] = supportTicketInformationTDS;
                        Session["activityInformationForST"] = activityInformation;
                    }
                }

                // Prepare initial data
                // ... for subject
                SupportTicketInformationBasicInformationGateway supportTicketInformationBasicInformationGateway = new SupportTicketInformationBasicInformationGateway();
                supportTicketInformationBasicInformationGateway.LoadAllBySupportTicketId(currentSupportTicketId, companyId);
                lblTitleSubjectName.Text = " " + supportTicketInformationBasicInformationGateway.GetSubject(currentSupportTicketId);

                // ... Data for current to do list
                LoadSupportTicketData(currentSupportTicketId, companyId);
            }
            else
            {
                // Restore datasets
                supportTicketInformationTDS = (SupportTicketInformationTDS)Session["supportTicketInformationTDS"];
                activityInformation = (SupportTicketInformationTDS.ActivityInformationDataTable)Session["activityInformationForST"];
            }
        }