/// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"/> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            // Can't use application/rss+xml because browsers don't load it properly
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            context.Response.ContentType = "text/xml";

            // Get the decisions, supporting paging of data
            int pageSize = GetPageSize(context);
            int page     = GetPageNumber(context);

            var decisions = DecisionManager.ReadRouteSetDecisions(pageSize, page);

            // Serialise to page as UTF8
            using (MemoryStream writeStream = new MemoryStream())
            {
                XmlSerializer xs            = new XmlSerializer(typeof(List <GrittingDecision>), new Type[] { typeof(RouteSetDecision) });
                XmlTextWriter xmlTextWriter = new XmlTextWriter(writeStream, Encoding.UTF8);
                using (var readStream = (MemoryStream)xmlTextWriter.BaseStream)
                {
                    xs.Serialize(xmlTextWriter, decisions);
                    context.Response.Write(new UTF8Encoding().GetString(readStream.ToArray()));
                }
            }
            // Include client-side caching for this data
#if (!DEBUG)
            Http.CacheFor(0, 10);
#endif
        }
예제 #2
0
    void Awake()
    {
        owner           = GetComponent <Pawn> ();
        decisionManager = GetComponent <DecisionManager> ();

        decisionManager.AddDecision(this);
    }
예제 #3
0
        public void Accept(long decisionId)
        {
            using (var decisionManager = new DecisionManager())
                using (var entityManager = new EntityManager())
                    using (var uow = this.GetUnitOfWork())
                    {
                        decisionManager.Accept(decisionId, "");

                        var es = new EmailService();
                        var requestRepository = uow.GetRepository <Request>();
                        var request           = requestRepository.Get(decisionId);

                        if (request != null)
                        {
                            var    entityStore       = (IEntityStore)Activator.CreateInstance(entityManager.FindById(request.Entity.Id).EntityStoreType);
                            string applicant         = getPartyName(request.Applicant);
                            string emailDescionMaker = request.Decisions.FirstOrDefault().DecisionMaker.Email;

                            es.Send(MessageHelper.GetAcceptRequestHeader(request.Key, applicant),
                                    MessageHelper.GetAcceptRequestMessage(request.Key, entityStore.GetTitleById(request.Key)),
                                    new List <string> {
                                request.Applicant.Email
                            }, null, new List <string> {
                                ConfigurationManager.AppSettings["SystemEmail"], emailDescionMaker
                            }
                                    );
                        }
                    }
        }
예제 #4
0
        static void Main(string[] args)
        {
            Application app = new Application();

            var decisionManager = new DecisionManager();
            var preparator      = new ComparerPreparator();

            app.Run(decisionManager, preparator);
        }
예제 #5
0
 public void Start()
 {
     sM     = GameObject.Find("SettingManager").GetComponent <SettingManager>();
     pM     = GameObject.Find("PlayerManager").GetComponent <PlayerManager>();
     dM     = GameObject.Find("DecisionManager").GetComponent <DecisionManager>();
     gM     = GameObject.Find("GameManager").GetComponent <GameManager>();
     cM     = GameObject.Find("CharacterManager").GetComponent <CharacterManager>();
     convoM = GameObject.Find("ConversationManager").GetComponent <ConversationManager>();
     rM     = GameObject.Find("RoomManager").GetComponent <RoomManager>();
 }
예제 #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var decisionManager = new DecisionManager();
            var preparator      = new ComparerPreparator();

            Application.Run(new Form1(decisionManager, preparator));
        }
예제 #7
0
    protected override void Execute()
    {
        if (_index == _lastIndex)
        {
            return;
        }

        _lastIndex = _index;

        DecisionManager.ShowDecision(_index);
    }
예제 #8
0
        public void SetUp()
        {
            _output        = new MockOutput();
            _input         = new MockInput();
            _chanceService = new MockChanceService();

            _relationshipManager = new GodRelationshipManager();
            FighterFactory.SetGodRelationshipManager(_relationshipManager);
            _menuFactory = new MockMenuFactory();


            _decisionManager = new DecisionManager(_relationshipManager, null, _menuFactory, _input, _output);
        }
예제 #9
0
    private void Awake()
    {
        if (instance)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
        }

        decisionList = this.gameObject.GetComponentsInChildren <DecisionDescriptor>();
    }
예제 #10
0
        public void MakeDecision(bool decision)
        {
            waitingForDecision = false;

            if (decision)
            {
                Task.Run(() => DecisionManager.SendDecision(this.GameUID, this.playerID, PlayerDecision.GO_FURTHER));
            }
            else
            {
                Task.Run(() => DecisionManager.SendDecision(this.GameUID, this.playerID, PlayerDecision.GO_BACK));
            }
        }
예제 #11
0
        public ActionResult Decisions(long entityId, string status = "")
        {
            using (var entityManager = new EntityManager())
                using (var entityPermissionManager = new EntityPermissionManager())
                    using (var decisionManager = new DecisionManager())
                    {
                        var entityStore = (IEntityStore)Activator.CreateInstance(entityManager.FindById(entityId).EntityStoreType);

                        IQueryable <Decision> decisions = null;

                        if (status == "Open")
                        {
                            ViewData["status"] = "Open";
                            decisions          = decisionManager.Decisions.Where(d => d.Request.Entity.Id == entityId && d.Request.Status == 0);
                        }
                        else
                        {
                            decisions = decisionManager.Decisions.Where(d => d.Request.Entity.Id == entityId);
                        }

                        List <DecisionGridRowModel> model = new List <DecisionGridRowModel>();

                        foreach (var m in decisions)
                        {
                            //check if the entity exist otherwise set a default text for the user;
                            string title = entityStore.Exist(m.Request.Key) ? entityStore.GetTitleById(m.Request.Key) : "Dataset currently / no longer accessible";
                            bool   exist = entityStore.Exist(m.Request.Key);

                            model.Add(
                                new DecisionGridRowModel()
                            {
                                Id            = m.Id,
                                RequestId     = m.Request.Id,
                                Rights        = string.Join(", ", entityPermissionManager.GetRights(m.Request.Rights)), //string.Join(",", Enum.GetNames(typeof(RightType)).Select(n => n).Where(n => (m.Request.Rights & (short)Enum.Parse(typeof(RightType), n)) > 0)),
                                Status        = m.Status,
                                StatusAsText  = Enum.GetName(typeof(DecisionStatus), m.Status),
                                InstanceId    = m.Request.Key,
                                Title         = title,
                                Applicant     = getPartyName(m.Request.Applicant),
                                DecisionMaker = getPartyName(m.DecisionMaker),
                                Intention     = m.Request.Intention,
                                RequestDate   = m.Request.RequestDate,
                                EntityExist   = exist
                            });
                        }

                        ViewData["entityID"] = entityId;

                        return(PartialView("_DecisionsAdmin", model.OrderBy(x => x.Status).ThenBy(n => n.Id)));
                    }
        }
예제 #12
0
    public void OpenCategory()
    {
        DecisionManager dM = GameObject.Find("DecisionManager").GetComponent <DecisionManager>();

        if (categoryToOpenID == 1)
        {
            dM.DisplayExitOptions();
        }
        else if (categoryToOpenID == 2)
        {
            dM.DisplayCombatOptions();
        }
        else
        {
        }
    }
예제 #13
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            var totalResults = 0;
            var decisions    = DecisionManager.ReadRouteSetDecisions(this.paging.PageSize, this.paging.CurrentPage, out totalResults);

            this.paging.TotalResults        = totalResults;
            this.decisionArchive.DataSource = decisions;
            this.decisionArchive.DataBind();

            this.pageMetadata.RssFeedUrl = Iri.MakeAbsolute(new Uri("decisionsrss.ashx", UriKind.Relative)).ToString();


#if !DEBUG
            Http.CacheFor(0, 10);
#endif
        }
예제 #14
0
    public void DoCombatAction()
    {
        DecisionManager dM = GameObject.Find("DecisionManager").GetComponent <DecisionManager>();

        if (combatActionID == 1)
        {
            dM.Attack();
        }
        else if (combatActionID == 2)
        {
            dM.Throw();
        }
        else if (combatActionID == 3)
        {
            dM.Retreat();
        }
    }
예제 #15
0
        async public override Task FetchFlags()
        {
            try
            {
                var campaigns = await DecisionManager.GetCampaigns(Visitor);

                if (campaigns.Count == 0)
                {
                    campaigns = FetchVisitorCacheCampaigns(Visitor);
                }
                Visitor.Campaigns = campaigns;
                Visitor.Flags     = await DecisionManager.GetFlags(campaigns);

                Visitor.GetStrategy().CacheVisitorAsync();
            }
            catch (Exception ex)
            {
                Log.LogError(Config, ex.Message, "FetchFlags");
            }
        }
예제 #16
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"/> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            // Can't use application/rss+xml because browsers don't load it properly
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            context.Response.ContentType = "text/xml";

            // Get the decisions
            var decisions = DecisionManager.ReadRouteSetDecisions(20, 1);

            // Serialise to XML as UTF8
            using (MemoryStream writeStream = new MemoryStream())
            {
                XmlSerializer xs            = new XmlSerializer(typeof(List <GrittingDecision>), null, new Type[] { typeof(RouteSetDecision) }, null, "http://www.eastsussex.gov.uk/EsccWebTeam.Gritting");
                XmlTextWriter xmlTextWriter = new XmlTextWriter(writeStream, Encoding.UTF8);
                xs.Serialize(xmlTextWriter, decisions);

                // Transform into RSS and output
                XslCompiledTransform xslt = new XslCompiledTransform();
                using (var readStream = (MemoryStream)xmlTextWriter.BaseStream)
                {
                    readStream.Position = 0;
                    xslt.Load(Path.GetDirectoryName(context.Server.MapPath(context.Request.Url.AbsolutePath)) + Path.DirectorySeparatorChar + "decisionsrss.xslt");

                    var args = new XsltArgumentList();
                    args.AddParam("Rfc822Date", String.Empty, DateTime.Now.ToUkDateTime().ToRfc822DateTime());
                    //this.items.TransformArgumentList.AddParam("Iso8601Date", String.Empty, DateTimeFormatter.Iso8601DateTime(DateTime.Now));
                    args.AddParam("CurrentUrl", String.Empty, context.Request.Url.ToString());
                    args.AddParam("HtmlVersionUrl", String.Empty, Iri.MakeAbsolute(new Uri("decisions.aspx", UriKind.Relative)).ToString());

                    xslt.Transform(new XmlTextReader(readStream), args, context.Response.OutputStream);
                }
            }
            // Include client-side caching for this data
#if (!DEBUG)
            Http.CacheFor(0, 10);
#endif
        }
예제 #17
0
        public void Reject(long requestId)
        {
            using (var entityManager = new EntityManager())
                using (var entityPermissionManager = new EntityPermissionManager())
                    using (var decisionManager = new DecisionManager())
                        using (var uow = this.GetUnitOfWork())
                        {
                            try
                            {
                                decisionManager.Reject(requestId, "");

                                var es = new EmailService();
                                var requestRepository = uow.GetRepository <Request>();
                                var request           = requestRepository.Get(requestId);

                                if (request != null)
                                {
                                    var    entityStore = (IEntityStore)Activator.CreateInstance(entityManager.FindById(request.Entity.Id).EntityStoreType);
                                    string applicant   = getPartyName(request.Applicant);

                                    es.Send(MessageHelper.GetRejectedRequestHeader(request.Key, applicant),
                                            MessageHelper.GetRejectedRequestMessage(request.Key, entityStore.GetTitleById(request.Key)),
                                            new List <string> {
                                        request.Applicant.Email
                                    }, null, new List <string> {
                                        ConfigurationManager.AppSettings["SystemEmail"]
                                    }
                                            );
                                }
                            }
                            catch (Exception e)
                            {
                                throw e;
                            }
                            finally
                            {
                                decisionManager.Dispose();
                            }
                        }
        }
예제 #18
0
        public ActionResult Decisions(long entityId)
        {
            using (var entityManager = new EntityManager())
                using (var entityPermissionManager = new EntityPermissionManager())
                    using (var decisionManager = new DecisionManager())
                    {
                        var entityStore = (IEntityStore)Activator.CreateInstance(entityManager.FindById(entityId).EntityStoreType);

                        // Source + Transformation - Data
                        var decisions = decisionManager.Decisions.Where(d => d.Request.Entity.Id == entityId && d.DecisionMaker.Name == HttpContext.User.Identity.Name);

                        List <DecisionGridRowModel> model = new List <DecisionGridRowModel>();

                        foreach (var m in decisions)
                        {
                            // add the descicion to the model if the entity exist in the database
                            // exclude when enity was deleted
                            if (entityStore.Exist(m.Request.Key))
                            {
                                model.Add(
                                    new DecisionGridRowModel()
                                {
                                    Id           = m.Id,
                                    RequestId    = m.Request.Id,
                                    Rights       = string.Join(", ", entityPermissionManager.GetRights(m.Request.Rights)), //string.Join(",", Enum.GetNames(typeof(RightType)).Select(n => n).Where(n => (m.Request.Rights & (short)Enum.Parse(typeof(RightType), n)) > 0)),
                                    Status       = m.Status,
                                    StatusAsText = Enum.GetName(typeof(DecisionStatus), m.Status),
                                    InstanceId   = m.Request.Key,
                                    Title        = entityStore.GetTitleById(m.Request.Key),
                                    Applicant    = getPartyName(m.Request.Applicant),
                                    Intention    = m.Request.Intention,
                                    RequestDate  = m.Request.RequestDate
                                });
                            }
                        }
                        return(PartialView("_Decisions", model.OrderBy(x => x.Status).ThenBy(n => n.Id)));
                    }
        }
예제 #19
0
        public ActionResult Decisions_Select(long entityId, GridCommand command)
        {
            var entityManager = new EntityManager();
            var entityStore   = (IEntityStore)Activator.CreateInstance(entityManager.FindById(entityId).EntityStoreType);

            var decisionManager = new DecisionManager();

            // Source + Transformation - Data
            var decisions = decisionManager.Decisions.Where(d => d.Request.Entity.Id == entityId && d.DecisionMaker.Name == HttpContext.User.Identity.Name);

            var results = decisions.Select(
                m => new DecisionGridRowModel()
            {
                Id = m.Request.Id, Rights = m.Request.Rights, Status = m.Status, Applicant = m.Request.Applicant.Name
            });

            // Filtering
            var total = results.Count();

            return(View(new GridModel <DecisionGridRowModel> {
                Data = results.ToList(), Total = total
            }));
        }
예제 #20
0
        public void FraudManagement_Decisionmanager()
        {
            Address billingAddress = new Address {
                StreetAddress1 = "Flat 123",
                StreetAddress2 = "House 456",
                StreetAddress3 = "Cul-De-Sac",
                City           = "Halifax",
                Province       = "West Yorkshire",
                State          = "Yorkshire and the Humber",
                Country        = "GB",
                PostalCode     = "E77 4QJ"
            };

            Address shippingAddress = new Address {
                StreetAddress1 = "House 456",

                StreetAddress2 = "987 The Street",
                StreetAddress3 = "Basement Flat",
                City           = "Chicago",
                State          = "Illinois",
                Province       = "Mid West",
                Country        = "US",
                PostalCode     = "50001",
            };

            Customer customer = new Customer {
                Id                = "e193c21a-ce64-4820-b5b6-8f46715de931",
                FirstName         = "James",
                LastName          = "Mason",
                DateOfBirth       = "01011980",
                CustomerPassword  = "******",
                Email             = "*****@*****.**",
                DomainName        = "example.com",
                HomePhone         = "+35312345678",
                DeviceFingerPrint = "devicefingerprint",
            };

            DecisionManager decisionManager = new DecisionManager {
                BillToHostName = "example.com",
                BillToHttpBrowserCookiesAccepted = true,
                BillToHttpBrowserEmail           = "*****@*****.**",
                BillToHttpBrowserType            = "Mozilla",
                BillToIpNetworkAddress           = "123.123.123.123",
                BusinessRulesCoreThreshold       = "40",
                BillToPersonalId             = "741258963",
                InvoiceHeaderTenderType      = "consumer",
                InvoiceHeaderIsGift          = true,
                DecisionManagerProfile       = "DemoProfile",
                InvoiceHeaderReturnsAccepted = true,
                ItemHostHedge        = Risk.High,
                ItemNonsensicalHedge = Risk.High,
                ItemObscenitiesHedge = Risk.High,
                ItemPhoneHedge       = Risk.High,
                ItemTimeHedge        = Risk.High,
                ItemVelocityHedge    = Risk.High,
            };

            Transaction response = card.Charge(199.99m)
                                   .WithCurrency("EUR")
                                   .WithAddress(billingAddress, AddressType.Billing)
                                   .WithAddress(shippingAddress, AddressType.Shipping)
                                   .WithDecisionManager(decisionManager)
                                   .WithCustomerData(customer)
                                   .WithMiscProductData("SKU251584", "Magazine Subscription", "12", "1200", "true", "subscription", "Low")
                                   .WithMiscProductData("SKU8884784", "Charger", "10", "1200", "false", "electronic_good", "High")
                                   .WithCustomData("fieldValue01", "fieldValue02", "fieldValue03", "fieldValue04")
                                   .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
예제 #21
0
 public AuthorizationBuilder WithDecisionManager(DecisionManager value)
 {
     DecisionManager = value;
     return(this);
 }
예제 #22
0
    // Use this for initialization
    void Start()
    {
        cardPanel = GameObject.Find("CardPanel");

        decisionManager = GetComponent <DecisionManager>();
    }
예제 #23
0
 public MockDecisionManager(GodRelationshipManager relationshipManager)
 {
     _realDecisionManager = new DecisionManager(relationshipManager);
 }
예제 #24
0
 private void Start()
 {
     NextButton = GameObject.FindGameObjectWithTag("NextButton").GetComponent <Button>();
     DecisionManager.HideDecision();
 }
예제 #25
0
    public void OpenWaitPanel()
    {
        DecisionManager dM = GameObject.Find("DecisionManager").GetComponent <DecisionManager>();

        dM.OpenWaitPanel(_textUpdate);
    }
예제 #26
0
 public void TearDown()
 {
     _decisionManager     = null;
     _relationshipManager = null;
 }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            var decisions = DecisionManager.ReadLatestRouteSetDecisions();

            if (decisions.Count == 0)
            {
                this.table.Controls.Add(new LiteralControl("<tr><td colspan=\"4\">There are no gritting decisions at the moment.</td></tr>\n"));
                return;
            }


            var routeSets = DecisionManager.ReadRouteSets();

            // Is there a whole county decision that's more recent than anything else?
            RouteSetDecision        latestDomainDecision = null;
            RouteSetDecision        latestCountyDecision = null;
            List <RouteSetDecision> countyDecisions      = new List <RouteSetDecision>();

            foreach (RouteSetDecision decision in decisions)
            {
                if (decision.RouteSet.IsWholeCounty)
                {
                    if (latestCountyDecision == null || decision.DecisionTime > latestCountyDecision.DecisionTime)
                    {
                        latestCountyDecision = decision;
                    }
                    countyDecisions.Add(decision);
                }
                else
                {
                    if (latestDomainDecision == null || decision.DecisionTime > latestDomainDecision.DecisionTime)
                    {
                        latestDomainDecision = decision;
                    }
                }
            }

            if (latestCountyDecision != null && (latestDomainDecision == null || latestCountyDecision.DecisionTime > latestDomainDecision.DecisionTime))
            {
                // Show latest decisions for whole county
                DisplayDecisionsForArea(latestCountyDecision, countyDecisions);
            }
            else
            {
                // Otherwise show the latest update for each route set. Could have primary/secondary decision superceding whole county, or vice versa.
                var decisionsByDomain = GroupDecisionsByDomainName(decisions);

                foreach (var decisionsForDomain in decisionsByDomain.Values)
                {
                    RouteSetDecision latest = null;
                    foreach (var decision in decisionsForDomain)
                    {
                        if (latest == null || decision.DecisionTime > latest.DecisionTime)
                        {
                            latest = decision;
                        }
                    }

                    DisplayDecisionsForArea(latest, decisionsForDomain);
                }
            }
        }