Example #1
0
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// and ItemID of the task to display.
        /// It then uses the Rainbow.TasksDB() data component
        /// to populate the page's edit controls with the task details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Verify that the current user has access to edit this module
            if (Rainbow.Security.PortalSecurity.HasEditPermissions(ModuleID))
            {
                EditLink  = "<a href= \"TasksEdit.aspx?ItemID=" + ItemID;
                EditLink += "&mID=" + ModuleID + "\" class=\"Normal\">Edit</a>";
            }

            if (Page.IsPostBack == false)
            {
                //Chris Farrell, [email protected], 5/28/04.
                //Improper Identity seed in the ItemID means that there may be tasks
                //with a ItemID = 0.  This is not the way it should be, but there is no
                //reason to NOT show the task with ItemID = 0 and that helps reduce
                //the pains from this bug for users who already have data present.

                // Obtain a single row of Task information
                TasksDB       Tasks = new TasksDB();
                SqlDataReader dr    = Tasks.GetSingleTask(ItemID);

                try
                {
                    // Read first row from database
                    if (dr.Read())
                    {
                        TitleField.Text           = (string)dr["Title"];
                        longdesc.Text             = (string)dr["Description"];
                        StartField.Text           = ((DateTime)dr["StartDate"]).ToShortDateString();
                        DueField.Text             = ((DateTime)dr["DueDate"]).ToShortDateString();
                        CreatedBy.Text            = (string)dr["CreatedByUser"];
                        ModifiedBy.Text           = (string)dr["ModifiedByUser"];
                        PercentCompleteField.Text = ((Int32)dr["PercentComplete"]).ToString();
                        AssignedField.Text        = (string)dr["AssignedTo"];
                        CreatedDate.Text          = ((DateTime)dr["CreatedDate"]).ToString();
                        ModifiedDate.Text         = ((DateTime)dr["ModifiedDate"]).ToString();
                        StatusField.Text          = Esperantus.Localize.GetString("TASK_STATE_" + (string)dr["Status"], (string)dr["Status"], StatusField);
                        PriorityField.Text        = Esperantus.Localize.GetString("TASK_PRIORITY_" + (string)dr["Priority"], (string)dr["Priority"], PriorityField);
                        // 15/7/2004 added localization by Mario Endara [email protected]
                        if (CreatedBy.Text == "unknown")
                        {
                            CreatedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                        }
                        // 15/7/2004 added localization by Mario Endara [email protected]
                        if (ModifiedBy.Text == "unknown")
                        {
                            ModifiedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                        }
                    }
                }
                finally
                {
                    dr.Close();
                }
            }
        }
Example #2
0
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// and ItemID of the task to edit.
        /// It then uses the Rainbow.TasksDB() data component
        /// to populate the page's edit controls with the task details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // If the page is being requested the first time, determine if an
            // task itemID value is specified, and if so populate page
            // contents with the task details

            //Chris Farrell, [email protected], 5/28/04
            //Added support for Rainbow WYSIWYG editors.
            //Editor placeholder setup
            Rainbow.UI.DataTypes.HtmlEditorDataType h = new Rainbow.UI.DataTypes.HtmlEditorDataType();
            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText = h.GetEditor(DescriptionField, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()), portalSettings);

            DesktopText.Width  = new System.Web.UI.WebControls.Unit(moduleSettings["Width"].ToString());
            DesktopText.Height = new System.Web.UI.WebControls.Unit(moduleSettings["Height"].ToString());
            //end Chris Farrell changes, 5/28/04


            //Set right popup url
            StartField.xPopupURL = Rainbow.Settings.Path.ApplicationRoot + "/DesktopModules/DateTextBox/popupcalendar.aspx";
            StartField.xImageURL = Rainbow.Settings.Path.ApplicationRoot + "/DesktopModules/DateTextBox/calendar.jpg";
            DueField.xPopupURL   = Rainbow.Settings.Path.ApplicationRoot + "/DesktopModules/DateTextBox/popupcalendar.aspx";
            DueField.xImageURL   = Rainbow.Settings.Path.ApplicationRoot + "/DesktopModules/DateTextBox/calendar.jpg";

            if (Page.IsPostBack == false)
            {
                StartField.Text = DateTime.Now.ToShortDateString();
                DueField.Text   = DateTime.Now.ToShortDateString();
                AddListItem("TASK_STATE_0", "Not Started", StatusField);
                AddListItem("TASK_STATE_1", "In Progress", StatusField);
                AddListItem("TASK_STATE_2", "Complete", StatusField);
                StatusField.SelectedIndex = 0;
                AddListItem("TASK_PRIORITY_0", "High", PriorityField);
                AddListItem("TASK_PRIORITY_1", "Normal", PriorityField);
                AddListItem("TASK_PRIORITY_2", "Low", PriorityField);

                PriorityField.SelectedIndex = 1;
                if (ItemID != 0)
                {
                    // Obtain a single row of Task information
                    TasksDB       Tasks = new TasksDB();
                    SqlDataReader dr    = Tasks.GetSingleTask(ItemID);

                    try
                    {
                        // Read first row from database
                        if (dr.Read())
                        {
                            TitleField.Text             = (string)dr["Title"];
                            StartField.Text             = ((DateTime)dr["StartDate"]).ToShortDateString();
                            DueField.Text               = ((DateTime)dr["DueDate"]).ToShortDateString();
                            CreatedBy.Text              = (string)dr["CreatedByUser"];
                            ModifiedBy.Text             = (string)dr["ModifiedByUser"];
                            PercentCompleteField.Text   = ((Int32)dr["PercentComplete"]).ToString();
                            AssignedField.Text          = (string)dr["AssignedTo"];
                            CreatedDate.Text            = ((DateTime)dr["CreatedDate"]).ToString();
                            ModifiedDate.Text           = ((DateTime)dr["ModifiedDate"]).ToString();
                            StatusField.SelectedIndex   = Convert.ToInt16((string)dr["Status"]);
                            PriorityField.SelectedIndex = Convert.ToInt16((string)dr["Priority"]);
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedBy.Text == "unknown")
                            {
                                CreatedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (ModifiedBy.Text == "unknown")
                            {
                                ModifiedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }

                            //Chris Farrell, [email protected], 5/28/04
                            //DescriptionField.Text = (string) dr["Description"];
                            DesktopText.Text = (string)dr["Description"];
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                }
                else                 //default for new
                {
                    AssignedField.Text = moduleSettings["TASKS_DEFAULT_ASSIGNEE"].ToString();
                }
            }
        }