Ejemplo n.º 1
0
 /// <summary>
 ///     Returns a warning-as-error exception wrapping the given message for this event.
 /// </summary>
 /// <param name="message"> The message to wrap. </param>
 protected virtual Exception WarningAsError([NotNull] string message)
 => new InvalidOperationException(
     CoreStrings.WarningAsErrorTemplate(EventId.ToString(), message, EventIdCode));
Ejemplo n.º 2
0
        public string Bind(string categoryName, LogLevel logLevel, EventId?eventId, string message,
                           Exception?exception, object[]?scopes)
        {
            TryGetArgumentValue valueProvider = delegate(string name, out object?value)
            {
                switch (name.ToUpperInvariant())
                {
                case "EVENTTYPE":
                case "LOGLEVEL":
                    value = logLevel;
                    break;

                case "SHORTLEVEL":
                case "SHORTLOGLEVEL":
                    value = GetShortLogLevel(logLevel);
                    break;

                case "FACILITY":
                    value = Facility;
                    break;

                case "SEVERITY":
                    value = GetSeverity(logLevel);
                    break;

                case "PRI":
                case "PRIORITY":
                    value = Facility * 8 + GetSeverity(logLevel);
                    break;

                case "ID":
                    value = eventId?.Id;
                    break;

                case "EVENTID":
                    value = eventId?.ToString();
                    break;

                case "MESSAGE":
                    value = message;
                    break;

                case "MESSAGEPREFIX":
                    value = FormatPrefix(message);
                    break;

                case "SOURCE":
                case "CATEGORY":
                case "CATEGORYNAME":
                    value = categoryName;
                    break;

                case "EXCEPTIONMESSAGE":
                    value = exception?.Message;
                    break;

                case "EXCEPTION":
                    value = exception;
                    break;

                case "SCOPES":
                    value = FormatScopes(scopes);
                    break;

                case "SCOPELIST":
                    value = FormatScopes(scopes, " => ", " => ");
                    break;

                default:
                    if (!_systemValueProvider.TryGetArgumentValue(name, out value))
                    {
                        value = "{" + name + "}";
                    }

                    break;
                }

                return(true);
            };
            var result = StringTemplate.Format(Template, valueProvider);

            return(result);
        }
        private void writeLogToFile(string userRef, EventId logId, string message, LogLevel logLevel, params object[] args)
        {
            string timestamp          = DateUtils.GetCurrentDateTimestamp();
            string logMessageFormated = String.Format(message, args);

            int level = (int)logLevel;

            string formated = String.Format("USERREF: {0}    [{1} {2}]:     EVENTID: {3}    MESSAGE: {4}\n", userRef, timestamp, _logLevels[level], logId.ToString(), logMessageFormated);

            DirectoryInfo di = Directory.CreateDirectory(_fileDirectory);

            using (System.IO.FileStream file = new FileStream(_filePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite))
                using (System.IO.StreamWriter sw = new StreamWriter(file)){
                    sw.WriteAsync(formated);
                }
        }
Ejemplo n.º 4
0
 public override string ToString() => "Event " + EventId.ToString();
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegistrationFlow.CanSaveConsentInfo = false;
            SetTitle();
            bool defaultBasePackage = false;

            FillClinicialQuestionnaireDiv.Visible = false;
            ClinicalQuestionTemplateId            = 0;
            IsClinicalQuestionaireFilled          = false;


            if (EventId > 0)
            {
                if (EventData != null)
                {
                    EventType = EventData.EventType;

                    var configurationSettingRepository = IoC.Resolve <IConfigurationSettingRepository>();
                    EnableAlaCarte = Convert.ToBoolean(configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableAlaCarte));
                    if (EnableAlaCarte)
                    {
                        EnableAlaCarte = EventData.EnableAlaCarteCallCenter;
                    }
                }

                if (AccountByEventId != null)
                {
                    if (AccountByEventId.AskClinicalQuestions && AccountByEventId.ClinicalQuestionTemplateId.HasValue)
                    {
                        FillClinicialQuestionnaireDiv.Visible = true;
                        ClinicalQuestionTemplateId            = AccountByEventId.ClinicalQuestionTemplateId.Value;
                        GetRecommendationText();
                    }
                    defaultBasePackage = AccountByEventId.DefaultSelectionBasePackage;

                    // for penguin integartion
                    var settings = IoC.Resolve <ISettings>();

                    QuestionnaireType questionnaireType = QuestionnaireType.None;
                    if (AccountByEventId != null && AccountByEventId.IsHealthPlan && EventData != null)
                    {
                        var accountHraChatQuestionnaireHistoryServices = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>();
                        questionnaireType = accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(AccountByEventId.Id, EventData.EventDate);
                    }

                    if (questionnaireType == QuestionnaireType.HraQuestionnaire)
                    {
                        var userSession = IoC.Resolve <ISessionContext>().UserSession;
                        var token       =
                            (Session.SessionID + "_" + userSession.UserId + "_" +
                             userSession.CurrentOrganizationRole.RoleId + "_" +
                             userSession.CurrentOrganizationRole.OrganizationId).Encrypt();


                        HraQuestionerAppUrlWithoutVisit = settings.HraQuestionerAppUrl + "?userToken=" +
                                                          HttpUtility.UrlEncode(token) + "&customerId=" + CustomerId + "&orgName=" +
                                                          settings.OrganizationNameForHraQuestioner + "&tag=" + AccountByEventId.Tag;
                        HraQuestionerAppUrl = HraQuestionerAppUrlWithoutVisit + "&visitId=" + (RegistrationFlow.AwvVisitId.HasValue ? RegistrationFlow.AwvVisitId.Value : 0);

                        ChatQuestionerAppUrl = string.Empty;
                    }
                    else if (questionnaireType == QuestionnaireType.ChatQuestionnaire)
                    {
                        ChatQuestionerAppUrl = settings.HraQuestionerAppUrl;
                        HraQuestionerAppUrl  = string.Empty;
                    }
                }
            }


            if (!IsPostBack)
            {
                if (RegistrationFlow != null && RegistrationFlow.IsRetest)
                {
                    RetestNo.Checked  = false;
                    RetestYes.Checked = true;
                }
                else
                {
                    RetestNo.Checked  = true;
                    RetestYes.Checked = false;
                }

                if (RegistrationFlow != null && RegistrationFlow.SingleTestOverride)
                {
                    SingleTestOverrideYes.Checked = true;
                    SingleTestOverrideNo.Checked  = false;
                }
                else
                {
                    SingleTestOverrideYes.Checked = false;
                    SingleTestOverrideNo.Checked  = true;
                }

                if (EventId != 0)
                {
                    // Hack: This is  done if the user hits back button on payment page, to get back to select package page.
                    if (SourceCodeId > 0 && !string.IsNullOrEmpty(SourceCode))
                    {
                        txtCouponCode.Text = SourceCode;
                    }
                    else if (RegistrationFlow != null)
                    {
                        txtCouponCode.Text = RegistrationFlow.CallSourceCode;
                    }

                    hfEventID.Value = EventId.ToString();

                    var eventCustomerQuestionAnswerService = IoC.Resolve <IEventCustomerQuestionAnswerService>();
                    hfQuestionAnsTestId.Value = eventCustomerQuestionAnswerService.GetQuestionAnswerTestIdString(CustomerId, EventId);
                }
                else
                {
                    const string message = "Sorry, Event detail not found. <a href=\"RegCustomerSearchEvent.aspx\">Click here</a> to search event again ";
                    DisplayErrorMessage(message);
                }

                if (CurrentProspectCustomer != null && CurrentProspectCustomer.Id > 0 && CurrentProspectCustomer.SourceCodeId != null && CurrentProspectCustomer.SourceCodeId.Value > 0)
                {
                    ISourceCodeRepository sourceCodeRepository = new SourceCodeRepository();
                    var sourceCode = sourceCodeRepository.GetSourceCodeById(CurrentProspectCustomer.SourceCodeId.Value);
                    if (sourceCode != null)
                    {
                        txtCouponCode.Text = sourceCode.CouponCode;
                    }
                }
                IEventPackageRepository packageRepository = new EventPackageRepository();
                var preApprovedPackageRepository          = IoC.Resolve <IPreApprovedPackageRepository>();

                if (AccountByEventId != null && AccountByEventId.AllowPreQualifiedTestOnly)
                {
                    long preApprovedPackageId = preApprovedPackageRepository.CheckPreApprovedPackages(CustomerId);
                    if (PackageId == 0 && preApprovedPackageId > 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest)))
                    {
                        var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep);

                        if (!eventPackages.IsNullOrEmpty())
                        {
                            var preApprovedPackage = eventPackages.FirstOrDefault(x => x.PackageId == preApprovedPackageId);
                            if (preApprovedPackage != null)
                            {
                                PackageId = preApprovedPackage.PackageId;
                                TestIds   = preApprovedPackage.Tests.Select(t => t.TestId).ToList();
                            }
                        }
                    }
                }


                if (defaultBasePackage && PackageId == 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest)))
                {
                    var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep)
                                        .OrderBy(p => p.Price);
                    if (!eventPackages.IsNullOrEmpty())
                    {
                        var lowestPricePackage = eventPackages.First();
                        PackageId = lowestPricePackage.PackageId;
                        TestIds   = lowestPricePackage.Tests.Select(t => t.TestId).ToList();
                    }
                }

                if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.DisqualifiedTest) && string.IsNullOrWhiteSpace(hfDisqualifedTest.Value))
                {
                    hfDisqualifedTest.Value = RegistrationFlow.DisqualifiedTest;
                }

                if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.QuestionIdAnswerTestId) && string.IsNullOrWhiteSpace(hfQuestionAnsTestId.Value))
                {
                    hfQuestionAnsTestId.Value = RegistrationFlow.QuestionIdAnswerTestId;
                }

                /*if (!DisqualifiedTestIds.IsNullOrEmpty())
                 * {
                 *  TestIds = TestIds.Where(x => !DisqualifiedTestIds.Contains(x)).ToList();
                 * }*/

                ItemCartControl.EventId   = EventId;
                ItemCartControl.RoleId    = (long)Roles.CallCenterRep;
                ItemCartControl.PackageId = PackageId;
                ItemCartControl.TestIds   = TestIds;

                if (Request.QueryString["Call"] != null && Request.QueryString["Call"] == "No")
                {
                    divCall.Style.Add(HtmlTextWriterStyle.Display, "none");
                    divCall.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");
                }
                else
                {
                    var repository = new CallCenterCallRepository();
                    hfCallStartTime.Value = repository.GetCallStarttime(CallId);
                }

                if (Request.UrlReferrer != null)
                {
                    ViewState["UrlReferer"] = Request.UrlReferrer.PathAndQuery;
                }
            }
            if (Request.Params["__EVENTTARGET"] == "NextButton" && Request.Params["__EVENTARGUMENT"] == "Click")
            {
                NextButtonClick();
            }
        }
Ejemplo n.º 6
0
        /// <inheritdoc />
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (_name.StartsWith("Microsoft.EntityFrameworkCore") || IsEnabled(logLevel) == false)
            {
                return;
            }

            string message;

            if (formatter != null)
            {
                message = formatter(state, exception);
            }
            else
            {
                message = state.Stringify();

                if (exception != null)
                {
                    message += Environment.NewLine + exception.Stringify();
                }
            }

            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            var log = new TLog
            {
                Message = message.Truncate(LogEntry.MaximumMessageLength),
                Date    = DateTime.UtcNow,
                Level   = logLevel.ToString(),
                Logger  = _name,
                Thread  = eventId.ToString(),
            };

            if (exception != null)
            {
                log.Exception = exception.ToString().Truncate(LogEntry.MaximumExceptionLength);
            }

            var httpContext = _services.GetRequiredService <IHttpContextAccessor>()?.HttpContext;

            if (httpContext != null)
            {
                log.Browser  = httpContext.Request.Headers["User-Agent"];
                log.Username = httpContext.User.Identity.Name;

                try
                {
                    log.HostAddress = httpContext.Connection.LocalIpAddress?.ToString();
                }
                catch (ObjectDisposedException)
                {
                    log.HostAddress = "Disposed";
                }

                log.Url = httpContext.Request.Path;
            }

            _entryQueue.Enqueue(log);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Wrapper for the the google.earth.removeEventListener method
        /// See: https://developers.google.com/earth/documentation/reference/google_earth_namespace#a4367d554eb492adcafa52925ddbf0c71
        /// </summary>
        /// <param name="feature">The target feature</param>
        /// <param name="action">The event Id</param>
        /// <param name="callback">Optional, the same callback as was provided when the event was added</param>
        /// <param name="useCapture">Optional, use event capture</param>
        public void RemoveEventListener(object feature, EventId action, bool useCapture = false)
        {
            //feature, hash, action, useCapture
            object[] args = new object[] 
            { 
                feature, 
                feature.GetHashCode(),
                action.ToString().ToUpperInvariant(),
                useCapture 
            };

            this.InvokeJavaScript(JSFunction.RemoveEventListener, args);
        }
Ejemplo n.º 8
0
        public async Task WriteAsync(EventId eventId, LogLevel level, string message)
        {
            try
            {
                await writer.WriteAsync($"{DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)} {GetLogLevelString(level)}: [{eventId.ToString().PadLeft(8)}] {message}\r\n");

                await writer.FlushAsync();

                await context.Response.Body.FlushAsync();
            }
            catch (ObjectDisposedException)
            {
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Main method in the ILogger interface that defines how to print a message.
        /// </summary>
        /// <param name="logLevel">Log severity</param>
        /// <param name="eventId">Event category (no used in this project)</param>
        /// <param name="state">Actual message wrapped</param>
        /// <param name="exception">Associated exception</param>
        /// <param name="formatter">Function that defines how to format a message.</param>
        public void Log <TState>(
            LogLevel logLevel,
            EventId eventId,
            TState state,
            Exception exception,
            Func <TState, Exception, string> formatter
            )
        {
            /// <summary>
            /// Return immediately is logging is not enabled for this log level
            /// </summary>
            if (!IsEnabled(logLevel))
            {
                return;
            }

            // Exception has to be set (by framework)
            if (formatter == null)
            {
                throw new ArgumentNullException(nameof(formatter));
            }

            // Generate actual message
            var message = formatter(state, exception);

            // Return for empty message
            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            if (logLevel >= LogLevel.Error)
            {
                _loggingService.RecordLogMessageAsync(
                    message,
                    exception != null ?
                    JsonConvert.SerializeObject(new
                {
                    Exception = exception.ToString()
                }) :
                    "",
                    "status-site",
                    eventId.Id,
                    logLevel.GetSeverity()
                    );
            }

            // Define colors for thread identifiers
            var threadColors = new ConsoleColor[] {
                ConsoleColor.Cyan,
                ConsoleColor.DarkCyan,
                ConsoleColor.Blue,
                ConsoleColor.DarkBlue,
                ConsoleColor.DarkGreen,
                ConsoleColor.DarkMagenta,
                ConsoleColor.DarkYellow,
                ConsoleColor.DarkRed
            };

            // Generate thread label text
            var thread      = Thread.CurrentThread;
            var threadLabel =
                string.IsNullOrEmpty(thread.Name) ?
                $"ThreadID: {thread.ManagedThreadId.ToString().PadLeft(3)}" :
                thread.Name.Substring(0, 12);

            // Generate a thread label color
            var threadColor = threadColors[Math.Abs(threadLabel.GetHashCode()) % threadColors.Length];

            var label = logLevel.GetLabel();

            // Do not let multiple threads enter the actual print section
            lock (StatusLogger._lockKey)
            {
                // Print everything (watch for pads and new lines)
                ColoredConsole.Write($"{threadLabel}", threadColor);

                Console.Write("".PadLeft(6 - label.Text.Length));

                ColoredConsole.Write($"{label.Text}", label.ForegroundColor, label.BackgroundColor);

                Console.Write(" | ");

                Console.Write($"[{eventId.ToString().PadRight(2)}] {_categoryName}");

                Console.WriteLine();

                Console.Write($"[{DateTime.UtcNow.ToString("MM/dd/yy HH:mm:ss")}]");

                Console.Write(" | ");

                if (exception != null)
                {
                    message += Environment.NewLine + Environment.NewLine + exception.ToString();
                }

                if (message.Contains(Environment.NewLine))
                {
                    message =
                        "See multiline message:" +
                        Environment.NewLine + "\t" +
                        message.Replace(Environment.NewLine, $"{Environment.NewLine}\t");
                }

                Console.WriteLine(message);

                Console.WriteLine();
            }
        }
        private void GetEventDetail()
        {
            if (EventId > 0 && CustomerId > 0)
            {
                _spCustomerId.InnerText = customerLogEditModel.CustomerId = CustomerId.ToString();
                _spEventId.InnerText    = customerLogEditModel.EventId = EventId.ToString();

                var appointmentRepository = IoC.Resolve <IAppointmentRepository>();
                var appointment           = appointmentRepository.GetEventCustomerAppointment(EventId, CustomerId);

                if (appointment == null)
                {
                    return;
                }

                var customerRepository = IoC.Resolve <ICustomerRepository>();
                var customer           = customerRepository.GetCustomer(CustomerId);

                var eventService = IoC.Resolve <IEventService>();
                var eventHost    = eventService.GetById(EventId);

                var strCustomerName = customerLogEditModel.Name = customer.NameAsString;

                _spAcesId.InnerText = string.IsNullOrWhiteSpace(customer.AcesId) ? "N/A" : customer.AcesId;

                _strEventDate = eventHost.EventDate.ToLongDateString();
                var strHostAddress = new Address(eventHost.StreetAddressLine1, eventHost.StreetAddressLine2,
                                                 eventHost.City, eventHost.State, eventHost.Zip, "");
                customerLogEditModel.EventVenue = _strEventVenue = eventHost.Name + "  " + strHostAddress;

                _spFullName.InnerText          = strCustomerName;
                customerLogEditModel.EventDate = _strEventDate + " at " + appointment.StartTime.ToShortTimeString();
                _spWhen.InnerText  = HttpUtility.HtmlEncode(customerLogEditModel.EventDate);
                _spVenue.InnerText = _strEventVenue;

                var orderDetail = GetCurrentOrder(CustomerId, EventId);
                //decimal shippingPrice = orderDetail.ShippingDetailOrderDetails.Sum(shippingDetailOrderDetail => shippingDetailOrderDetail.Amount);

                decimal totalAmount = _order.DiscountedTotal;

                IEventCustomerPackageTestDetailService eventCustomerPackageTestDetailService = new EventCustomerPackageTestDetailService();
                var eventCustomerPackageTestDetailViewData =
                    eventCustomerPackageTestDetailService.GetEventPackageDetails(EventId, CustomerId);
                if (eventCustomerPackageTestDetailViewData.Package != null)
                {
                    _spPackageName.InnerText = customerLogEditModel.PackageName = eventCustomerPackageTestDetailViewData.Package.Name;

                    var packageTest = string.Empty; var packageTestAudit = string.Empty;
                    foreach (var test in eventCustomerPackageTestDetailViewData.Package.Tests)
                    {
                        packageTest      += "<li style=\"margin: 0px 10px; padding: 0px 0px; list-style: disc;\">" + test.Name + "</li>";
                        packageTestAudit += test.Name + ", ";
                    }
                    _spTestNames.InnerHtml           = packageTest;
                    customerLogEditModel.PackageTest = packageTestAudit.Length > 2 ? packageTestAudit.Substring(0, packageTestAudit.Length - 2) : "";;
                }
                else
                {
                    _dvPackageMain.Visible      = false;
                    _dvAdditionalTest.InnerHtml = "Test(s):";
                }

                var additionalTest = string.Empty; var additionalTestAudit = string.Empty;
                foreach (var test in eventCustomerPackageTestDetailViewData.Tests)
                {
                    additionalTest      += "<li style=\"margin: 0px 10px; padding: 0px 0px; list-style: disc;\">" + test.Name + "</li>";
                    additionalTestAudit += test.Name + ", ";
                }

                _spAdditionalTestNames.InnerHtml         = additionalTest;
                customerLogEditModel.AdditionalTestAudit = additionalTestAudit.Length > 2 ? additionalTestAudit.Substring(0, additionalTestAudit.Length - 2) : "";
                if (eventCustomerPackageTestDetailViewData.Tests.Count < 1)
                {
                    _dvAdditionalTestMain.Visible = false;
                }

                _spPrice.InnerHtml = customerLogEditModel.OrderValue = totalAmount.ToString("C2");

                //_spPaymentStatus.InnerHtml = (_order.TotalAmountPaid - _order.DiscountedTotal) >= 0 ? "<i>The payment captured sucessfully.</i>" : "<i>Not Paid</i>";

                if (_order.DiscountedTotal > 0)
                {
                    customerLogEditModel.PaymentStatus = _spPaymentStatus.InnerHtml = _order.TotalAmountPaid > 0
                                                      ? "<i>The payment captured sucessfully.</i>"
                                                      : "<i>Not Paid</i>";
                }
                else
                {
                    customerLogEditModel.PaymentStatus = _spPaymentStatus.InnerHtml = "<i>Not charged.</i>";
                }

                customerLogEditModel.PaymentStatus = ((string)customerLogEditModel.PaymentStatus).Replace("<i>", "").Replace("</i>", "");

                if (eventCustomerPackageTestDetailViewData.ElectronicProduct != null)
                {
                    ProductDiv.Visible    = true;
                    ProductSpan.InnerHtml = eventCustomerPackageTestDetailViewData.ElectronicProduct.Name + "<a  class='jtip'  title='Description|" + eventCustomerPackageTestDetailViewData.ElectronicProduct.ShortDescription + "'> <span class='smalltxtblu'>[More Info]</span></a>";
                    customerLogEditModel.ElectronicProduct = eventCustomerPackageTestDetailViewData.ElectronicProduct.Name;
                }
                else
                {
                    ProductDiv.Visible = false;
                }

                //TODO:For Spike release it is kept here. it should be in db and need to have one more field in DB to identify Digital delivery shipping option
                var shippingOption = new ShippingOption {
                    Id = 0, Name = "Unlimited Online Results (Free)", Price = 0.00m, Description = IoC.Resolve <ISettings>().CompanyName + "  securely stores your screening results, including all medical device output and ultrasound images, online permanently and provides unlimited access, printing & emailing 24-hours a day, free of charge!  Online results typically available in less than 2 business days however, guaranteed in 4 business days.", Disclaimer = ""
                };

                long shippingDetailId = 0;
                if (orderDetail != null && orderDetail.ShippingDetailOrderDetails != null && orderDetail.ShippingDetailOrderDetails.Count() > 0)
                {
                    shippingDetailId = orderDetail.ShippingDetailOrderDetails.Where(sdod => sdod.IsActive).Select(sdod => sdod.ShippingDetailId).FirstOrDefault();
                }

                if (shippingDetailId > 0)
                {
                    var shippingRepository = IoC.Resolve <IShippingDetailRepository>();
                    var shippingDetail     = shippingRepository.GetById(shippingDetailId);

                    IShippingOptionRepository shippingOptionRepository = new ShippingOptionRepository();
                    shippingOption = shippingOptionRepository.GetById(shippingDetail.ShippingOption.Id);
                }

                _spShippingOption.InnerHtml = shippingOption.Name + "<a  class='jtip'  title='Description/Disclaimer!|" + shippingOption.Description + "|<br /><strong>" + shippingOption.Disclaimer + "</strong><br /> '> <span class='smalltxtblu'>[More Info]</span></a>";

                if (IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.CheckRole((long)Roles.CallCenterRep))
                {
                    GetCcRepInstruction(EventId);
                }
                else
                {
                    _spCCRepNotes.Visible = false;
                }

                var corporateAccountRepository = IoC.Resolve <ICorporateAccountRepository>();
                var account = corporateAccountRepository.GetbyEventId(EventId);

                _spUserName.InnerText = customerLogEditModel.UserName = customer.UserLogin.UserName;
                //_spPassword.InnerHtml = customer.UserLogin.Password;
                hfUserID.Value = customer.UserLogin.Id.ToString();

                SetPcpInfo(CustomerId);

                SetHafInfo(account);
                SetHraInfo(EventId, CustomerId, eventHost.EventDate, account);
                HideUserLoginDetails(account);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Writes a log entry.
        /// </summary>
        /// <typeparam name="TState"></typeparam>
        /// <param name="logLevel">Entry will be written on this level.</param>
        /// <param name="eventId">Id of the event.</param>
        /// <param name="state">The entry to be written. Can be also an object.</param>
        /// <param name="exception">The exception related to this entry.</param>
        /// <param name="formatter">Function to create a <c>string</c> message of the <paramref name="state" /> and <paramref name="exception" />.</param>
        public async void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception,
                                       Func <TState, Exception, string> formatter)
        {
            if (!IsEnabled(logLevel))
            {
                return;
            }
            var message = string.Empty;
            var values  = state as IReadOnlyList <KeyValuePair <string, object> >;

            if (formatter != null)
            {
                message = formatter(state, exception);
            }
            else if (values != null)
            {
                var builder = new StringBuilder();
                FormatLogValues(
                    builder,
                    values,
                    level: 1,
                    bullet: false);
                message = builder.ToString();
                if (exception != null)
                {
                    message += Environment.NewLine + exception;
                }
            }
            else
            {
                message = $"{Convert.ToString(message)} [Check formatting]";
            }
            if (string.IsNullOrEmpty(message))
            {
                return;
            }
            var log = new TLog
            {
                Date    = DateTime.UtcNow,
                Level   = logLevel.ToString(),
                Logger  = Name,
                Message = message,
                Thread  = eventId.ToString(),
            };

            if (exception != null)
            {
                log.Exception = exception.ToString();
            }
            var httpContext = Services.GetRequiredService <IHttpContextAccessor>()?.HttpContext;

            if (httpContext != null)
            {
                log.UserAgent = httpContext.Request.Headers["User-Agent"];
                log.UserName  = httpContext.User.Identity.Name;
                try
                {
                    log.IpAddress = httpContext.Connection.LocalIpAddress?.ToString();
                }
                catch (ObjectDisposedException)
                {
                    log.IpAddress = "Disposed";
                }
                log.Url        = httpContext.Request.Path;
                log.ServerName = httpContext.Request.Host.Value;
                log.Referrer   = httpContext.Request.Headers["Referer"];
            }
            await DbLog.InsertOneAsync(log);
        }
Ejemplo n.º 12
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            string mensagem = String.Format("{0} : {1} - {2}", logLevel.ToString(), eventId.ToString(), formatter(state, exception));

            this.SalvarNoBanco(mensagem);
        }
Ejemplo n.º 13
0
        protected void lnkSelectEvent_Click(object sender, EventArgs e)
        {
            var lnkEvent = (LinkButton)sender;

            EventId = Convert.ToInt64(lnkEvent.CommandArgument);

            if (!EventValidation())
            {
                EventId = 0;
                return;
            }

            if (RegistrationFlow.AppointmentSlotIds != null && RegistrationFlow.AppointmentSlotIds.Count() > 0)
            {
                var eventSchedulingSlotRepository = IoC.Resolve <IEventSchedulingSlotRepository>();
                var slots = eventSchedulingSlotRepository.GetbyIds(RegistrationFlow.AppointmentSlotIds);
                if (slots.Where(s => s.EventId != EventId).Any())
                {
                    eventSchedulingSlotRepository.ReleaseSlots(RegistrationFlow.AppointmentSlotIds);
                    RegistrationFlow.AppointmentSlotIds = null;
                }
            }

            if (CustomerId > 0)
            {
                hfCustomerID.Value = CustomerId.ToString();
                hidEventID.Value   = EventId.ToString();

                var customerEligibilityRepository = IoC.Resolve <ICustomerEligibilityRepository>();

                var customerEligibility = customerEligibilityRepository.GetByCustomerIdAndYear(Customer.CustomerId, DateTime.Today.Year);

                var eventTestRepository         = IoC.Resolve <IEventTestRepository>();
                var eventTests                  = eventTestRepository.GetEventTestsByEventIds(new[] { EventId });
                var preQualificationTemplateIds = eventTests.Where(x => x.PreQualificationQuestionTemplateId.HasValue).Select(x => x.PreQualificationQuestionTemplateId.Value).ToArray();

                var preQualificationTestTemplateRepository = IoC.Resolve <IPreQualificationTestTemplateRepository>();
                var preQualificationTestTemplates          = preQualificationTestTemplateRepository.GetByIds(preQualificationTemplateIds);

                var selectedTemplateIds = new List <long>(); //preQualificationTestTemplates.Select(x => x.TestId).ToArray();
                foreach (var preQualificationTestTemplate in preQualificationTestTemplates)
                {
                    if (CheckPreApprovedTest(new[] { preQualificationTestTemplate.TestId }))
                    {
                        selectedTemplateIds.Add(preQualificationTestTemplate.Id);
                    }
                }

                hfTemplateIds.Value = string.Join(",", selectedTemplateIds);

                var eventCustomerQuestionAnswerService = IoC.Resolve <IEventCustomerQuestionAnswerService>();
                hfQuestionIdAnswerTestId.Value = eventCustomerQuestionAnswerService.GetQuestionAnswerTestIdString(CustomerId, EventId);

                if (!string.IsNullOrEmpty(Customer.Tag))
                {
                    bool showEligibilityPopup = customerEligibility != null && customerEligibility.IsEligible.HasValue && customerEligibility.IsEligible.Value == false;

                    if (AccountByEventId == null || string.IsNullOrEmpty(AccountByEventId.Tag))
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(string), "js_showTagChangeWarning", "showTagChangeWarning('" + Customer.Tag + "','','" + showEligibilityPopup + "');", true);
                    }
                    else if (Customer.Tag != AccountByEventId.Tag)
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(string), "js_showTagChangeWarning", "showTagChangeWarning('" + Customer.Tag + "','" + AccountByEventId.Tag + "','" + showEligibilityPopup + "','" + AccountByEventId.AllowRegistrationWithImproperTags + "');", true);
                    }
                    else if (Customer.Tag == AccountByEventId.Tag && customerEligibility != null && customerEligibility.IsEligible.HasValue && customerEligibility.IsEligible.Value == false)
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(string), "js_showCustomerNotEligibleWarning", "showCustomerNotEligibleWarning();", true);
                    }
                    else if (selectedTemplateIds.Any())
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(string), "js_getPreQualificationQuestion",
                                                                "getPreQualificationQuestion('" + string.Join(",", selectedTemplateIds) + "');", true);
                    }
                    else if (Customer.Tag == AccountByEventId.Tag)
                    {
                        SelectPackage();
                    }
                }
                else if (customerEligibility != null && customerEligibility.IsEligible.HasValue && customerEligibility.IsEligible.Value == false)
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "js_showCustomerNotEligibleWarning", "showCustomerNotEligibleWarning();", true);
                }
                else if (selectedTemplateIds.Any())
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "js_getPreQualificationQuestion",
                                                            "getPreQualificationQuestion('" + string.Join(",", selectedTemplateIds) + "');", true);
                }
                else
                {
                    SelectPackage();
                }
            }
            else
            {
                SelectPackage();
            }
        }
Ejemplo n.º 14
0
 protected BaseMessage()
 {
     EventId     = Guid.NewGuid();
     MessageId   = EventId.ToString();
     ContentName = GetType().Name;
 }
Ejemplo n.º 15
0
 private void LogTypeError(EventId eventId, HandleType handleType, Delegate targetEventType, Delegate listener)
 {
     Debug.LogError(string.Format("## Event Id {0}, [{1}] Wrong Listener Type {2}, needed Type {3}.", eventId.ToString(),
                                  EventSystemDefine.dicHandleType[(int)handleType],
                                  targetEventType.GetType(),
                                  listener.GetType()));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Adiciona código de erro na exceção a partir do evento ocorrido
 /// </summary>
 /// <param name="exception">Exceção ocorrida</param>
 /// <param name="eventId">Evento que será utilizado como base para o código de erro</param>
 public static void AddErrorCode(this Exception exception, EventId eventId)
 {
     AddErrorCode(exception, eventId.ToString());
 }
Ejemplo n.º 17
0
        public void TriggerEvent(EventId eventId)
        {
            Delegate del = null;

            if (_dicEvents.TryGetValue((int)eventId, out del))
            {
                if (del == null)
                {
                    return;
                }

                Delegate[] invocationList = del.GetInvocationList();
                for (int i = 0; i < invocationList.Length; i++)
                {
                    Action action = invocationList[i] as Action;
                    if (action == null)
                    {
                        Debug.LogErrorFormat("## Trigger Event {0} Parameters type [void] are not match  target type : {1}.", eventId.ToString(), invocationList[i].GetType());
                        return;
                    }
                    action();
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        ///   Formats the value of the specified <paramref name="item" /> into an HTML paragraph tag. Example: If
        ///   <paramref name="item" /> = ErrorItem.StackTrace, the action stack trace data associated with the current error
        ///   is returned as the content of the tag. If present, line breaks (\r\n) are converted to &lt;br /&gt; tags.
        /// </summary>
        /// <param name="item">
        ///   The enum value indicating the error item to be used as the content of the paragraph element.
        ///   The text is HTML encoded.
        /// </param>
        /// <returns>Returns an HTML paragraph tag.</returns>
        public string ToHtmlValue(EventItem item)
        {
            switch (item)
            {
            case EventItem.EventId:
                return(ToHtmlParagraph(EventId.ToString(CultureInfo.InvariantCulture)));

            case EventItem.EventType:
                return(ToHtmlParagraph(EventType.ToString()));

            case EventItem.Url:
                return(ToHtmlParagraph(Url));

            case EventItem.Timestamp:
                return(ToHtmlParagraph(TimestampUtc.ToString(CultureInfo.CurrentCulture)));

            case EventItem.ExType:
                return(ToHtmlParagraph(ExType));

            case EventItem.Message:
                return(ToHtmlParagraph(Message));

            case EventItem.ExSource:
                return(ToHtmlParagraph(ExSource));

            case EventItem.ExTargetSite:
                return(ToHtmlParagraph(ExTargetSite));

            case EventItem.ExStackTrace:
                return(ToHtmlParagraph(ExStackTrace));

            case EventItem.ExData:
                return(ToHtmlParagraphs(EventData));

            case EventItem.InnerExType:
                return(ToHtmlParagraph(InnerExType));

            case EventItem.InnerExMessage:
                return(ToHtmlParagraph(InnerExMessage));

            case EventItem.InnerExSource:
                return(ToHtmlParagraph(InnerExSource));

            case EventItem.InnerExTargetSite:
                return(ToHtmlParagraph(InnerExTargetSite));

            case EventItem.InnerExStackTrace:
                return(ToHtmlParagraph(InnerExStackTrace));

            case EventItem.InnerExData:
                return(ToHtmlParagraphs(InnerExData));

            case EventItem.GalleryId:
                return(ToHtmlParagraph(GalleryId.ToString(CultureInfo.InvariantCulture)));

            case EventItem.HttpUserAgent:
                return(ToHtmlParagraph(HttpUserAgent));

            case EventItem.FormVariables:
                return(ToHtmlParagraphs(FormVariables));

            case EventItem.Cookies:
                return(ToHtmlParagraphs(Cookies));

            case EventItem.SessionVariables:
                return(ToHtmlParagraphs(SessionVariables));

            case EventItem.ServerVariables:
                return(ToHtmlParagraphs(ServerVariables));

            default:
                throw new BusinessException(String.Format(CultureInfo.CurrentCulture, "Encountered unexpected EventItem enum value {0}. Event.ToHtmlValue() is not designed to handle this enum value. The function must be updated.", item));
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Wrapper for the the google.earth.addEventListener method
        /// </summary>
        /// <param name="feature">The target feature</param>
        /// <param name="action">The event Id</param>
        /// <param name="callback">Optional, the name of javascript callback function to use, or an anonymous function</param>
        /// <param name="useCapture">Optionally use event capture</param>
        /// <example>GEWebBrowser.AddEventListener(object, "click", "someFunction");</example>
        /// <example>GEWebBrowser.AddEventListener(object, "click", "function(event){alert(event.getType);}");</example>
        public void AddEventListener(object feature, EventId action, string callback = null, bool useCapture = false)
        {
            if (!string.IsNullOrEmpty(callback))
            {
                callback = "_x=" + callback;
            }

            object[] args = new object[]
            { 
                feature, 
                feature.GetHashCode(), 
                action.ToString().ToUpperInvariant(), 
                callback,
                useCapture 
            };

            this.InvokeJavaScript(JSFunction.AddEventListener, args);
        }
Ejemplo n.º 20
0
 public override string ToString()
 {
     return(val.ToString());
 }
 /// <summary>
 /// Wrapper for the the google.earth.addEventListener method
 /// </summary>
 /// <param name="feature">The target feature</param>
 /// <param name="action">The event Id</param>
 /// <param name="callback">Optional, the name of JavaScript callback function to use, or an anonymous function</param>
 /// <param name="useCapture">Optionally use event capture</param>
 /// <example>GEWebBrowser.AddEventListener(object, "click", "someFunction");</example>
 /// <example>GEWebBrowser.AddEventListener(object, "click", "function(event){alert(event.getType);}");</example>
 public void AddEventListener(object feature, EventId action, string callback = null, bool useCapture = false)
 {
     this.InvokeJavaScript(
         JSFunction.AddEventListener,
         feature,
         feature.GetHashCode(),
         action.ToString().ToUpperInvariant(),
         callback,
         useCapture);
 }
Ejemplo n.º 22
0
        public void AssertThat_EventId_StringRepresentation_IsMeaningful()
        {
            var eventId = new EventId(42, "event");

            Assert.Equal("<42::event>", eventId.ToString());
        }