private void CreateNewEvent(object sender, RoutedEventArgs e)
        {
            CreateNewEvent ne = new CreateNewEvent();

            ne.AMPM_End.SelectedIndex   = 0;
            ne.AMPM_Start.SelectedIndex = 0;
            ne.ShowDialog();
            Refresh_Events(sender, e);
        }
Beispiel #2
0
        private void FireCreateEvent()
        {
            bool widthSuccessful  = int.TryParse(PixelWidth, out int width);
            bool heightSuccessful = int.TryParse(PixelHeight, out int height);
            bool sizeSuccessful   = int.TryParse(SizeOfPixel, out int size);

            if (widthSuccessful && heightSuccessful && sizeSuccessful)
            {
                width  = Math.Max(_minImageWidth, Math.Min(_maxImageWidth, width));
                height = Math.Max(_minImageHeight, Math.Min(_maxImageHeight, height));
                size   = Math.Max(_minPixelSize, Math.Min(_maxPixelSize, size));

                CreateNewEventArgs eventArgs = new CreateNewEventArgs(width, height, size);
                CreateNewEvent?.Invoke(this, eventArgs);
            }
            else
            {
                // If they click create and managed to input invalid items, resort to defaults.
                CreateNewEventArgs eventArgs = new CreateNewEventArgs(_defaultWidth, _defaultHeight, _defaultPixelSize);
                CreateNewEvent?.Invoke(this, eventArgs);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Create and post an event for start point, and then create a user event for end point (but not posted.)
        /// </summary>
        /// <param name="telemetrySession">Telemetry Session</param>
        /// <param name="eventName">
        /// An event name following data model schema.
        /// It requires that event name is a unique, not null or empty string.
        /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/".
        /// For examples,
        /// vs/platform/opensolution;
        /// vs/platform/editor/lightbulb/fixerror;
        /// </param>
        /// <param name="createNewEvent">A function to create a new event.</param>
        /// <param name="settings">A <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScopeSettings" /> object to control the TelemetryScope behavior.</param>
        /// <remarks>
        /// Because the same event name is used by both start and end events, please don't use Start or End in event name.
        /// </remarks>
        internal TelemetryScope(TelemetrySession telemetrySession, string eventName, CreateNewEvent createNewEvent, TelemetryScopeSettings settings)
        {
            isEnded          = 0;
            TelemetrySession = telemetrySession;
            Guid.NewGuid();
            StartTime = DateTime.UtcNow;
            T val = createNewEvent(OperationStageType.Start);

            val.Severity = settings.Severity;
            val.Correlate(settings.Correlations);
            val.IsOptOutFriendly = settings.IsOptOutFriendly;
            if (settings.StartEventProperties != null)
            {
                DictionaryExtensions.AddRange <string, object>(val.Properties, settings.StartEventProperties, true);
            }
            if (settings.PostStartEvent)
            {
                TelemetrySession.PostEvent(val);
            }
            EndEvent = val;
            EndEvent.SetPostStartEventProperty(settings.PostStartEvent);
            EndEvent.StageType = OperationStageType.End;
        }
		private void CreateNewEvent(object sender, RoutedEventArgs e)
		{
			CreateNewEvent ne = new CreateNewEvent();
			ne.AMPM_End.SelectedIndex = 0;
			ne.AMPM_Start.SelectedIndex = 0;
			ne.ShowDialog();
            Refresh_Events(sender, e);
        }
Beispiel #5
0
        public ServiceResult CreateEventByTemplate(CreateNewEvent newEvent)
        {
            var result = new ServiceResult();

            try
            {
                EventTemplate template = GetEventTemplateById(newEvent.SelectedTemplateId);

                var e = new Event
                {
                    GeneralLocality = newEvent.GeneralLocality,
                    RegionId        = newEvent.RegionId,
                    Place           = template.DefaultPlaceName,
                    IsActive        = false
                };

                int registrationTimeOffset = DirtyGirlServiceConfig.Settings.RegistrationCutoffHours * -1;
                e.RegistrationCutoff = newEvent.EventDate.AddHours(registrationTimeOffset);

                int emailPacketOffset = DirtyGirlServiceConfig.Settings.EmailPacketCutoffDays * -1;
                e.EmailCutoff = newEvent.EventDate.AddDays(emailPacketOffset);

                ServiceResult saveEventResult    = CreateEvent(e);
                ServiceResult generateDateResult = GenerateEventDate(e.EventId, newEvent.EventDate, template.StartTime,
                                                                     template.EndTime, template.WaveDuration,
                                                                     template.MaxRegistrantsPerWave);
                var feeResult = new ServiceResult();

                var rfee = new EventFee
                {
                    EventId       = e.EventId,
                    EffectiveDate = DateTime.Now.Date,
                    Cost          = template.DefaultRegistrationCost,
                    EventFeeType  = EventFeeType.Registration,
                    Discountable  = true,
                    Taxable       = true
                };
                var tFee = new EventFee
                {
                    EventId       = e.EventId,
                    EffectiveDate = DateTime.Now.Date,
                    Cost          = template.DefaultTransferFeeCost,
                    EventFeeType  = EventFeeType.Transfer,
                    Discountable  = false,
                    Taxable       = false
                };
                var chFee = new EventFee
                {
                    EventId       = e.EventId,
                    EffectiveDate = DateTime.Now.Date,
                    Cost          = template.DefaultChangeFeeCost,
                    EventFeeType  = EventFeeType.ChangeEvent,
                    Discountable  = false,
                    Taxable       = false
                };
                var cfee = new EventFee
                {
                    EventId       = e.EventId,
                    EffectiveDate = DateTime.Now.Date,
                    Cost          = template.DefaultCancellationFeeCost,
                    EventFeeType  = EventFeeType.Cancellation,
                    Discountable  = false,
                    Taxable       = false
                };

                var pfee = new EventFee
                {
                    EventId       = e.EventId,
                    EffectiveDate = DateTime.Now.Date,
                    Cost          = template.DefaultProcessingFeeCost,
                    EventFeeType  = EventFeeType.ProcessingFee,
                    Discountable  = false,
                    Taxable       = false
                };

                var sfee = new EventFee
                {
                    EventId       = e.EventId,
                    EffectiveDate = DateTime.Now.Date,
                    Cost          = template.DefaultShippingFeeCost,
                    EventFeeType  = EventFeeType.Shipping,
                    Discountable  = false,
                    Taxable       = false
                };

                CreateEventFee(rfee);
                CreateEventFee(tFee);
                CreateEventFee(chFee);
                CreateEventFee(cfee);
                CreateEventFee(sfee);
                CreateEventFee(pfee);

                foreach (EventTemplate_PayScale ps in template.PayScales)
                {
                    var eventStart = newEvent.EventDate;

                    eventStart = newEvent.EventDate.AddDays(-1 * ps.DaysOut);

                    // for registrations,
                    if (ps.EventFeeType == EventFeeType.Registration)
                    {
                        while (eventStart.DayOfWeek != DayOfWeek.Wednesday)
                        {
                            eventStart = eventStart.AddDays(1);
                        }
                    }
                    var newFee = new EventFee
                    {
                        EventId       = e.EventId,
                        EffectiveDate = eventStart.Date,
                        Cost          = ps.Cost,
                        EventFeeType  = ps.EventFeeType,
                        Taxable       = ps.Taxable,
                        Discountable  = ps.Discountable
                    };

                    feeResult = CreateEventFee(newFee);

                    if (!feeResult.Success)
                    {
                        break;
                    }
                }

                if (saveEventResult.Success && generateDateResult.Success && feeResult.Success)
                {
                    _repository.SaveChanges();
                    newEvent.EventId = e.EventId;
                }
                else
                {
                    result.AddServiceError("An Error Occured Creating this Event");
                }
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }

            return(result);
        }