// devsolution 2003/6/17: Finished - Added items for calendar control

        /// <summary>
        /// devsolution 2003/6/17:
        /// Change to make a RenderEvents for modularity
        /// Routine to add show calendar logic
        /// And Clean up code as now the calendar next and previous
        /// controls must re-render the display and get the data again
        /// e.g. modularize the code
        /// </summary>
        /// <param name="DisplayMonth">Month to display 1=Jan, 2=Feb, etc</param>
        /// <param name="DisplayYear">Year to display YYYY, 2003 for 2003</param>
        private void RenderEvents(int DisplayMonth, int DisplayYear)
        {
            EventsDB events = new EventsDB();

            myDataList.RepeatDirection = (Settings["RepeatDirectionSetting"].ToString() == "Horizontal"
                                              ? RepeatDirection.Horizontal
                                              : RepeatDirection.Vertical);
            myDataList.RepeatColumns = Int32.Parse(Settings["RepeatColumns"].ToString());

            if (bool.Parse(Settings["ShowBorder"].ToString()))
            {
                //myDataList.BorderWidth=Unit.Pixel(1);
                myDataList.ItemStyle.BorderWidth = Unit.Pixel(1);
            }
            dsEventData           = events.GetEvents(ModuleID, Version);
            myDataList.DataSource = dsEventData;
            myDataList.DataBind();

            // devsolution 2003/6/17: Added items for calendar control
            if (bool.Parse(Settings["ShowCalendar"].ToString()))
            {
                CalendarPanel.Visible = true;
                string DisplayDate = string.Empty;
                // devsolution 2003/6/17: Must have Devsolution.Portal.dll in \bin for calendar display functionality
                EventCalendar eventcalendar = new EventCalendar();
                lblCalendar.Text =
                    eventcalendar.GenerateCalendar(ModuleID, DisplayMonth, DisplayYear, out DisplayDate, dsEventData);
                lblDisplayDate.Text = DisplayDate;
            }
            // devsolution 2003/6/17: Finished - Added items for calendar control

            myDataList.DataSource = dsEventData;
            myDataList.DataBind();
        }
Exemplo n.º 2
0
        public List <Event_Domain> GetEventsUsingLINQ()
        {
            var dbInstance = new EventsDB();

            var details = dbInstance.GetEventsUsingLINQ();

            List <Event_Domain> domainEnts = new List <Event_Domain>();

            if (details != null && details.Any())
            {
                details.ForEach(ev => {
                    domainEnts.Add(new Event_Domain {
                        CategoryId  = ev.CategoryId,
                        Date        = ev.Date,
                        EventId     = ev.EventId,
                        EventName   = ev.EventName,
                        EventPrice  = ev.EventPrice,
                        Location    = ev.Location,
                        TicketPrice = ev.TicketPrice
                    });
                });
            }

            return(domainEnts);
        }
        /// <summary>
        /// The	UpdateBtn_Click	event handler on this Page is used to either
        /// create or update an	event.	It uses	the	Rainbow.EventsDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="e">Standard EventArgs</param>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            // Only	Update if the Entered Data is Valid
            if (Page.IsValid == true)
            {
                // Create an instance of the Event DB component
                EventsDB events = new EventsDB();

                // devsolution 2003/6/17: Added items for calendar control
                string StartTime = string.Empty;
                bool   IsAllDay  = (AllDay.SelectedItem.Value == "1");

                if (IsAllDay)
                {
                    int hour   = int.Parse(StartHour.SelectedItem.Text);
                    int minute = int.Parse(StartMinute.SelectedItem.Text);

                    if (StartAMPM.SelectedItem.Value == "PM")
                    {
                        if (hour < 12)
                        {
                            hour += 12;
                        }
                    }
                    else
                    {
                        if (hour == 12)
                        {
                            hour -= 12;
                        }
                    }
                    StartTime = string.Format("{0:00}:{1:00}:00", hour, minute);
                }
                // devsolution 2003/6/17: Finished - Added items for calendar control

                if (ItemID == 0)
                {
                    // Add the event within	the	Events table
                    events.AddEvent(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text,
                                    DateTime.Parse(ExpireField.Text), DescriptionField.Text, WhereWhenField.Text,
                                    IsAllDay, StartDate.Text, StartTime);
                }
                else
                {
                    // Update the event	within the Events table
                    events.UpdateEvent(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text,
                                       DateTime.Parse(ExpireField.Text), DescriptionField.Text, WhereWhenField.Text,
                                       IsAllDay, StartDate.Text, StartTime);
                }

                // Redirect	back to	the	portal home	page
                RedirectBackToReferringPage();
            }
        }
        /// <summary>
        /// The	DeleteBtn_Click	event handler on this Page is used to delete an
        /// an event.  It  uses	the	Rainbow.EventsDB() data	component to
        /// encapsulate	all	data functionality.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnDelete(EventArgs e)
        {
            base.OnDelete(e);

            // Only	attempt	to delete the item if it is	an existing	item
            // (new	items will have	"ItemID" of	0)

            if (ItemID != 0)
            {
                EventsDB events = new EventsDB();
                events.DeleteEvent(ItemID);
            }

            // Redirect	back to	the	portal home	page
            RedirectBackToReferringPage();
        }
Exemplo n.º 5
0
        public EventsDB ConvertToDB()
        {
            EventsDB returnValue = new EventsDB
            {
                EventID          = this.EventID,
                StudentID        = this.StudentID,
                EventName        = this.EventName,
                EventDescription = this.EventDescription,
                StartDate        = this.StartDate,
                EndDate          = this.EndDate,
                EventColour      = this.EventColour,
                IsAllDay         = this.IsAllDay
            };

            return(returnValue);
        }
Exemplo n.º 6
0
        private void LoadItemsCombobox()
        {
            // Load ContainerIDs //
            List <Container> containerList = ContainerDB.GetContainers(connectionstring);

            foreach (Container container in containerList)
            {
                ComboAddContainerID.Items.Add(
                    container.ContainerID.ToString().PadRight(2) +
                    container.Plaats);
            }

            // Load DeviceIDs //
            List <Device> deviceList = DeviceDB.GetDevice(connectionstring);

            foreach (Device device in deviceList)
            {
                ComboAddDeviceID.Items.Add(
                    device.DeviceID.ToString().PadRight(2) +
                    device.Van +
                    device.Tot);
            }

            // Load EventIDs //
            List <Events> eventsList = EventsDB.GetEvents(connectionstring);

            foreach (Events events in eventsList)
            {
                ComboAddEventID.Items.Add(
                    events.EventID.ToString().PadRight(2) +
                    events.Naam.PadRight(10) +
                    events.Locatie);
            }

            // Load VerantwoorkelijkeIDs //
            List <Persoon> persoonList = PersoonDB.GetPeople(connectionstring);

            foreach (Persoon persoon in persoonList)
            {
                ComboAddVerantwoordelijkeID.Items.Add(
                    persoon.PersoonID.ToString().PadRight(2) +
                    persoon.Voornaam.PadRight(10) +
                    persoon.Achternaam);
            }
        }
        /// <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">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          = moduleSettings["Editor"].ToString();
            DescriptionField =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()),
                            portalSettings);

            DescriptionField.Width  = new Unit(moduleSettings["Width"].ToString());
            DescriptionField.Height = new 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 = General.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
                }
            }
        }
Exemplo n.º 8
0
        private void updateRightList()
        {
            ListData.Items.Clear();

            switch (selectedAdd)
            {
            case "Container":
                ListData.Items.Add(
                    "ContainerID".PadRight(13) +
                    "Plaats".PadRight(15) +
                    "Van".PadRight(20) +
                    "Tot");
                List <Container> containerList = ContainerDB.GetContainers(myConnectionString);
                foreach (Container container in containerList)
                {
                    ListData.Items.Add(
                        container.ContainerID.ToString().PadRight(13) +
                        container.Plaats.PadRight(15) +
                        container.Van.ToString("dd/MM/yyyy").PadRight(20) +
                        container.Tot.ToString("dd/MM/yyyy"));
                }
                break;

            case "Device":
                ListData.Items.Add(
                    "DeviceID".PadRight(10) +
                    "Van".PadRight(20) +
                    "Tot");
                List <Device> deviceList = DeviceDB.GetDevice(myConnectionString);
                foreach (Device device in deviceList)
                {
                    ListData.Items.Add(
                        device.DeviceID.ToString().PadRight(10) +
                        device.Van.ToString().PadRight(20) +
                        device.Tot);
                }
                break;

            case "Event":
                ListData.Items.Add(
                    "ContactpersoonID".PadRight(18) +
                    "Naam".PadRight(15) +
                    "Locatie".PadRight(10) +
                    "ContactpersoonID".PadRight(18) +
                    "VerantwoordelijkeID");
                List <Events> eventsList = EventsDB.GetEvents(myConnectionString);
                foreach (Events events in eventsList)
                {
                    ListData.Items.Add(
                        events.ContactpersoonID.ToString().PadRight(18) +
                        events.Naam.PadRight(15) +
                        events.Locatie.PadRight(10) +
                        events.ContactpersoonID.ToString().PadRight(18) +
                        events.VerantwoordelijkeID);
                }
                break;

            case "Persoon":
                ListData.Items.Add(
                    "PersoonID".PadRight(10) +
                    "Functie".PadRight(10) +
                    "Voornaam".PadRight(10) +
                    "Achternaam".PadRight(15) +
                    "GSM");
                List <Persoon> persoonList = PersoonDB.GetPeople(myConnectionString);
                foreach (Persoon persoon in persoonList)
                {
                    ListData.Items.Add(
                        persoon.PersoonID.ToString().PadRight(10) +
                        persoon.Functie.PadRight(10) +
                        persoon.Voornaam.PadRight(10) +
                        persoon.Achternaam.PadRight(15) +
                        persoon.GSM);
                }
                break;
            }
        }