public override bool InvokeAction(ControllerContext controllerContext, string actionName)
        {
            SplitGoal splitGoal = HandleGoalCall(controllerContext, actionName);

            List<SplitView> splitViews = SplitServices.SplitViews;
            SplitView splitView = GetCurrentSplit(controllerContext, actionName, splitViews);

            SplitView selectedSplit = null;

            if (splitView != null && controllerContext.RouteData.Values[Constants.ACTION].ToString() == actionName)
            {
                List<SplitView> all = splitViews.FindAll(s => s.SplitGroup == splitView.SplitGroup);
                selectedSplit = ChooseSplit(all, splitView.SplitGroup);

                controllerContext.RouteData.Values[Constants.ACTION] = selectedSplit.Action;
                controllerContext.RouteData.Values[Constants.CONTROLLER] = selectedSplit.Controller;

                AddRemoveArea(controllerContext, selectedSplit);

                actionName = selectedSplit.Action;
            }

            bool success = base.InvokeAction(controllerContext, actionName);

            if (!success || !HttpHelpers.IsIn200Family(controllerContext.HttpContext.Response.StatusDescription))
            {
                return success;
            }

            if (selectedSplit != null)
            {
                var logservice = new LogService();
                logservice.WriteToFile(selectedSplit);
                HttpHelpers.SaveToCookie(selectedSplit);
                HttpHelpers.SaveToSession(selectedSplit);
            }
            else if (splitGoal != null)
            {
                var logservice = new LogService();
                logservice.WriteToFile(splitGoal);
                HttpHelpers.RemoveFromSession(splitGoal);
            }

            return true;
        }
Пример #2
0
        internal override void Write(SplitGoal goal)
        {
            try
            {
                var logservice = new LogService();

                var values = Parameters.ToDictionary(parameter => parameter.Key, parameter => ParameterRetriever.RetireveValue(goal, parameter.Value).ToString());

                logservice.WriteToFile(values, Path);
            }
            catch (Exception ex)
            {
                if (TargetService.Config.Targets.ThrowExceptions)
                {
                    throw new Exception("Exception occurred in AbTestMaster when writing to file. Error Message: " + ex.Message);
                }
            }
        }