private bool AddTokens(IEnumerable <string> tokens, string programcategory, string programrowkey, string campuskey, string clientkey, long attributemask, long importantthingsmask, IGeoIndexClient indexclient) { foreach (string token in tokens) { string partition = programcategory != "" ? token.Trim() + "-" + programcategory : token.Trim(); indexclient.AddProgram(partition, programrowkey, campuskey, clientkey, attributemask, importantthingsmask); } return(true); }
private bool ProcessGeoTargetingListString(string stringtype, string updatedstringvalue, string programcategory, bool newcategory, string itemrowkey, string campuskey, string clientkey, long attributemask, long importantthingsmask, bool maskschanged, IGeoIndexClient indexclient) { string currentstring = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", stringtype, itemrowkey); if (currentstring != null && currentstring.Trim() != "") { //Previous string exists if (newcategory) { if (updatedstringvalue != null && updatedstringvalue.Trim() != "") { List <string> updatedtokens = new List <string>(updatedstringvalue.Split(',')); AddTokens(updatedtokens, programcategory, itemrowkey, campuskey, clientkey, attributemask, importantthingsmask, indexclient); } } else { if (currentstring != updatedstringvalue || maskschanged) { List <string> currenttokens = new List <string>(currentstring.Split(',')); List <string> updatedtokens = new List <string>(updatedstringvalue.Split(',')); List <string> tokenstoremove = new List <string>(); List <string> tokenstoadd = new List <string>(); //find strings to remove foreach (string token in currenttokens) { if (!updatedtokens.Contains(token)) { tokenstoremove.Add(token); } } //find strings to add foreach (string token in updatedtokens) { if (!currenttokens.Contains(token)) { tokenstoadd.Add(token); } else { if (maskschanged) { tokenstoremove.Add(token); tokenstoadd.Add(token); } } } RemoveTokens(tokenstoremove, programcategory, itemrowkey, indexclient); AddTokens(tokenstoadd, programcategory, itemrowkey, campuskey, clientkey, attributemask, importantthingsmask, indexclient); } } } else { //Previous string does not exist if (updatedstringvalue != null && updatedstringvalue.Trim() != "") { if (updatedstringvalue.Trim().Length > 0) { string[] tokens = updatedstringvalue.Split(','); AddTokens(tokens, programcategory, itemrowkey, campuskey, clientkey, attributemask, importantthingsmask, indexclient); } } } return(true); }
private bool RemoveTokens(IEnumerable <string> tokens, string programcategory, string programrowkey, IGeoIndexClient indexclient) { foreach (string token in tokens) { indexclient.RemoveProgram(token.Trim() + "-" + programcategory, programrowkey); } return(true); }
private bool RemoveProgramCategory(string stringtype, string updatedstringvalue, string programcategory, string itemrowkey, IGeoIndexClient indexclient) { string currentstring = BlobStringManager.Instance.GetString("skillcowemployerprogramgeoindex", stringtype, itemrowkey); if (currentstring != null && currentstring.Trim() != "") { List <string> currenttokens = new List <string>(currentstring.Split(',')); RemoveTokens(currenttokens, programcategory, itemrowkey, indexclient); } return(true); }
private bool AddTokens(IEnumerable <string> tokens, string programcategory, string programrowkey, string campuskey, string clientkey, IGeoIndexClient indexclient) { foreach (string token in tokens) { indexclient.AddProgram(token.Trim() + "-" + programcategory, programrowkey, campuskey, clientkey, 0, 0); } return(true); }