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

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_TODOLIST_VIEW"]) && Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_TODOLIST_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["toDo_id"] == null) || ((string)Request.QueryString["action"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in toDoList_activity.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfToDoId.Value = Request.QueryString["toDo_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 currentToDoId = Int32.Parse(hdfToDoId.Value.ToString());

                Session.Remove("activityInformationDummy");

                // ... toDoList_navigator2.aspx
                if (Request.QueryString["source_page"] == "toDoList_navigator2.aspx")
                {
                    StoreNavigatorState();
                    toDoListInformationTDS = new ToDoListInformationTDS();
                    activityInformation = new ToDoListInformationTDS.ActivityInformationDataTable();

                    ToDoListInformationBasicInformation toDoListInformationBasicInformation = new ToDoListInformationBasicInformation(toDoListInformationTDS);
                    toDoListInformationBasicInformation.LoadAllByToDoId(currentToDoId, companyId);

                    ToDoListInformationBasicInformationGateway toDoListInformationBasicInformationGatewayForState = new ToDoListInformationBasicInformationGateway(toDoListInformationBasicInformation.Data);
                    string state = toDoListInformationBasicInformationGatewayForState.GetState(currentToDoId);
                    if (state == "Completed") hdfCompleted.Value = "True";

                    ToDoListInformationActivityInformation toDoListInformationActivityInformation = new ToDoListInformationActivityInformation(toDoListInformationTDS);
                    toDoListInformationActivityInformation.LoadAllByToDoId(currentToDoId, companyId);

                    // Store dataset
                    Session["toDoListInformationTDS"] = toDoListInformationTDS;
                    Session["activityInformation"] = activityInformation;
                }

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

                    // Restore dataset
                    toDoListInformationTDS = (ToDoListInformationTDS)Session["toDoListInformationTDS"];
                    activityInformation = (ToDoListInformationTDS.ActivityInformationDataTable)Session["activityInformation"];

                    if (ViewState["update"].ToString().Trim() == "yes")
                    {
                        ToDoListInformationBasicInformation toDoListInformationBasicInformation = new ToDoListInformationBasicInformation(toDoListInformationTDS);
                        toDoListInformationBasicInformation.LoadAllByToDoId(currentToDoId, companyId);

                        ToDoListInformationBasicInformationGateway toDoListInformationBasicInformationGatewayForState = new ToDoListInformationBasicInformationGateway(toDoListInformationBasicInformation.Data);
                        string state = toDoListInformationBasicInformationGatewayForState.GetState(currentToDoId);
                        if (state == "Completed") hdfCompleted.Value = "True";

                        ToDoListInformationActivityInformation toDoListInformationActivityInformation = new ToDoListInformationActivityInformation(toDoListInformationTDS);
                        toDoListInformationActivityInformation.LoadAllByToDoId(currentToDoId, companyId);

                        // Store dataset
                        Session["toDoListInformationTDS"] = toDoListInformationTDS;
                        Session["activityInformation"] = activityInformation;
                    }
                }

                // Prepare initial data
                // ... for subject
                ToDoListInformationBasicInformationGateway toDoListInformationBasicInformationGateway = new ToDoListInformationBasicInformationGateway();
                toDoListInformationBasicInformationGateway.LoadAllByToDoId(currentToDoId, companyId);
                lblTitleSubjectName.Text = " " + toDoListInformationBasicInformationGateway.GetSubject(currentToDoId);

                // ... Data for current to do list
                LoadToDoListData(currentToDoId, companyId);
            }
            else
            {
                // Restore datasets
                toDoListInformationTDS = (ToDoListInformationTDS)Session["toDoListInformationTDS"];
                activityInformation = (ToDoListInformationTDS.ActivityInformationDataTable)Session["activityInformation"];
            }
        }
 /// <summary>
 /// InitData
 /// </summary>
 protected override void InitData()
 {
     _data = new ToDoListInformationTDS();
 }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_TODOLIST_VIEW"]) && Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_TODOLIST_DELETE"])))
                {
                    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["toDo_id"] == null) || ((string)Request.QueryString["dashboard"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in toDoList_delete.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfToDoListId.Value = Request.QueryString["toDo_id"].ToString();
                hdfDashboard.Value = Request.QueryString["dashboard"].ToString();
                hdfFmType.Value = "ToDoList";

                // If comming from
                // ... toDoList_navigator2.aspx
                if (Request.QueryString["source_page"] == "toDoList_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    toDolistInformationTDS = new ToDoListInformationTDS();
                    toDoListTDS = new ToDoListTDS();

                    int toDolistId = Int32.Parse(hdfToDoListId.Value);
                    int companyId = Int32.Parse(hdfCompanyId.Value);

                    ToDoListInformationBasicInformation toDolistInformationBasicInformation = new ToDoListInformationBasicInformation(toDolistInformationTDS);
                    toDolistInformationBasicInformation.LoadAllByToDoId(toDolistId, companyId);

                    ToDoListInformationActivityInformation toDoListInformationActivityInformation = new ToDoListInformationActivityInformation(toDolistInformationTDS);
                    toDoListInformationActivityInformation.LoadAllByToDoId(toDolistId, companyId);

                    // Store dataset
                    Session["toDolistInformationTDS"] = toDolistInformationTDS;
                    Session["toDoListTDS"] = toDoListTDS;
                }

                // ... toDoList_summary.aspx
                if (Request.QueryString["source_page"] == "toDoList_summary.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    toDoListTDS = (ToDoListTDS)Session["toDoListTDS"];
                    toDolistInformationTDS = (ToDoListInformationTDS)Session["toDolistInformationTDS"];
                }
            }
            else
            {
                // Restore datasets
                toDoListTDS = (ToDoListTDS)Session["toDoListTDS"];
                toDolistInformationTDS = (ToDoListInformationTDS)Session["toDolistInformationTDS"];
            }
        }