/// <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 Appleseed.EventsDB() data component /// to populate the page's edit controls with the event details. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, 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 = General.GetString("EVENTS_ALLDAY"); break; case 1: item.Text = General.GetString("EVENTS_STARTAT"); break; } } //Change Indah Fuldner [email protected] HtmlEditorDataType h = new HtmlEditorDataType(); h.Value = this.ModuleSettings["Editor"].ToString(); DescriptionField = h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(this.ModuleSettings["ShowUpload"].ToString()), this.PortalSettings); DescriptionField.Width = new Unit(this.ModuleSettings["Width"].ToString()); DescriptionField.Height = new Unit(this.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 = General.GetString("UNKNOWN", "unknown"); } } } finally { dr.Close(); } } else { ExpireField.Text = DateTime.Now.AddDays(Int32.Parse(this.ModuleSettings["DelayExpire"].ToString())).ToShortDateString(); this.DeleteButton.Visible = false; // Cannot delete an unexsistent item } } }