///// <summary> ///// Vrsi selektovanje profila na osnovu podesavanja i SampleTaker algoritma ///// </summary> ///// <param name="runStamp"></param> ///// <param name="groups"></param> ///// <param name="sampler"></param> ///// <param name="customWhere"></param> ///// <returns></returns> //public List<webSiteProfile> selectProfiles(this IGrou String runStamp = null, List<String> groups = null, // sampleSettings sampler = null, String customWhere = "", Boolean onlyCurrentTest = false) ////where T : IEnumerable<webSiteProfile>, new() //{ // List<webSiteProfile> output = new List<webSiteProfile>(); // String wSql = makeSqlWhere(runStamp, groups, customWhere, onlyCurrentTest); // // source // //IRelationEnabledCollection rl = this as IRelationEnabledCollection; // output = this.selectItems<webSiteProfile>(wSql, -1, selectItemsMode.sqlWhere, selectItemsResultType.managed); // return output; //} ///// <summary> ///// 2017c: Selects the group. ///// </summary> ///// <param name="groupSet">The group set.</param> ///// <param name="group">The group.</param> ///// <param name="loger">The loger.</param> ///// <param name="source">The source.</param> ///// <param name="runStamp">The run stamp.</param> ///// <param name="customWhere">The custom where.</param> ///// <param name="onlyCurrentTest">if set to <c>true</c> [only current test].</param> ///// <returns></returns> //public static IEnumerable<webSiteProfile> selectGroup(this sampleGroupSet groupSet, sampleGroupItem group, ILogBuilder loger,webSiteProfileCollection source, String runStamp = null, String customWhere = "", Boolean onlyCurrentTest = false) //{ // //List<IReal> wbp = new List<IProfile>(); // //String whereQ = groupSet.makeSqlWhere(group, loger, runStamp, customWhere, onlyCurrentTest); // ////.selectItems(whereQ); // webSiteProfiles.selectItems<webSiteProfile>(sql, -1, selectItemsMode.sqlWhere, selectItemsResultType.managed); // // return wbp; //} /// <summary> /// Pravi WHERE dodatak SQL upita - /// </summary> /// <param name="runStamp">Ako nije definisan napravice trenuitni</param> /// <param name="groups">Grupe - ako nije definisan ucitace sve</param> /// <param name="customWhere">Proizvoljan WHERE upit</param> /// <param name="onlyCurrentTest">Da li proverava RunStamp</param> /// <returns></returns> public static string makeSqlWhere(this sampleGroupSet groupSet, sampleGroupItem group, ILogBuilder loger, string runStamp = null, string customWhere = "", bool onlyCurrentTest = false) { loger.log("Creating sample filter query for: " + group.groupTitle + " (" + group.groupTag + ")"); string output = ""; string whereRunStamp = ""; string whereGroups = ""; if (onlyCurrentTest) { if (string.IsNullOrEmpty(runStamp)) { } whereRunStamp = "((lastRunStamp <> \"" + runStamp + "\") OR (lastRunStamp IS NULL))"; } whereGroups = groupSet.db_groupTagFieldName + " LIKE '%" + group.groupTag + "%'"; if (!string.IsNullOrEmpty(whereRunStamp)) { output += whereRunStamp + ""; } if (!string.IsNullOrEmpty(whereGroups)) { if (!string.IsNullOrEmpty(output)) { output += " OR " + whereGroups; } else { output = whereGroups; } } if (!string.IsNullOrEmpty(customWhere)) { if (!string.IsNullOrEmpty(output)) { output += " OR " + customWhere; } else { output = customWhere; } } loger.log("Query to filter from " + group.count + " entries: " + output); return(output); }
/// <summary> /// Automatic group creation - using default settings /// </summary> /// <param name="numberOfGroups">Number of groups to autocreate</param> /// <returns></returns> public static sampleGroupSet createGroupSet(int numberOfGroups) { sampleGroupSet output = new sampleGroupSet(); //Int32 i = 1; for (var a = 0; a < numberOfGroups; a++) { sampleGroupItem group = new sampleGroupItem(); group.groupTitle = "Group " + a.ToString(); group.groupTag = "G" + a.ToString(); group.weight = 1; output.Add(group); } return(output); }