Beispiel #1
0
        protected void GetExistingActivity()
        {
            if (_ActivityId != 0)
            {
                Activity activity = new Activity(_ActivityId);

                txtAddress.Text = activity.Address;
                txtCity.Text = activity.City;
                txtContactEmail.Text = activity.ContactEmail;
                txtContactName.Text = activity.ContactName;
                txtContactPhone.Text = activity.ContactPhone;
                txtContactURL.Text = activity.ContactURL;
                txtDescription.Text = activity.Description;
                txtEventName.Text = activity.Name;
                txtLocation.Text = activity.Location;
                txtZIP.Text = activity.ZIPcode;

                ucStates.StateCode = activity.State;
                ucDateTimeEditStart.SelectedDate = activity.StartDateTime;
                ucDateTimeEditStop.SelectedDate = activity.EndDateTime;

                ddlCommunity.SelectedItem.Value = activity.HostId.ToString();
                ddlFrequency.SelectedItem.Value = activity.Frequency.ToString();
            }
        }
        public void LoadActivities(int Month, int Year)
        {
            _Activities.Clear();
            Activity activity = new Activity();

            _dtActivities = activity.GetByMonth(Month, Year);

            foreach (Shiloh.BL.Shiloh.activityRow row in _dtActivities.Rows)
            {
                sActivity act = new sActivity();

                act.Id = row.ID;
                act.Name = row.name;
                act.Description = row.description;
                act.StartDate = row.activityStart;
                act.EndDate = row.activityEnd;

                // add to the list of activities for the day
                AddActivity(act.StartDate, act);

                // if this is a date range then add an event for each day in the range
                int dayRange = Math.Abs(act.EndDate.Subtract(act.StartDate).Days);
                if (dayRange > 0)
                {
                    for (double i = 1; i <= dayRange; i++)
                    {
                        AddActivity(act.StartDate.AddDays(i), act);
                    }
                }
            }
        }
Beispiel #3
0
        protected void BindEventList()
        {
            int activityCount = 0;
            Activity activity = new Activity();
            _dtActivities = activity.GetByMonth(DateTime.Now.Month, DateTime.Now.Year);
            //_dtActivities = LoadDummyActvities();

            List<Shiloh.BL.Shiloh.activityRow> shortList = new List<Shiloh.BL.Shiloh.activityRow>();

            if (_dtActivities != null)
            {
                foreach (Shiloh.BL.Shiloh.activityRow row in _dtActivities.Rows)
                {
                    if (activityCount < 2)
                    {
                        if (row.activityEnd.CompareTo(DateTime.Now.Date) >= 0)
                        {
                            shortList.Add(row);
                            activityCount += 1;
                        }
                    }
                    else
                        break;
                }

                // flip header and footer status
                if (shortList.Count > 0)
                {
                    pnlEvents.Visible = true;
                    pnlFallback.Visible = false;
                }
                else
                {
                    pnlEvents.Visible = false;
                    pnlFallback.Visible = true;
                }

                dlEvents.DataSource = shortList;
                dlEvents.DataBind();
            }
        }
Beispiel #4
0
        protected bool SaveEvent()
        {
            bool saved = false;

            Activity activity = null;

            if (_ActivityId == 0)
                activity = new Activity();
            else
                activity = new Activity(_ActivityId);

            activity.Address = Server.HtmlEncode(txtAddress.Text.Trim());
            activity.City = txtCity.Text.Trim();
            activity.ContactEmail = txtContactEmail.Text.Trim();
            activity.ContactName = Server.HtmlEncode(txtContactName.Text.Trim());
            activity.ContactPhone = txtContactPhone.Text.Trim();
            activity.ContactURL = txtContactURL.Text.Trim();
            activity.Description = Server.HtmlEncode(txtDescription.Text.Trim());
            activity.EndDateTime = ucDateTimeEditStop.SelectedDate;
            activity.StartDateTime = ucDateTimeEditStart.SelectedDate;
            activity.Name = Server.HtmlEncode(txtEventName.Text);
            activity.Frequency = Convert.ToInt32(ddlFrequency.SelectedItem.Value);
            activity.State = ucStates.StateCode;
            activity.Tag = (_ActivityId == 0) ? GenerateTag() : activity.Tag;
            activity.Location = Server.HtmlEncode(txtLocation.Text.Trim());
            activity.HostId = Convert.ToInt32(ddlCommunity.SelectedItem.Value);
            activity.ZIPcode = txtZIP.Text.Trim();
            activity.ImagePath = string.Empty;

            try
            {
                saved = activity.Save();
            }
            catch (Exception ex)
            {
                _ErrorMessage = ex.Message;
                saved = false;
            }

            return saved;
        }