Beispiel #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Editor placeholder setup
            Rainbow.UI.DataTypes.HtmlEditorDataType h = new Rainbow.UI.DataTypes.HtmlEditorDataType();
            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText = h.GetEditor(PlaceHolderHTMLEditor, 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());


            //  Determine itemID of FAQ to Update
            if (Request.Params["itemID"] != null)
            {
                itemID = Int32.Parse(Request.Params["itemID"]);
            }

            //	populate with FAQ Details
            if (Page.IsPostBack == false)
            {
                if (itemID != -1)
                {
                    //  get a single row of FAQ info
                    FAQsDB        questions = new FAQsDB();
                    SqlDataReader dr        = questions.GetSingleFAQ(itemID);

                    try
                    {
                        //  Read database
                        dr.Read();
                        Question.Text = (string)dr["Question"];
                        //Answer.Text = (string) dr["Answer"];
                        DesktopText.Text = (string)dr["Answer"];
                        CreatedBy.Text   = (string)dr["CreatedByUser"];
                        CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToShortDateString();
                        // 15/7/2004 added localization by Mario Endara [email protected]
                        if (CreatedBy.Text == "unknown" || CreatedBy.Text == string.Empty)
                        {
                            CreatedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                }
            }
        }
        /// <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();
                }
            }
        }
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// and ItemID of the announcement to edit.
        /// It then uses the Rainbow.AnnouncementsDB() data component
        /// to populate the page's edit controls with the annoucement 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
            // announcement itemID value is specified, and if so populate page
            // contents with the announcement details

            //Indah Fuldner
            Rainbow.UI.DataTypes.HtmlEditorDataType h = new Rainbow.UI.DataTypes.HtmlEditorDataType();
            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText = h.GetEditor(PlaceHolderHTMLEditor, 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 Indah Fuldner

            // Construct the page
            // Added css Styles by Mario Endara <*****@*****.**> (2004/10/26)
            updateButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(updateButton);
            PlaceHolderButtons.Controls.Add(new LiteralControl("&#160;"));
            cancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(cancelButton);
            PlaceHolderButtons.Controls.Add(new LiteralControl("&#160;"));
            deleteButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(deleteButton);

            if (Page.IsPostBack == false)
            {
                if (ItemID != 0)
                {
                    // Obtain a single row of announcement information
                    AnnouncementsDB announcementDB = new AnnouncementsDB();
                    SqlDataReader   dr             = announcementDB.GetSingleAnnouncement(ItemID, WorkFlowVersion.Staging);

                    try
                    {
                        // Load first row into DataReader
                        if (dr.Read())
                        {
                            TitleField.Text      = (string)dr["Title"];
                            MoreLinkField.Text   = (string)dr["MoreLink"];
                            MobileMoreField.Text = (string)dr["MobileMoreLink"];
                            DesktopText.Text     = (string)dr["Description"];
                            ExpireField.Text     = ((DateTime)dr["ExpireDate"]).ToShortDateString();
                            CreatedBy.Text       = (string)dr["CreatedByUser"];
                            CreatedDate.Text     = ((DateTime)dr["CreatedDate"]).ToShortDateString();
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedBy.Text == "unknown")
                            {
                                CreatedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        // Close the datareader
                        dr.Close();
                    }
                }
                else
                {
                    ExpireField.Text     = DateTime.Now.AddDays(Int32.Parse(moduleSettings["DelayExpire"].ToString())).ToShortDateString();
                    deleteButton.Visible = false;                     // Cannot delete an unexsistent item
                }
            }
        }
Beispiel #4
0
        // devsolution 2003/6/17: Finished - Added items for calendar control

        ///	<summary>
        ///	The	Page_Load event	on this	Page is	used to	obtain the ModuleID
        ///	and	ItemID of the event	to edit.
        ///	It then	uses the Rainbow.EventsDB()	data component
        ///	to populate	the	page's edit	controls with the event	details.
        ///	</summary>
        ///	<param name="sender"></param>
        ///	<param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Added EsperantusKeys for Localization
            // Mario Endara [email protected] 11/05/2004

            foreach (ListItem item in AllDay.Items)
            {
                switch (AllDay.Items.IndexOf(item))
                {
                case 0:
                    item.Text = Esperantus.Localize.GetString("EVENTS_ALLDAY");
                    break;

                case 1:
                    item.Text = Esperantus.Localize.GetString("EVENTS_STARTAT");
                    break;
                }
            }

            //Change Indah Fuldner [email protected]
            Rainbow.UI.DataTypes.HtmlEditorDataType h = new     Rainbow.UI.DataTypes.HtmlEditorDataType();
            h.Value          = moduleSettings["Editor"].ToString();
            DescriptionField = h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()), portalSettings);

            DescriptionField.Width  = new System.Web.UI.WebControls.Unit(moduleSettings["Width"].ToString());
            DescriptionField.Height = new System.Web.UI.WebControls.Unit(moduleSettings["Height"].ToString());
            //End Change Indah Fuldner [email protected]

            // If the page is being	requested the first	time, determine	if an
            // event itemID	value is specified,	and	if so populate page
            // contents	with the event details

            if (Page.IsPostBack == false)
            {
                if (ItemID != 0)
                {
                    // Obtain a	single row of event	information
                    EventsDB      events = new EventsDB();
                    SqlDataReader dr     = events.GetSingleEvent(ItemID, WorkFlowVersion.Staging);

                    try
                    {
                        // Read	first row from database
                        if (dr.Read())
                        {
                            TitleField.Text       = (string)dr["Title"];
                            DescriptionField.Text = (string)dr["Description"];

                            // devsolution 2003/6/17: Added items for calendar control
                            if ((bool)dr["AllDay"])
                            {
                                AllDay.SelectedIndex = 0;
                            }
                            else
                            {
                                int hour   = 0;
                                int minute = 0;

                                AllDay.SelectedIndex = 1;
                                StartHour.Enabled    = StartMinute.Enabled = StartAMPM.Enabled = true;

                                string[] TimeParts = dr["StartTime"].ToString().Split(new Char[] { ':' });

                                try
                                {
                                    if (TimeParts[0].Length > 0)
                                    {
                                        hour = int.Parse(TimeParts[0]);
                                    }
                                    if (TimeParts.Length > 1)
                                    {
                                        minute = int.Parse(TimeParts[1]);
                                    }
                                }
                                catch
                                {
                                }

                                if (hour > 11)
                                {
                                    StartAMPM.SelectedIndex = 1;
                                    if (hour > 12)
                                    {
                                        hour -= 12;
                                    }
                                }
                                else
                                {
                                    if (hour == 0)
                                    {
                                        hour = 12;
                                    }
                                    StartAMPM.SelectedIndex = 0;
                                }

                                StartHour.SelectedIndex   = hour - 1;
                                StartMinute.SelectedIndex = minute / 5;
                            }
                            if (dr["StartDate"] != DBNull.Value)
                            {
                                StartDate.Text = ((DateTime)dr["StartDate"]).ToShortDateString();
                            }
                            else
                            {
                                StartDate.Text = string.Empty;
                            }
                            // devsolution 2003/6/17: Finished - Added items for calendar control

                            ExpireField.Text    = ((DateTime)dr["ExpireDate"]).ToShortDateString();
                            CreatedBy.Text      = (string)dr["CreatedByUser"];
                            WhereWhenField.Text = (string)dr["WhereWhen"];
                            CreatedDate.Text    = ((DateTime)dr["CreatedDate"]).ToShortDateString();
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedBy.Text == "unknown")
                            {
                                CreatedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                }
                else
                {
                    ExpireField.Text     = DateTime.Now.AddDays(Int32.Parse(moduleSettings["DelayExpire"].ToString())).ToShortDateString();
                    deleteButton.Visible = false;                     // Cannot	delete an unexsistent item
                }
            }
        }