コード例 #1
0
        /// <summary>
        /// Sets the Goal Met
        /// </summary>
        /// <param name="currentItem"></param>
        /// <param name="linkedItem"></param>
        /// <param name="goalItem"></param>
        /// <param name="visitId"></param>
        /// <param name="visitorId"></param>
        /// <returns></returns>
        public bool SetGoalMet(Item currentItem, Item linkedItem, Item goalItem, Guid visitId, Guid visitorId)
        {
            try
            {
                using (AnalyticsDataContext AnalyticsDataContext = new AnalyticsDataContext(ConfigurationManager.ConnectionStrings["analytics"].ConnectionString))
                {
                    //check to see if page exists
                    Page currentPage = AnalyticsDataContext.Pages.Where(x => x.ItemId == currentItem.ID.Guid && x.VisitId == visitId).FirstOrDefault();
                    if(currentPage == null)
                    {
                        Logger.Error("Page Statistics Context - Could not retrieve page");
                        return false;
                    }

                    PageEventDefinition pageEventDefinition = AnalyticsDataContext.PageEventDefinitions.Where(x => x.Name == goalItem.Name).FirstOrDefault();
                    if(pageEventDefinition == null)
                    {
                        Logger.Error("Page Statistics Context - Could not retrieve page event definition: " + goalItem.Name);
                        return false;
                    }

                    //verify there is not already a page event
                    PageEvent existantPageEvent = AnalyticsDataContext.PageEvents.
                        Where(x => x.VisitId == visitId &&
                                    x.PageId == currentPage.PageId &&
                                    x.PageEventDefinitionId == pageEventDefinition.PageEventDefinitionId &&
                                    x.ItemId == linkedItem.ID.Guid).FirstOrDefault();

                    if(existantPageEvent != null)
                    {
                        Logger.Warn("Page Statistics Context - Page event already exists");
                        return false;
                    }

                    //insert page event
                    try
                    {
                        Guid pageEventId = Guid.NewGuid();

                        PageEvent pageEvent = new PageEvent();
                        pageEvent.PageEventId = pageEventId;
                        pageEvent.VisitId = visitId;
                        pageEvent.VisitorId = visitorId;
                        pageEvent.PageEventDefinitionId = pageEventDefinition.PageEventDefinitionId;
                        pageEvent.PageEventDefinition = pageEventDefinition;
                        pageEvent.PageId = currentPage.PageId;
                        pageEvent.Page = currentPage;
                        pageEvent.ItemId = linkedItem.ID.Guid;
                        pageEvent.IntegrationId = Guid.Empty;
                        pageEvent.DataKey = linkedItem.Paths.FullPath;
                        pageEvent.DateTime = DateTime.Now.ToUniversalTime();
                        pageEvent.DataCode = 0;
                        pageEvent.CustomSorting = 0;
                        pageEvent.IntegrationLabel = string.Empty;
                        pageEvent.Data = string.Empty;
                        pageEvent.Timestamp = 634891148665341607;
                        pageEvent.Text = string.Empty;

                        AnalyticsDataContext.PageEvents.InsertOnSubmit(pageEvent);
                        AnalyticsDataContext.SubmitChanges();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("Page Statistics Context - Could not create page record");
                        Logger.Error(ex.Message);
                        Logger.Error(ex.InnerException);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error("Page Statistics Context - Could not set goal met");
                Logger.Error(e.Message);
                Logger.Error(e.InnerException);
            }

            return false;
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="ev"></param>
 public UnhandledPageThrowException(PageEvent ev)
     : base(ev.Event + ": " + ev.Message)
 {
     Event = ev;
 }
コード例 #3
0
ファイル: Browser.cs プロジェクト: shekky/ChromeHtmlToPdf
        /// <summary>
        ///     Instructs Chrome to navigate to the given <paramref name="uri" />
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="countdownTimer">If a <see cref="CountdownTimer"/> is set then
        ///     the method will raise an <see cref="ConversionTimedOutException"/> if the
        ///     <see cref="CountdownTimer"/> reaches zero before finishing navigation</param>
        /// <param name="mediaLoadTimeout">When set a timeout will be started after the DomContentLoaded
        ///     event has fired. After a timeout the NavigateTo method will exit as if the page
        ///     has been completely loaded</param>
        /// <param name="urlBlacklist">A list of URL's that need to be blocked (use * as a wildcard)</param>
        /// <exception cref="ChromeException">Raised when an error is returned by Chrome</exception>
        /// <exception cref="ConversionTimedOutException">Raised when <paramref name="countdownTimer"/> reaches zero</exception>
        public void NavigateTo(
            Uri uri,
            CountdownTimer countdownTimer = null,
            int?mediaLoadTimeout          = null,
            List <string> urlBlacklist    = null)
        {
            var waitEvent = new ManualResetEvent(false);
            var mediaLoadTimeoutCancellationTokenSource = new CancellationTokenSource();
            var absoluteUri         = uri.AbsoluteUri.Substring(0, uri.AbsoluteUri.LastIndexOf('/') + 1);
            var navigationError     = string.Empty;
            var waitforNetworkIdle  = false;
            var mediaTimeoutTaskSet = false;

            var messageHandler = new EventHandler <string>(delegate(object sender, string data)
            {
                //System.IO.File.AppendAllText("d:\\logs.txt", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff") + " - " + data + Environment.NewLine);
                var message = Message.FromJson(data);

                switch (message.Method)
                {
                case "Fetch.requestPaused":
                    {
                        var fetch     = Fetch.FromJson(data);
                        var requestId = fetch.Params.RequestId;
                        var url       = fetch.Params.Request.Url;

                        if (!RegularExpression.IsRegExMatch(urlBlacklist, url, out var matchedPattern) ||
                            url.StartsWith(absoluteUri, StringComparison.InvariantCultureIgnoreCase))
                        {
                            WriteToLog($"The url '{url}' has been allowed");
                            var fetchContinue = new Message {
                                Method = "Fetch.continueRequest"
                            };
                            fetchContinue.Parameters.Add("requestId", requestId);
                            _pageConnection.SendAsync(fetchContinue).GetAwaiter();
                        }
                        else
                        {
                            WriteToLog($"The url '{url}' has been blocked by url blacklist pattern '{matchedPattern}'");

                            var fetchFail = new Message {
                                Method = "Fetch.failRequest"
                            };
                            fetchFail.Parameters.Add("requestId", requestId);

                            // Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused,
                            // ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable,
                            // BlockedByClient, BlockedByResponse
                            fetchFail.Parameters.Add("errorReason", "BlockedByClient");
                            _pageConnection.SendAsync(fetchFail).GetAwaiter();
                        }

                        break;
                    }

                default:
                    {
                        var page = PageEvent.FromJson(data);

                        switch (page.Method)
                        {
                        // The DOMContentLoaded event is fired when the document has been completely loaded and parsed, without
                        // waiting for stylesheets, images, and sub frames to finish loading (the load event can be used to
                        // detect a fully-loaded page).
                        case "Page.lifecycleEvent" when page.Params?.Name == "DOMContentLoaded":
                            if (mediaLoadTimeout.HasValue && !mediaTimeoutTaskSet)
                            {
                                try
                                {
                                    Task.Run(async delegate
                                    {
                                        await Task.Delay(mediaLoadTimeout.Value, mediaLoadTimeoutCancellationTokenSource.Token);
                                        WriteToLog($"Media load timed out after {mediaLoadTimeout.Value} milliseconds");
                                        waitEvent?.Set();
                                    }, mediaLoadTimeoutCancellationTokenSource.Token);

                                    mediaTimeoutTaskSet = true;
                                }
                                catch
                                {
                                    // Ignore
                                }
                            }

                            break;

                        case "Page.frameNavigated":
                            WriteToLog("The 'Page.frameNavigated' event has been fired, waiting for the 'Page.lifecycleEvent' with name 'networkIdle'");
                            waitforNetworkIdle = true;
                            break;

                        case "Page.lifecycleEvent" when page.Params?.Name == "networkIdle" && waitforNetworkIdle:
                            WriteToLog("The 'Page.lifecycleEvent' event with name 'networkIdle' has been fired, the page is now fully loaded");
                            waitEvent?.Set();
                            break;

                        default:
                            var pageNavigateResponse = PageNavigateResponse.FromJson(data);
                            if (!string.IsNullOrEmpty(pageNavigateResponse.Result?.ErrorText) &&
                                !pageNavigateResponse.Result.ErrorText.Contains("net::ERR_BLOCKED_BY_CLIENT"))
                            {
                                navigationError = $"{pageNavigateResponse.Result.ErrorText} occured when navigating to the page '{uri}'";
                                waitEvent?.Set();
                            }

                            break;
                        }

                        break;
                    }
                }
            });

            _pageConnection.MessageReceived += messageHandler;
            _pageConnection.Closed          += (sender, args) => waitEvent?.Set();

            // Enable Fetch when we want to blacklist certain URL's
            if (urlBlacklist?.Count > 0)
            {
                WriteToLog("Enabling Fetch to block url's that are in the url blacklist'");
                _pageConnection.SendAsync(new Message {
                    Method = "Fetch.enable"
                }).GetAwaiter();
            }

            _pageConnection.SendAsync(new Message {
                Method = "Page.enable"
            }).GetAwaiter();

            var lifecycleEventEnabledMessage = new Message {
                Method = "Page.setLifecycleEventsEnabled"
            };

            lifecycleEventEnabledMessage.AddParameter("enabled", true);
            _pageConnection.SendAsync(lifecycleEventEnabledMessage).GetAwaiter();

            var pageNavigateMessage = new Message {
                Method = "Page.navigate"
            };

            pageNavigateMessage.AddParameter("url", uri.ToString());

            _pageConnection.SendAsync(pageNavigateMessage).GetAwaiter();

            if (countdownTimer != null)
            {
                waitEvent.WaitOne(countdownTimer.MillisecondsLeft);
                if (countdownTimer.MillisecondsLeft == 0)
                {
                    throw new ConversionTimedOutException($"The {nameof(NavigateTo)} method timed out");
                }
            }
            else
            {
                waitEvent.WaitOne();
            }

            _pageConnection.MessageReceived -= messageHandler;

            if (mediaTimeoutTaskSet)
            {
                mediaLoadTimeoutCancellationTokenSource.Cancel();
                mediaLoadTimeoutCancellationTokenSource.Dispose();
            }

            var lifecycleEventDisableddMessage = new Message {
                Method = "Page.setLifecycleEventsEnabled"
            };

            lifecycleEventDisableddMessage.AddParameter("enabled", false);

            _pageConnection.SendAsync(lifecycleEventDisableddMessage).GetAwaiter();
            _pageConnection.SendAsync(new Message {
                Method = "Page.disable"
            }).GetAwaiter();

            // Disable Fetch again if it was enabled
            if (urlBlacklist?.Count > 0)
            {
                _pageConnection.SendAsync(new Message {
                    Method = "Fetch.disable"
                }).GetAwaiter();
            }

            waitEvent.Dispose();
            waitEvent = null;

            if (!string.IsNullOrEmpty(navigationError))
            {
                WriteToLog(navigationError);
                throw new ChromeNavigationException(navigationError);
            }
        }
コード例 #4
0
        private void Page_Load(object sender, EventArgs e)
        {   //**NB** GP: Added This Code To Ignore Certificate Validation In Staging ** Has To Be Removed When Code Is Published
            ServicePointManager.ServerCertificateValidationCallback = ((sender1, certificate, chain, sslPolicyErrors) => true);
            {
                try
                {
                    XmlDocument   Action_14     = new XmlDocument();
                    StringWriter  stringWriter  = new StringWriter();
                    XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);

                    Action_14.Load(ThreeDSecureLoopUp14);
                    Action_14.WriteTo(xmlTextWriter);

                    string WS_Action14 = stringWriter.ToString();

                    MyGate_Global_3D_Secure_Enterprise_Example.API.APIServiceClient MGAPI = new MyGate_Global_3D_Secure_Enterprise_Example.API.APIServiceClient();

                    try
                    {
                        var ThreeDSecure_LookUp_Response = MGAPI.execRequest(WS_Action14);

                        try
                        {
                            if (ThreeDSecure_LookUp_Response.status.Equals("-1"))
                            {
                                Response.Write("<br />");
                                Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                Response.Write("<tr>");
                                Response.Write("<td align='center' colspan='2' style='background-color:Red; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>*** E R R O R S ** D U R R I N G **  I N V O K A T I O N ***</b></font></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Error Code :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + ThreeDSecure_LookUp_Response.errors.error.code + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Error Desc :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecure_LookUp_Response.errors.error.message + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Remidiate Action :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecure_LookUp_Response.errors.error.description + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>DateTime :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecure_LookUp_Response.dtResponseSent + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>TransactionIndex :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecure_LookUp_Response.uidTransactionIndex + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td  align='center'><a href='http://localhost:33213/Response_SubData/UpdateXML.aspx'><button>Show SubMission Data</button></a></td>");
                                Response.Write("</tr>");
                                Response.Write("</table>");
                            }
                            else
                            {
                                try
                                {
                                    //CARD HOLDER ENROLLED
                                    if (ThreeDSecure_LookUp_Response.tdsLookup.enrolled.Equals("Y"))
                                    {
                                        Response.Write("<br />");
                                        Response.Write("<form name='frmLaunchACS' runat ='server' method='POST' action='" + ThreeDSecure_LookUp_Response.tdsLookup.acsUrl + "'>");
                                        Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                        Response.Write("<tr>");
                                        Response.Write("<td align='center' colspan='2' style='background-color:Green; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>** POST ** DATA ** TO ** ACS ** *** ** CARD ** HOLDER ** ENROLLED **</b></font></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>PaReq :<font><font color='FFFFFF'>__________</font></div></td>");
                                        Response.Write("<td ><textarea cols='50' rows='5' style='width:550' name='PaReq' >" + ThreeDSecure_LookUp_Response.tdsLookup.payload + "</textarea></textarea></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>TermUrl :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:550' name='TermUrl' value='" + ACSCallbackURL + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>MD :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:550' name='MD' value='" + ThreeDSecure_LookUp_Response.uidTransactionIndex + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td colspan='2' align='center'><input type='submit' value='Submit Form' runat= server'style='width:250'></td>");
                                        Response.Write("</tr>");
                                        Response.Write("</table>");
                                        Response.Write("</form>");
                                    }
                                    else
                                    {
                                        try
                                        {   //CARD HOLDER NOT ENROLLED OR UNDEFINED
                                            if (ThreeDSecure_LookUp_Response.tdsLookup.enrolled.Equals("N") || ThreeDSecure_LookUp_Response.tdsLookup.enrolled.Equals("U"))
                                            {
                                                Response.Write("<br />");
                                                Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                                Response.Write("<tr>");
                                                Response.Write("<td align='center' colspan='2' style='background-color:Green; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>*** LOOKUP RESULTS *** CARD ** HOLDER ** NOT ENROLLED ***</b></font></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>Enrolled :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecure_LookUp_Response.tdsLookup.enrolled + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>ECI Flag :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + ThreeDSecure_LookUp_Response.tdsLookup.eciFlag + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>Auth Required :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + ThreeDSecure_LookUp_Response.tdsLookup.authRequired + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>Liability Shift :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + ThreeDSecure_LookUp_Response.tdsLookup.liabilityShift + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>DateTime :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + ThreeDSecure_LookUp_Response.dtResponseSent + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>TransactionIndex :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='TransactionIndex' value='" + ThreeDSecure_LookUp_Response.uidTransactionIndex + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td ><div align='left'>Message :</div></td>");
                                                Response.Write("<td ><input type='text' style='width:572' name='Message' value='" + ThreeDSecure_LookUp_Response.tdsLookup.message + "'/></td>");
                                                Response.Write("</tr>");
                                                Response.Write("<tr>");
                                                Response.Write("<td  align='center'><a href='http://localhost:33213/Response_SubData/UpdateXML.aspx'><button>Show SubMission Data</button></a></td>");
                                                Response.Write("</tr>");
                                                Response.Write("</table>");
                                            }
                                        }
                                        catch (InvalidDataException DataMissMatch)
                                        {
                                            PageEvent.LogErrorIntoTextFile(DataMissMatch, "ThreeDSecure_14: ThreeDSecure_LookUp_Response");
                                        }
                                    }
                                }
                                catch (XmlException WriteRequestData)
                                {
                                    PageEvent.LogErrorIntoTextFile(WriteRequestData, "ThreeDSecure_14: RequestXML_14.Load(Action_14_3DSLookUp)");
                                }
                            }
                        }
                        catch (HttpRequestValidationException requestVarrialbes)
                        {
                            PageEvent.LogErrorIntoTextFile(requestVarrialbes, "ThreeDSecure_14: ThreeDSecure");
                        }
                    }
                    catch (DataMisalignedException Response)
                    {
                        PageEvent.LogErrorIntoTextFile(Response, "ThreeDSecure_14: Error Mapping Response To Action 15 XML");
                    }
                }
                catch (NullReferenceException ResError)
                {
                    PageEvent.LogErrorIntoTextFile(ResError, "ThreeDSecure_14: Error Retrieving Response From WebService Action 14");
                }
            }
        }
コード例 #5
0
        public bool Approve(int id, int approvalId, string userId)
        {
            var eventVer = _db.PageEventVersions.First(d => d.Id == id);

            if (eventVer != null)
            {
                var       pageRouteId = _db.PageRouteVersions.Find(eventVer.PageRouteVersionId).PageRouteId;
                PageEvent pageEvent;
                if (eventVer.ChangeActionEnum == ChangeActionEnum.New)
                {
                    pageEvent = new PageEvent
                    {
                        ApprovalDate     = DateTime.Now,
                        ApprovedById     = userId,
                        ArDescription    = eventVer.ArDescription,
                        CreatedById      = eventVer.CreatedById,
                        ArTitle          = eventVer.ArTitle,
                        CreationDate     = eventVer.CreationDate,
                        EnDescription    = eventVer.EnDescription,
                        EnTitle          = eventVer.EnTitle,
                        IsActive         = eventVer.IsActive,
                        IsDeleted        = false,
                        PageRouteId      = pageRouteId.Value,
                        ArAddress        = eventVer.ArAddress,
                        ArImageAlt       = eventVer.ArImageAlt,
                        ArUrl            = eventVer.ArUrl,
                        EnAddress        = eventVer.EnAddress,
                        EnImageAlt       = eventVer.EnImageAlt,
                        EnUrl            = eventVer.EnUrl,
                        EventCaption     = eventVer.EventCaption,
                        EventDateColor   = eventVer.EventDateColor,
                        EventEndDate     = eventVer.EventEndDate,
                        EventLat         = eventVer.EventLat,
                        EventLocation    = eventVer.EventLocation,
                        EventLocationUrl = eventVer.EventLocationUrl,
                        EventLon         = eventVer.EventLon,
                        EventSocialLinks = eventVer.EventSocialLinks,
                        EventStartDate   = eventVer.EventStartDate,
                        Order            = eventVer.Order,
                        SeoDescriptionAR = eventVer.SeoDescriptionAR,
                        SeoDescriptionEN = eventVer.SeoDescriptionEN,
                        SeoOgTitleAR     = eventVer.SeoOgTitleAR,
                        SeoOgTitleEN     = eventVer.SeoOgTitleEN,
                        SeoTitleAR       = eventVer.SeoTitleAR,
                        SeoTitleEN       = eventVer.SeoTitleEN,
                        SeoTwitterCardAR = eventVer.SeoTwitterCardAR,
                        SeoTwitterCardEN = eventVer.SeoTwitterCardEN,
                        ShowInHome       = eventVer.ShowInHome
                    };
                    _db.PageEvents.Add(pageEvent);
                }
                else if (eventVer.ChangeActionEnum == ChangeActionEnum.Update)
                {
                    pageEvent = _db.PageEvents.Find(eventVer.PageEventId);
                    pageEvent.ApprovalDate     = DateTime.Now;
                    pageEvent.ApprovedById     = userId;
                    pageEvent.ArDescription    = eventVer.ArDescription;
                    pageEvent.CreatedById      = eventVer.CreatedById;
                    pageEvent.ArTitle          = eventVer.ArTitle;
                    pageEvent.CreationDate     = eventVer.CreationDate;
                    pageEvent.EnDescription    = eventVer.EnDescription;
                    pageEvent.EnTitle          = eventVer.EnTitle;
                    pageEvent.IsActive         = eventVer.IsActive;
                    pageEvent.IsDeleted        = false;
                    pageEvent.PageRouteId      = pageRouteId.Value;
                    pageEvent.ArAddress        = eventVer.ArAddress;
                    pageEvent.ArImageAlt       = eventVer.ArImageAlt;
                    pageEvent.ArUrl            = eventVer.ArUrl;
                    pageEvent.EnAddress        = eventVer.EnAddress;
                    pageEvent.EnImageAlt       = eventVer.EnImageAlt;
                    pageEvent.EnUrl            = eventVer.EnUrl;
                    pageEvent.EventCaption     = eventVer.EventCaption;
                    pageEvent.EventDateColor   = eventVer.EventDateColor;
                    pageEvent.EventEndDate     = eventVer.EventEndDate;
                    pageEvent.EventLat         = eventVer.EventLat;
                    pageEvent.EventLocation    = eventVer.EventLocation;
                    pageEvent.EventLocationUrl = eventVer.EventLocationUrl;
                    pageEvent.EventLon         = eventVer.EventLon;
                    pageEvent.EventSocialLinks = eventVer.EventSocialLinks;
                    pageEvent.EventStartDate   = eventVer.EventStartDate;
                    pageEvent.Order            = eventVer.Order;
                    pageEvent.SeoDescriptionAR = eventVer.SeoDescriptionAR;
                    pageEvent.SeoDescriptionEN = eventVer.SeoDescriptionEN;
                    pageEvent.SeoOgTitleAR     = eventVer.SeoOgTitleAR;
                    pageEvent.SeoOgTitleEN     = eventVer.SeoOgTitleEN;
                    pageEvent.SeoTitleAR       = eventVer.SeoTitleAR;
                    pageEvent.SeoTitleEN       = eventVer.SeoTitleEN;
                    pageEvent.SeoTwitterCardAR = eventVer.SeoTwitterCardAR;
                    pageEvent.SeoTwitterCardEN = eventVer.SeoTwitterCardEN;
                    pageEvent.ShowInHome       = eventVer.ShowInHome;
                    _db.PageEvents.Update(pageEvent);
                }
                else
                {
                    pageEvent           = _db.PageEvents.Find(eventVer.PageEventId);
                    pageEvent.IsDeleted = true;
                    _db.PageEvents.Update(pageEvent);
                }
                _db.SaveChanges();
                eventVer.VersionStatusEnum = VersionStatusEnum.Approved;
                eventVer.PageEventId       = pageEvent.Id;
                _db.PageEventVersions.Update(eventVer);

                var notification = _db.ApprovalNotifications.Find(approvalId);
                notification.VersionStatusEnum = VersionStatusEnum.Approved;
                _db.ApprovalNotifications.Update(notification);

                var submittedEvents = _db.PageEventVersions.Where(d => d.PageRouteVersionId == eventVer.PageRouteVersionId && d.Id != id &
                                                                  d.VersionStatusEnum == VersionStatusEnum.Submitted).Any();
                if (!submittedEvents)
                {
                    var pageVer = _db.PageRouteVersions.Find(eventVer.PageRouteVersionId);
                    pageVer.ContentVersionStatusEnum = VersionStatusEnum.Approved;
                    _db.PageRouteVersions.Update(pageVer);
                }
                _db.SaveChanges();

                return(true);
            }
            return(false);
        }
コード例 #6
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console()
            {
                Items = new List <IConsoleItem>(), Title = "Shiba Processor"
            };;

            //TODO: strings should be variables
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "GetImage", DisplayText = "Get Image", Enabled = true, RaisesPostBack = true
            });
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "Correct", DisplayText = "Mark as Correct", Enabled = true, RaisesPostBack = true
            });
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "FalseNegative", DisplayText = "Mark as False Negative", Enabled = true, RaisesPostBack = true
            });
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "FalsePositive", DisplayText = "Mark as False Positive", Enabled = true, RaisesPostBack = true
            });

            var viewImageButton = new ConsoleButton
            {
                Name           = "ViewImage",
                DisplayText    = "View Image",
                ToolTip        = "View Image",
                RaisesPostBack = false,
                Enabled        = true
            };

            var imageLocation = String.Empty;

            DTOs.FieldValue field;

            using (IRSAPIClient proxy = Helper.GetServicesManager().CreateProxy <IRSAPIClient>(ExecutionIdentity.System))
            {
                //Set the proxy to use the current workspace
                proxy.APIOptions.WorkspaceID = Helper.GetActiveCaseID();

                var imageArtifactId = ActiveArtifact.ArtifactID;
                var rdoToRead       = proxy.Repositories.RDO.ReadSingle(imageArtifactId);
                rdoToRead.ArtifactTypeGuids.Add(Helpers.Constants.IMAGE_OBJECT_GUID);
                field = rdoToRead.Fields.Get(Shibativity.Helpers.Constants.IMAGE_URL_FIELD_GUID);
            }

            if (field.Value == null)
            {
                return(returnConsole);
            }
            imageLocation = field.Value.ToString();

            var openImageWindowJavaScript = $"window.open('{imageLocation}', '', 'location=no,scrollbars=no,menubar=no,toolbar=no,status=no,resizable=yes,width=800,height=800');";

            viewImageButton.OnClickEvent = openImageWindowJavaScript;
            returnConsole.Items.Add(viewImageButton);

            return(returnConsole);
        }
コード例 #7
0
 public XPage()
 {
     this.AutoDataBindingEvent = PageEvent.PreRender;
 }
コード例 #8
0
        public override Console GetConsole(PageEvent pageEvent)
        {
            SvcManager            = Helper.GetServicesManager();
            WorkspaceArtifactId   = Application.ArtifactID;
            Identity              = ExecutionIdentity.CurrentUser;
            CurrentArtifactId     = ActiveArtifact.ArtifactID;
            CurrentUserArtifactId = Helper.GetAuthenticationManager().UserInfo.ArtifactID;
            DbContextWorkspace    = Helper.GetDBContext(WorkspaceArtifactId);
            DbContextEdds         = Helper.GetDBContext(-1);

            var console = new Console {
                Items = new List <IConsoleItem>(), Title = "Manage Redaction Import Job"
            };

            var validateButton = new ConsoleButton
            {
                Name           = Constant.Buttons.VALIDATE,
                DisplayText    = "Validate",
                ToolTip        = "Click here to validate that redactions and documents exist before importing.",
                RaisesPostBack = true
            };

            var submitButton = new ConsoleButton
            {
                Name           = Constant.Buttons.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to add this Import job to the queue.",
                RaisesPostBack = true
            };

            var cancelButton = new ConsoleButton
            {
                Name           = Constant.Buttons.CANCEL,
                DisplayText    = "Cancel",
                ToolTip        = "Click here to remove this Import job from the queue.",
                RaisesPostBack = true
            };

            // *******************************************************************************************************
            //
            //       *********
            //       *       *
            //  *********    *
            //  *    *  *    *
            //  *    *********
            //  *       *
            //  *********
            //
            //  This functionality currently needs to be completed.
            //
            //  If you are interested in building this functionality, please make sure to write associated unit tests.
            //  The basic concept is that the Import Worker Agent will retrieve all the redactrions that were imported
            //  for the selected job and delete them from the Redaction table.
            // *******************************************************************************************************
            //var revertButton = new ConsoleButton
            //{
            //	Name = Constant.Buttons.REVERT,
            //	DisplayText = "Revert",
            //	ToolTip = "Click here to remove redactions created by this job.",
            //	RaisesPostBack = true
            //};

            if (pageEvent == PageEvent.PreRender)
            {
                var jobStatus = ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.MarkupUtilityImportJob.Status)].Value.Value.ToString();
                SetButtonState(jobStatus, validateButton, submitButton, cancelButton);
            }

            console.Items.Add(validateButton);
            console.Items.Add(submitButton);
            console.Items.Add(cancelButton);
            //TODO - Complete Revert functionality
            //console.Items.Add(revertButton);
            console.AddRefreshLinkToConsole().Enabled = true;

            return(console);
        }
コード例 #9
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string MD    = Request.Form["MD"];
                string PaRes = Request.Form["PaRes"];

                try
                {
                    XmlDocument Action15_XML = new XmlDocument();
                    Action15_XML.Load(ThreeDSecure15);
                    Action15_XML.SelectSingleNode("//transactionIndex").InnerText = MD;
                    Action15_XML.SelectSingleNode("//paresPayload").InnerText     = PaRes;
                    Action15_XML.Save(ThreeDSecure15);

                    try
                    {
                        XmlDocument   Action_15     = new XmlDocument();
                        StringWriter  stringWriter  = new StringWriter();
                        XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);

                        Action_15.Load(ThreeDSecure15);
                        Action_15.WriteTo(xmlTextWriter);

                        string WS_Action15 = stringWriter.ToString();

                        //**NB** GP: Added This Code To Ignore Certificate Validation In Staging ** Has To Be Removed When Code Is Published
                        ServicePointManager.ServerCertificateValidationCallback = ((sender1, certificate, chain, sslPolicyErrors) => true);

                        MyGate_Global_3D_Secure_Enterprise_Example.Authenticate.APIServiceClient ThreeDSecureAuthenticate = new MyGate_Global_3D_Secure_Enterprise_Example.Authenticate.APIServiceClient();

                        try
                        {
                            var ThreeDSecureAuthenticateResponse = ThreeDSecureAuthenticate.execRequest(WS_Action15);

                            if (ThreeDSecureAuthenticateResponse.status.Equals("0"))
                            {
                                Response.Write("<br />");
                                Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                Response.Write("<tr>");
                                Response.Write("<td align='center' colspan='2' style='background-color:Green; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>*** AUTHENTICATION RESULTS *** CARD ** HOLDER ** ENROLLED ***</b></font></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>cavv :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='cavv' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.cavv + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>code :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Code' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.code + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>eciFlag :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='eciFlag' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.eciFlag + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Liability Shift :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Liability Shift' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.liabilityShift + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>message :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='message' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.message + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>ParesStatus :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='ParesStatus' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.paresStatus + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>signatureVerification :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='signatureVerification' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.signatureVerification + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>xid :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='xid' value='" + ThreeDSecureAuthenticateResponse.tdsAuth.xid + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td  align='center'><a href='http://localhost:33213/Response_SubData/UpdateXML.aspx'><button>ShowAllSubMissionData</button></a></td>");
                                Response.Write("</tr>");
                                Response.Write("</table>");
                            }
                            else

                            if (ThreeDSecureAuthenticateResponse.status.Equals("-1"))
                            {
                                Response.Write("<br />");
                                Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                Response.Write("<tr>");
                                Response.Write("<td align='center' colspan='2' style='background-color:Red; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>*** E R R O R S ** D U R R I N G **  I N V O K A T I O N ***</b></font></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Error Code :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + ThreeDSecureAuthenticateResponse.errors.error.code + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Error Desc :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecureAuthenticateResponse.errors.error.message + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>Remidiate Action :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecureAuthenticateResponse.errors.error.description + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>DateTime :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecureAuthenticateResponse.dtResponseSent + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td ><div align='left'>TransactionIndex :</div></td>");
                                Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + ThreeDSecureAuthenticateResponse.uidTransactionIndex + "'/></td>");
                                Response.Write("</tr>");
                                Response.Write("<tr>");
                                Response.Write("<td  align='center'><a href='http://localhost:33213/Response_SubData/UpdateXML.aspx'><button>Show SubMission Data</button></a></td>");
                                Response.Write("</tr>");
                                Response.Write("</table>");
                            }
                        }
                        catch (HttpRequestValidationException CallWS_ACT15_PostConstruction)
                        {
                            PageEvent.LogErrorIntoTextFile(CallWS_ACT15_PostConstruction, "ThreeDSecure_15: CallWS_ACT15_PostConstruction");
                        }
                    }
                    catch (XmlException ConstructAction_15_XML_Doccument)
                    {
                        PageEvent.LogErrorIntoTextFile(ConstructAction_15_XML_Doccument, "ThreeDSecure_15: ConstructAction_15_XML_Doccument");
                    }
                    try
                    {
                        XmlDocument Action1_XML = new XmlDocument();
                        Action1_XML.Load(ccPayements_1);
                        Action1_XML.SelectSingleNode("//transactionIndex").InnerText = MD;
                        Action1_XML.Save(ccPayements_1);

                        try
                        {
                            AuthTxnID = MD;
                        }
                        catch (NullReferenceException PrePareForAction_1)
                        {
                            PageEvent.LogErrorIntoTextFile(PrePareForAction_1, "ThreeDSecure_15: PrePareForAction_1");
                        }

                        try
                        {
                            XmlDocument   Action_1      = new XmlDocument();
                            StringWriter  stringWriter  = new StringWriter();
                            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);

                            Action_1.Load(ccPayements_1);
                            Action_1.WriteTo(xmlTextWriter);

                            string WS_Action_1 = stringWriter.ToString();

                            MyGate_Global_3D_Secure_Enterprise_Example.ccPayments.APIServiceClient ccPayment = new MyGate_Global_3D_Secure_Enterprise_Example.ccPayments.APIServiceClient();

                            try
                            {
                                if (AuthTxnID == MD)
                                {
                                    var Action_1_Response = ccPayment.execRequest(WS_Action_1);

                                    if (Action_1_Response.status.Equals("0"))
                                    {
                                        Response.Write("<br />");
                                        Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                        Response.Write("<tr>");
                                        Response.Write("<td align='center' colspan='2' style='background-color:Green; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>*** ACTION ** 1 ** RESULTS *** BANK ** RESPONSE ***</b></font></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>status :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='status' value='" + Action_1_Response.status + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>Date :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='Date' value='" + Action_1_Response.dtRequestReceived + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>code :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='code' value='" + Action_1_Response.fspMessage.code + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>Processor Response :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='processorResponse' value='" + Action_1_Response.fspMessage.processorResponse + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>message :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='message' value='" + Action_1_Response.fspMessage.message + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>uiTransactionIndex :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='uiTransactionIndex' value='" + Action_1_Response.uidTransactionIndex + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>authorizationCode :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='authorizationCode' value='" + Action_1_Response.fspMessage.authorizationCode + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>cardCountry :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='cardCountry' value='" + Action_1_Response.mgMessage.cardCountry + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>currencyCode :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='currencyCode' value='" + Action_1_Response.mgMessage.currencyCode + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>eciFlag :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='eciFlag' value='" + Action_1_Response.mgMessage.eciFlag + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td  align='center'><a href='http://localhost:33213/Response_SubData/UpdateXML.aspx'><button>Show SubMission Data</button></a></td>");
                                        Response.Write("</tr>");
                                        Response.Write("</table>");

                                        try
                                        {
                                            XmlDocument Action3_XML = new XmlDocument();
                                            Action3_XML.Load(ccPayements_3);
                                            Action3_XML.SelectSingleNode("//transactionIndex").InnerText = MD;
                                            Action3_XML.Save(ccPayements_3);

                                            XmlDocument Action2_XML = new XmlDocument();
                                            Action2_XML.Load(ccPayements_2);
                                            Action2_XML.SelectSingleNode("//transactionIndex").InnerText = MD;
                                            Action2_XML.Save(ccPayements_2);
                                        }
                                        catch (XmlException)
                                        {
                                            throw new XmlException();
                                        }
                                    }
                                    else
                                    {
                                        Response.Write("<br />");
                                        Response.Write("<table align='center'  width='75%' style='border:1px solid black;'>");
                                        Response.Write("<tr>");
                                        Response.Write("<td align='center' colspan='2' style='background-color:Red; font-size:14px; font-family:Verdana;'><font color='FFFFFF'><b>*** A C T I O N - 1 **  E R R O R S ** D U R R I N G **  I N V O K A T I O N ***</b></font></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>Error Code :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='Error Code' value='" + Action_1_Response.errors.error.code + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>Error Desc :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + Action_1_Response.errors.error.message + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>Remidiate Action :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + Action_1_Response.errors.error.description + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>DateTime :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + Action_1_Response.dtResponseSent + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td ><div align='left'>TransactionIndex :</div></td>");
                                        Response.Write("<td ><input type='text' style='width:572' name='Error Desc' value='" + Action_1_Response.uidTransactionIndex + "'/></td>");
                                        Response.Write("</tr>");
                                        Response.Write("<tr>");
                                        Response.Write("<td  align='center'><a href='http://localhost:33213/Response_SubData/UpdateXML.aspx'><button>Show SubMission Data</button></a></td>");
                                        Response.Write("</tr>");
                                        Response.Write("</table>");
                                    }
                                }
                            }
                            catch (HttpRequestValidationException CallWS_ACT1_PostConstruction)
                            {
                                PageEvent.LogErrorIntoTextFile(CallWS_ACT1_PostConstruction, "ThreeDSecure_15: CallWS_ACT1_PostConstruction");
                            }
                        }
                        catch (XmlException ConstructAction_1_XML_Doccument)
                        {
                            PageEvent.LogErrorIntoTextFile(ConstructAction_1_XML_Doccument, "ThreeDSecure_15: ConstructAction_1_XML_Doccument");
                        }
                    }
                    catch (XmlException UpdateAction_1_RequestData)
                    {
                        PageEvent.LogErrorIntoTextFile(UpdateAction_1_RequestData, "ThreeDSecure_15: UpdateAction_1_RequestData");
                    }
                }
                catch (XmlException UpdateAction_15_RequestData)
                {
                    PageEvent.LogErrorIntoTextFile(UpdateAction_15_RequestData, "ThreeDSecure_15: UpdateAction_15_RequestData");
                }
            }
            catch (NullReferenceException SetPostBackValues)
            {
                PageEvent.LogErrorIntoTextFile(SetPostBackValues, "ThreeDSecure_15: SetPostBackValues");
            }
        }
コード例 #10
0
 public XUserControl()
 {
     this.AutoDataBindingEvent = PageEvent.PreRender;
 }
コード例 #11
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            int activeWorkspaceId = this.Helper.GetActiveCaseID();

            //Construct a console object to build the console appearing in the UI.
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console();
            returnConsole.Items = new List <IConsoleItem>();
            returnConsole.Title = CONSOLE_TITLE;
            string select = "<h3 style='color:#11599E'>Comments Tree</h3>";

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

            elements.Add(select);
            using (kCura.Relativity.Client.IRSAPIClient client =
                       this.Helper.GetServicesManager().CreateProxy <kCura.Relativity.Client.IRSAPIClient>(Relativity.API.ExecutionIdentity.System))
            {
                client.APIOptions.WorkspaceID = this.Helper.GetActiveCaseID();
                Service.SqlService.CommentSqlService     commentService      = new Service.SqlService.CommentSqlService(this.Helper.GetDBContext(this.Helper.GetActiveCaseID()));
                Service.RSAPIService.CommentRSAPIService commentRSAPIService = new Service.RSAPIService.CommentRSAPIService(client);
                Data.Entities.Comment comment = commentRSAPIService.Get(this.ActiveArtifact.ArtifactID);
                comment.CommentChilds = commentService.GetCommentsChild(comment.ArtifactId);
                drawCommentTree2(ref elements, (comment.CommentChilds).ToList());
                returnConsole.HTMLBlocks = elements;
            }

            ConsoleHeader header = new ConsoleHeader("Console Application");

            //Construct the submit job button.
            ConsoleButton submitJobButton = new ConsoleButton();

            submitJobButton.Name           = INSERT_JOB_BUTTON_NAME;
            submitJobButton.DisplayText    = INSERT_JOB_DISPLAY_TEXT;
            submitJobButton.ToolTip        = INSERT_JOB_TOOL_TIP;
            submitJobButton.RaisesPostBack = true;
            submitJobButton.Enabled        = true;

            //Construct the delete job button
            ConsoleButton deleteJobButton = new ConsoleButton()
            {
                Name           = DELETE_JOB_BUTTON_NAME,
                DisplayText    = DELETE_JOB_DISPLAY_TEXT,
                ToolTip        = DELETE_JOB_TOOL_TIP,
                RaisesPostBack = true,
                Enabled        = true
            };

            //Button to see the comment data
            ConsoleButton seeCommentButton = new ConsoleButton()
            {
                Name           = "See Comment Data",
                DisplayText    = "Commen Data",
                ToolTip        = "Comment Data",
                RaisesPostBack = true,
                Enabled        = true
            };


            ConsoleSeparator separador = new ConsoleSeparator();


            //If a job is already in the queue, change the text and disable the button.
            if (pageEvent == PageEvent.PreRender)
            {
                SqlParameter commentArtifactId = new SqlParameter("@commentArtifacId", System.Data.SqlDbType.Int);
                commentArtifactId.Value = ActiveArtifact.ArtifactID;

                int jobCount = this.Helper.GetDBContext(activeWorkspaceId).ExecuteSqlStatementAsScalar <Int32>(JOB_EXISTS_QUERY, new SqlParameter[] { commentArtifactId });

                //Use the helper function to check if a job currently exists. Set Enabled to the opposite value.
                if (jobCount > 0)
                {
                    submitJobButton.Enabled = false;
                    deleteJobButton.Enabled = true;
                }
                else
                {
                    submitJobButton.Enabled = true;
                    deleteJobButton.Enabled = false;
                }

                //Get the base path to the application.
                String basePath = this.Application.ApplicationUrl.Substring(0, this.Application.ApplicationUrl.IndexOf("/Case/Mask/"));

                //Construct the path to the custom page with the current patient artifact id and current workspace.
                String patientProfilePageUrl = String.Format("{0}/CustomPages/{1}/Home/Index/?artifacId={2}", basePath, COMMENT_HISTORY_APPLICATION_GUID, ActiveArtifact.ArtifactID);

                //Create the JavaScript for the button and set the button property.
                String windowOpenJavaScript = String.Format("window.open('{0}', '', 'location=no,scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=300,height=400');", patientProfilePageUrl);
                seeCommentButton.OnClickEvent = windowOpenJavaScript;
            }


            //Add the buttons to the console.
            returnConsole.Items.Add(header);
            returnConsole.Items.Add(submitJobButton);
            returnConsole.Items.Add(deleteJobButton);
            returnConsole.Items.Add(seeCommentButton);
            returnConsole.Items.Add(separador);
            return(returnConsole);
        }