Пример #1
0
        protected void SetDisplayForTimeToEnd(Models.EventModel model)
        {
            if (model.TimeToEnd.HasValue)
            {
                var newSpan = model.TimeToEnd.Value;

                bool bNegative = model.TimeToEnd.Value.TotalMilliseconds < 0;
                if (bNegative)
                {
                    newSpan = model.TimeToEnd.Value.Duration();
                }

                if (newSpan.Days > 0)
                {
                    model.DisplayForTimeToEnd = string.Format("{0}d {1:00}:{2:00}", newSpan.Days, newSpan.Hours, newSpan.Minutes);
                }
                else
                {
                    model.DisplayForTimeToEnd = newSpan.ToString("hh\\:mm");
                }

                if (bNegative)
                {
                    model.DisplayForTimeToEnd = "- " + model.DisplayForTimeToEnd;
                }
            }
        }
Пример #2
0
        public ActionResult Details()
        {
            string str = Request.QueryString["Id"];
            int    id  = Convert.ToInt32(str);
            var    sk  = new Models.EventModel().getAllSuKien1(id);

            return(View(sk));
        }
Пример #3
0
        public EventItemsAlreadyBooked(Models.EventModel Event, List <EventCateringModel> alreadyBookedCaterings, List <EventRoomModel> alreadyBookedRooms, List <EventGolfModel> alreadyBookedGolfs, System.Collections.ObjectModel.ObservableCollection <EventItemModel> alreadyBookedEventItems)
        {
            InitializeComponent();
            DataContext = ViewModel = new EventItemsAlreadyBookedViewModel(Event, alreadyBookedCaterings, alreadyBookedRooms, alreadyBookedGolfs, alreadyBookedEventItems);
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
            Owner = Application.Current.MainWindow;

            //Loaded += EventItemsAlreadyBooked_Loaded;
        }
Пример #4
0
 protected void PopulateEventModel(Models.EventModel model, DataAccess.Event data)
 {
     model.Id               = data.EventId;
     model.Name             = data.Name;
     model.Character_Cd     = data.Character_Cd;
     model.EndTime          = data.EndTime;
     model.TimeToEnd        = data.EndTime - DateTime.Now;
     model.TimeToEndHours   = model.TimeToEnd.HasValue ? (model.TimeToEnd.Value.Hours + model.TimeToEnd.Value.Days * 24) : 0;
     model.TimeToEndMinutes = model.TimeToEnd.HasValue ? (model.TimeToEnd.Value.Minutes) : 0;
     model.RewardType_Cd    = data.RewardType_Cd;
 }
Пример #5
0
        public ActionResult Edit(Models.EventModel model)
        {
            if (ModelState.IsValid)
            {
                using (var daEvent = new DataAccess.DataAccessObjects.Events())
                {
                    DataAccess.Event oEvent;
                    if (model.Id.HasValue)
                    {
                        oEvent = daEvent.LoadEvent(model.Id.Value);
                    }
                    else
                    {
                        oEvent = new DataAccess.Event();
                    }

                    oEvent.Name          = model.Name;
                    oEvent.Character_Cd  = model.Character_Cd;
                    oEvent.RewardType_Cd = model.RewardType_Cd;

                    DateTime?EndTime = null;

                    if (model.TimeToEndHours > 0 || model.TimeToEndMinutes > 0)
                    {
                        EndTime = DateTime.Now;

                        EndTime = EndTime.Value.AddHours(model.TimeToEndHours);
                        EndTime = EndTime.Value.AddMinutes(model.TimeToEndMinutes);
                    }

                    oEvent.EndTime = EndTime;

                    daEvent.SaveEvent(oEvent, Request.UserHostAddress);

                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                PopulateLists(model);
                return(View(model));
            }
        }
Пример #6
0
        public ActionResult Edit(int?eventId)
        {
            var model = new Models.EventModel();

            if (eventId.HasValue)
            {
                DataAccess.Event oEvent;
                using (var daEvents = new DataAccess.DataAccessObjects.Events())
                    oEvent = daEvents.LoadEvent(eventId.Value);

                if (oEvent != null)
                {
                    PopulateEventModel(model, oEvent);
                }
            }

            PopulateLists(model);

            return(View(model));
        }
Пример #7
0
        /**
         * Creates an eventModel from a CsvRow list of strings. It is assumed that the CsvRow follows the following order:
         * Title
         * Date
         * Location
         * Summary
         * Description
         * Host
         * Tags
         * Google Maps Url, if no Url is attached it will place a null value in its place in the EventModel
         */
        private EventModel parseEvent(CsvRow row)
        {
            // Converting the CsvRow list into more readable variable names
            string title       = (row.Count > 0) ? row[0] : null;
            string dateStr     = (row.Count > 1) ? row[1] : null;
            string location    = (row.Count > 2) ? row[2] : null;
            string summary     = (row.Count > 3) ? row[3] : null;
            string description = (row.Count > 4) ? row[4] : null;
            string company     = (row.Count > 5) ? row[5] : null;
            string tagStr      = (row.Count > 6) ? row[6] : null;
            string mapsUrl     = (row.Count > 7) ? row[7] : null;

            // Creating the base event model to store the information
            EventModel e = new Models.EventModel();

            // Populating the event model with the CSV information
            e.setName(title);
            e.setDescription(summary);
            e.setLocation(location);
            e.setHost(company);
            e.setGoogleMapsUrl(mapsUrl);

            DateTime date = new DateTime();

            DateTime.TryParseExact(dateStr, DATE_PATTERN, null, System.Globalization.DateTimeStyles.None, out date);
            e.setDate(date);

            List <string> tags = new List <string>();

            foreach (string s in tagStr.Split(','))
            {
                tags.Add(s);
            }
            e.setTags(tags);

            return(e);
        }
        public HttpStatusCodeResult NewEventTrigger(string param)
        {
            HttpStatusCodeResult output = new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError);

            try
            {
                SNMPDataHub       Hub        = new SNMPDataHub();
                JObject           jobject    = JObject.Parse(param);
                Models.EventModel eventModel = new Models.EventModel(jobject);
                Hub.SendNewEvent(eventModel);
                output = new HttpStatusCodeResult(System.Net.HttpStatusCode.OK);
            }
            catch (FormatException e)
            {
                BusinessLayer.ExceptionHandling.ExceptionCore.HandleException(BusinessLayer.ExceptionHandling.ExceptionCategory.High, e);
                output = new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError);
            }
            catch (Exception e)
            {
                BusinessLayer.ExceptionHandling.ExceptionCore.HandleException(BusinessLayer.ExceptionHandling.ExceptionCategory.Normal, e);
                output = new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError);
            }
            return(output);
        }
Пример #9
0
        // GET: Event
        public ActionResult Index()
        {
            var sk = new Models.EventModel().getAllSuKien();

            return(View(sk));
        }
Пример #10
0
 public bool Update(Models.EventModel entity)
 {
     throw new NotImplementedException();
 }