Beispiel #1
0
        /// <summary>
        /// Builds a nailvent control given a guid
        /// </summary>
        /// <param name="gEventGUID">guid of the event</param>
        /// <returns>nailvent control for the specified guid</returns>
        public NailVent BuildEventControl(Guid gEventGUID)
        {
            var qryResults = from r in m_db.Event
                             where (r.bIsDeleted == false && r.gEventGUID == gEventGUID)
                             select r;

            foreach (MVCEventBench.Models.Event results in qryResults)
            {
                NailVent nv = new NailVent();
                //Initialize the events main properties
                nv.EventGUID = results.gEventGUID;
                nv.Name      = results.strEventName;
                nv.Location  = results.strEventLocation;
                nv.City      = results.strEventCity;
                nv.State     = results.strEventState;
                nv.Address   = results.strEventAddress;
                try
                {
                    nv.DateStart = (DateTime)results.dEventDateStart;
                }
                catch
                {
                    nv.DateStart = DateTime.Now;
                }
                try
                {
                    nv.DateEnd = (DateTime)results.dEventDateEnd;
                }
                catch
                {
                    nv.DateEnd = DateTime.MaxValue;
                }
                nv.Contact     = results.strContact;
                nv.Description = results.strDescription;
                nv.Details     = results.strDetails;
                nv.PhoneNumber = results.strPhoneNumber;
                nv.Sponsor     = results.strSponsor;
                nv.Webpage     = results.strWebpage;

                //Initialize the properties
                nv.AddressFontFamily = results.strAddressFontFamily;
                nv.AddressFontSize   = results.strAddressFontSize;
                nv.DateFontFamily    = results.strDateFontFamily;
                nv.DateFontSize      = results.strDateFontSize;


                return(nv);
            }

            //Nothing found
            return(null);
        }
Beispiel #2
0
        /// <summary>
        /// Builds a nailvent control given a guid
        /// </summary>
        /// <param name="gEventGUID">guid of the event</param>
        /// <returns>nailvent control for the specified guid</returns>
        public NailVent BuildEventControl(Guid gEventGUID)
        {
            var qryResults = from r in m_db.Event
                             where (r.bIsDeleted == false && r.gEventGUID == gEventGUID)
                             select r;

            foreach (MVCEventBench.Models.Event results in qryResults)
            {
                NailVent nv = new NailVent();
                //Initialize the events main properties
                nv.EventGUID   = results.gEventGUID;
                nv.Name        = results.strEventName;
                nv.Address     = results.strEventAddress;
                nv.Date        = (DateTime)results.dEventDate;
                nv.Time        = results.strEventTime;
                nv.Contact     = results.strContact;
                nv.Description = results.strDescription;
                nv.Details     = results.strDetails;
                nv.PhoneNumber = results.strPhoneNumber;
                nv.Sponsor     = results.strSponsor;
                nv.Webpage     = results.strWebpage;

                if (results.imgEvent != null)
                {
                    nv.ImgPath = results.imgEvent.ToString();
                }

                //Initialize the properties
                nv.AddressFontFamily = results.strAddressFontFamily;
                nv.AddressFontSize   = results.strAddressFontSize;
                nv.DateFontFamily    = results.strDateFontFamily;
                nv.DateFontSize      = results.strDateFontSize;
                nv.TimeFontFamily    = results.strTimeFontFamily;
                nv.TimeFontSize      = results.strTimeFontSize;

                return(nv);
            }

            //Nothing found
            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// Method to parse the Events result query into actual controls.
        /// </summary>
        /// <param name="qryResults">Results set or the database query</param>
        public void QryResultsToColumnControls(System.Data.Objects.ObjectQuery qryResults, List <NailVent> listNailVentToday, List <NailVent> listNailVentWeek, List <NailVent> listNailVentMonth)
        {
            DateTime dateNow    = DateTime.Now;
            string   strDateNow = dateNow.ToString("d");

            foreach (MVCEventBench.Models.Event result in qryResults)
            {
                //Create a new event
                NailVent nv = new NailVent();

                //Initialize the events main properties
                nv.EventGUID   = result.gEventGUID;
                nv.Name        = result.strEventName;
                nv.Address     = result.strEventAddress;
                nv.Date        = (DateTime)result.dEventDate;
                nv.Time        = result.strEventTime;
                nv.Contact     = result.strContact;
                nv.Description = result.strDescription;
                nv.Details     = result.strDetails;
                nv.PhoneNumber = result.strPhoneNumber;
                nv.Sponsor     = result.strSponsor;
                nv.Webpage     = result.strWebpage;

                if (result.imgEvent != null)
                {
                    nv.ImgPath = result.imgEvent.ToString();
                }

                //Initialize the properties
                nv.AddressFontFamily = result.strAddressFontFamily;
                nv.AddressFontSize   = result.strAddressFontSize;
                nv.DateFontFamily    = result.strDateFontFamily;
                nv.DateFontSize      = result.strDateFontSize;
                nv.TimeFontFamily    = result.strTimeFontFamily;
                nv.TimeFontSize      = result.strTimeFontSize;

                //If this is an event that is past date don't process it
                DateTime.TryParse(strDateNow, out dateNow);
                if (nv.Date < dateNow)
                {
                    continue;
                }
                else
                {
                    string strTimeCategory = FindEventTimeCategory(nv.Date);
                    switch (strTimeCategory)
                    {
                    case "day":
                    {
                        listNailVentToday.Add(nv);
                        break;
                    }

                    case "week":
                    {
                        listNailVentWeek.Add(nv);
                        break;
                    }

                    case "month":
                    {
                        listNailVentMonth.Add(nv);
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
            }
        }