示例#1
0
        internal override void Write(SplitGoal goal)
        {
            try
            {
                using (var conn = new SqlConnection(ConnectionString))
                {
                    conn.Open();

                    var cmd = new SqlCommand(CommandText, conn);

                    foreach (var parameter in Parameters)
                    {
                        if (CommandText.Contains(parameter.Key))
                        {
                            cmd.Parameters.AddWithValue(parameter.Key, ParameterRetriever.RetireveValue(goal, parameter.Value));
                        }
                    }

                    cmd.ExecuteNonQuery();

                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                if (TargetService.Config.Targets.ThrowExceptions)
                {
                    throw new Exception("Exception occurred in AbTestMaster when writing to database. Error Message: " + ex.Message);

                }
            }
        }
示例#2
0
        internal void WriteToFile(SplitGoal goal)
        {
            var keyValuePairs = new Dictionary<string, string>
            {
                {Constants.SPLIT_SEQUENCE, goal.Sequence},
                {Constants.SPLIT_VIEWS_SEQUENCE_TRAIL, HttpHelpers.GetViewTrail(goal.Sequence)}
            };

            CheckForFile(Constants.SPLIT_GOALS_FILE_PATH, new List<string> { Constants.DATE_TIME, Constants.SPLIT_SEQUENCE, Constants.SPLIT_VIEWS_SEQUENCE_TRAIL });

            WriteToFile(keyValuePairs, Constants.SPLIT_GOALS_FILE_PATH);
        }
示例#3
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);
                }
            }
        }
        internal static object RetireveValue(SplitGoal goal, string parameterName)
        {
            object value;

            switch (parameterName)
            {
                case Constants.SPLIT_VIEWS_SEQUENCE_TRAIL_VARIABLE:
                    value = HttpHelpers.GetViewTrail(goal.Goal);
                    break;
                case Constants.SPLIT_GOAL_VARIABLE:
                    value = goal.Goal;
                    break;
                default:
                    value = RetireveValue(parameterName);
                    break;
            }

            return value;
        }
示例#5
0
        internal static void RemoveFromSession(SplitGoal splitGoal)
        {
            var viewList = SessionSplitViews;

            var newList = viewList.Where(splitView => splitView.Goal != splitGoal.Goal).ToList();

            SessionSplitViews = newList;
        }
 public SplitGoalAttribute(string goalName)
 {
     SplitGoal = new SplitGoal { Goal = goalName };
 }
示例#7
0
 internal abstract void Write(SplitGoal goal);
 public SplitGoalAttribute(string sequence)
 {
     SplitGoal = new SplitGoal { Sequence = sequence };
 }