public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) { var pageableRequest = new List<IEnumerable<IndexerRequest>>(); var parameters = new BroadcastheNetTorrentQuery(); if (AddSeriesSearchParameters(parameters, searchCriteria)) { foreach (var episode in searchCriteria.Episodes) { parameters = parameters.Clone(); parameters.Category = "Episode"; parameters.Name = String.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber); pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); } foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct()) { parameters = parameters.Clone(); parameters.Category = "Season"; parameters.Name = String.Format("Season {0}", seasonNumber); pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); } } return pageableRequest; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); if (searchCriteria.Series.TvRageId > 0) { pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch", String.Format("&rid={0}&season={1}&ep={2}", searchCriteria.Series.TvRageId, searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber))); } else { foreach (var queryTitle in searchCriteria.QueryTitles) { pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch", String.Format("&q={0}&season={1}&ep={2}", NewsnabifyTitle(queryTitle), searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber))); } } return pageableRequests; }
internal static List<LicenseMessage> CheckParameters(this NavOrder order) { var returnMessageList = new List<LicenseMessage>(); returnMessageList.AddIfNotNull(order.IsOrderNumberNullOrEmpty()); returnMessageList.AddIfNotNull(order.IsOrderNumberGreaterThan20()); returnMessageList.AddIfNotNull(order.IsActionValid()); returnMessageList.AddIfNotNull(order.IsProductOrdersEmpty()); return returnMessageList; }
public string ExecuteXml(string types = null, string routeIds = null, string stationIds = null) { var parameters = new List<Tuple<string, string>>(); parameters.AddIfNotNull(types, new Tuple<string, string>("type", types)); parameters.AddIfNotNull(routeIds, new Tuple<string, string>("routeid", routeIds)); parameters.AddIfNotNull(stationIds, new Tuple<string, string>("stationid", stationIds)); var formatter = new QueryStringFormatter(); string queryString = formatter.Format(parameters); string requestUrl = _baseUrl + queryString; var requestExecutor = new HttpRequestor(); string response = requestExecutor.ExecuteGet(requestUrl); return response; }
private static IEnumerable<ODataActionDescriptor> GetActionDescriptors(SwaggerRoute potentialSwaggerRoute, HttpConfiguration httpConfig) { Contract.Requires(potentialSwaggerRoute != null); Contract.Requires(httpConfig != null); var oDataActionDescriptors = new List<ODataActionDescriptor>(); oDataActionDescriptors.AddIfNotNull(GetActionDescriptors(new HttpMethod("DELETE"), potentialSwaggerRoute.PathItem.delete, potentialSwaggerRoute, httpConfig)); oDataActionDescriptors.AddIfNotNull(GetActionDescriptors(new HttpMethod("GET"), potentialSwaggerRoute.PathItem.get, potentialSwaggerRoute, httpConfig)); oDataActionDescriptors.AddIfNotNull(GetActionDescriptors(new HttpMethod("POST"), potentialSwaggerRoute.PathItem.post, potentialSwaggerRoute, httpConfig)); oDataActionDescriptors.AddIfNotNull(GetActionDescriptors(new HttpMethod("PUT"), potentialSwaggerRoute.PathItem.put, potentialSwaggerRoute, httpConfig)); oDataActionDescriptors.AddIfNotNull(GetActionDescriptors(new HttpMethod("PATCH"), potentialSwaggerRoute.PathItem.patch, potentialSwaggerRoute, httpConfig)); return oDataActionDescriptors; }
public override void Print(System.IO.StreamWriter writer) { Section.WriteTitle(writer, "Unique Hats"); int cnt = 0; foreach (Item i in OrderedList) { double percent = Math.Round(((double)cnt) * 100 / ((double)Items.Keys.Count)); Console.WriteLine("Progress: Item {0} of {1} (" + percent + "%)", cnt + 1, Items.Keys.Count); List<String> attribs = new List<string>(); attribs.AddIfNotNull(i.PaintName); if (i.IsGifted) attribs.Add("Gifted"); if (!i.IsCraftable) attribs.Add("Uncraftable"); if (!i.IsTradable) attribs.Add("Untradable"); //pretty print the item String item = TF2PricerMain.FormatItem(i, false, Items[i], attribs.ToArray()); Price paint = null; if (i.PaintName != null) paint = TF2PricerMain.PriceSchema.GetPaintPrice(i[Item.Paint]); Price p = TF2PricerMain.PriceSchema.GetPrice(i); //so write the item, then follow up with the bp.tf prices Console.WriteLine(item + "\n"); if (paint != null) { Console.WriteLine("Original: " + p.ToString()); Console.WriteLine("Paint: " + paint.ToString()); p += paint; } Console.WriteLine("Price: " + p.ToString()); TF2PricerMain.GetInputPrice(item, writer, p.LowPrice, p.HighPrice); cnt++; } }
public virtual IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse) { _indexerResponse = indexerResponse; var releases = new List<ReleaseInfo>(); if (!PreProcess(indexerResponse)) { return releases; } var document = LoadXmlDocument(indexerResponse); var items = GetItems(document); foreach (var item in items) { try { var reportInfo = ProcessItem(item); releases.AddIfNotNull(reportInfo); } catch (Exception itemEx) { itemEx.Data.Add("Item", item.Title()); _logger.ErrorException("An error occurred while processing feed item from " + indexerResponse.Request.Url, itemEx); } } return releases; }
public override void Print(System.IO.StreamWriter writer) { Section.WriteTitle(writer, "Vintage Weapons"); int cnt = 0; foreach (Item i in OrderedList) { double percent = Math.Round(((double)cnt) * 100 / ((double)Items.Keys.Count)); Console.WriteLine("Progress: Item {0} of {1} (" + percent + "%)", cnt + 1, Items.Keys.Count); List<String> attribs = new List<string>(); bool oddLevelled = false; attribs.AddIfNotNull(i.PaintName); if (i.IsGifted) attribs.Add("Gifted"); //if the level is different to the default if (TF2PricerMain.Schema.DefaultVintageLevels[i.DefIndex] != i.Level) { attribs.Add("Level " + i.Level); oddLevelled = true; } //pretty print the item String item = TF2PricerMain.FormatItem(i, true, Items[i], attribs.ToArray()); Price p = TF2PricerMain.PriceSchema.GetPrice(i); //so write the item, then follow up with the bp.tf prices Console.WriteLine(item + "\n"); Console.WriteLine("Price: " + p.ToString()); if (oddLevelled) Console.WriteLine("Note: Odd-levelled."); TF2PricerMain.GetInputPrice(item, writer, p.LowPrice, p.HighPrice); cnt++; } }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); pageableRequests.AddIfNotNull(GetPagedRequests("/feed/")); return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); pageableRequests.AddIfNotNull(GetPagedRequests("search", searchCriteria.Series.TvdbId, "S{0:00}", searchCriteria.SeasonNumber)); return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); pageableRequests.AddIfNotNull(GetPagedRequests("search", searchCriteria.Series.TvdbId, "\"{0:yyyy MM dd}\"", searchCriteria.AirDate)); return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); // We give kat a bit more pages to get to 100 total for recent, coz users have been missing releases. pageableRequests.AddIfNotNull(GetPagedRequests(4, "tv")); return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); // TODO: We might consider getting multiple pages in the future, but atm we limit it to 1 page. pageableRequests.AddIfNotNull(GetPagedRequests(1, Settings.Categories.Concat(Settings.AnimeCategories), "tvsearch", "")); return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); foreach (var queryTitle in searchCriteria.QueryTitles) { pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", PrepareQuery(queryTitle), "category:tv", String.Format("season:{0}", searchCriteria.SeasonNumber), String.Format("episode:{0}", searchCriteria.EpisodeNumber))); pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", PrepareQuery(queryTitle), String.Format("S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber), "category:tv")); } return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); foreach (var queryTitle in searchCriteria.QueryTitles) { pageableRequests.AddIfNotNull(GetPagedRequests(String.Format("{0}+{1:yyyy MM dd}", queryTitle, searchCriteria.AirDate))); } return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); foreach (var queryTitle in searchCriteria.QueryTitles) { pageableRequests.AddIfNotNull(GetPagedRequests(String.Format("/search/index.php?show_name={0}&season={1}&mode=rss", queryTitle, searchCriteria.SeasonNumber))); } return pageableRequests; }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); foreach (var queryTitle in searchCriteria.QueryTitles) { pageableRequests.AddIfNotNull(GetPagedRequests(String.Format("{0}+S{1:00}", queryTitle, searchCriteria.SeasonNumber))); } return pageableRequests; }
public override void Print(System.IO.StreamWriter writer) { Section.WriteTitle(writer, "Strange Hats"); int cnt = 0; foreach (Item i in OrderedList) { double percent = Math.Round(((double)cnt) * 100 / ((double)Items.Keys.Count)); Console.WriteLine("Progress: Item {0} of {1} (" + percent + "%)", cnt + 1, Items.Keys.Count); List<String> attribs = new List<string>(); attribs.AddIfNotNull(i.PaintName); attribs.AddRangeIfNotNull(i.StrangeParts); if (i.IsGifted) attribs.Add("Gifted"); //pretty print the item String item = TF2PricerMain.FormatItem(i, true, Items[i], attribs.ToArray()); Price paint = null; Price[] parts = new Price[3] { null, null, null }; if (i.PaintName != null) paint = TF2PricerMain.PriceSchema.GetPaintPrice(i[Item.Paint]); if (i.StrangeParts != null) { for(int partCount = 0; partCount < 3; ++partCount) { parts[partCount] = TF2PricerMain.PriceSchema.GetPartPrice(i[Item.StrangePart1 + partCount]); } } Price p = TF2PricerMain.PriceSchema.GetPrice(i); //so write the item, then follow up with the bp.tf prices Console.WriteLine(item + "\n"); if(paint != null || i.StrangeParts != null) Console.WriteLine("Original: " + p.ToString()); if (paint != null) { Console.WriteLine("Paint: " + paint.ToString()); p += paint; } if (i.StrangeParts != null) { int partNo = 0; foreach (String part in i.StrangeParts) { Console.WriteLine(part + ": " + parts[partNo].ToString()); p += parts[partNo]; ++partNo; } } Console.WriteLine("Price: " + p.ToString()); TF2PricerMain.GetInputPrice(item, writer, p.LowPrice, p.HighPrice); cnt++; } }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { MenuCommand cmd; IClass c; ClassNode classNode = owner as ClassNode; if (classNode != null) { c = classNode.Class; } else { ClassBookmark bookmark = (ClassBookmark)owner; c = bookmark.Class; } ParserService.ParseCurrentViewContent(); c = c.ProjectContent.GetClass(c.FullyQualifiedName, c.TypeParameters.Count, c.ProjectContent.Language, GetClassOptions.LookForInnerClass); c = GetCurrentPart(c); if (c == null) { return new ToolStripMenuItem[0]; } List<ToolStripItem> list = new List<ToolStripItem>(); // "Go to base" for classes is not that useful as it is faster to click the base class in the editor. // Also, we have "Find base classes" which shows all base classes. // if (c.BaseTypes.Count > 0) { // list.Add(new MenuSeparator()); // cmd = new MenuCommand("${res:SharpDevelop.Refactoring.GoToBaseCommand}", GoToBase); // cmd.Tag = c; // list.Add(cmd); // } cmd = FindReferencesAndRenameHelper.MakeFindReferencesMenuCommand(FindReferences); cmd.Tag = c; list.Add(cmd); list.AddIfNotNull(MakeFindBaseClassesItem(c)); list.AddIfNotNull(MakeFindDerivedClassesItem(c)); return list.ToArray(); }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) { var pageableRequests = new List<IEnumerable<IndexerRequest>>(); foreach (var queryTitle in searchCriteria.QueryTitles) { var searchTitle = PrepareQuery(queryTitle); pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, String.Format("&term={0}+{1:0}", searchTitle, searchCriteria.AbsoluteEpisodeNumber))); if (searchCriteria.AbsoluteEpisodeNumber < 10) { pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, String.Format("&term={0}+{1:00}", searchTitle, searchCriteria.AbsoluteEpisodeNumber))); } } return pageableRequests; }
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource) { var newFiles = _mediaFileService.FilterExistingFiles(videoFiles.ToList(), series); _logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count()); var shouldUseFolderName = ShouldUseFolderName(videoFiles, series, folderInfo); var decisions = new List<ImportDecision>(); foreach (var file in newFiles) { decisions.AddIfNotNull(GetDecision(file, series, folderInfo, sceneSource, shouldUseFolderName)); } return decisions; }
public override void Print(System.IO.StreamWriter writer) { Section.WriteTitle(writer, "Vintage Hats"); int cnt = 0; foreach (Item i in OrderedList) { double percent = Math.Round(((double)cnt) * 100 / ((double)Items.Keys.Count)); Console.WriteLine("Progress: Item {0} of {1} (" + percent + "%)", cnt + 1, Items.Keys.Count); List<String> attribs = new List<string>(); bool oddLevelled = false; attribs.AddIfNotNull(i.PaintName); if (i.IsGifted) attribs.Add("Gifted"); if (new int[] { 0, 1, 42, 69, 99, 100 }.Contains(i.Level)) { attribs.Add("Level " + i.Level); oddLevelled = true; } //pretty print the item String item = TF2PricerMain.FormatItem(i, true, Items[i], attribs.ToArray()); Price paint = null; if (i.PaintName != null) paint = TF2PricerMain.PriceSchema.GetPaintPrice(i[Item.Paint]); Price p = TF2PricerMain.PriceSchema.GetPrice(i); //so write the item, then follow up with the bp.tf prices Console.WriteLine(item + "\n"); if (paint != null) { Console.WriteLine("Original: " + p.ToString()); Console.WriteLine("Paint: " + paint.ToString()); p += paint; } Console.WriteLine("Price: " + p.ToString()); if (oddLevelled) Console.WriteLine("Note: Odd-levelled."); TF2PricerMain.GetInputPrice(item, writer, p.LowPrice, p.HighPrice); cnt++; } }
/// <summary> /// Method to invoke the CTA Alerts Api /// </summary> /// <param name="activeOnly">Default is FALSE. If TRUE, response yields events only where the start time is in the past and the end time is in the future or unknown.</param> /// <param name="accessibility">Default is TRUE. If FALSE, response excludes events that affect accessible paths in stations.</param> /// <param name="planned">Default is TRUE. If FALSE, response excludes common planned alerts. Otherwise, result does include planned alerts.</param> /// <param name="routeIds">If specified (comma delimit multiple values), determines which routes’ statuses to return list, based on unique route IDs. Matches GTFS route IDs.</param> /// <param name="stationIds">If specified (comma delimit multiple values), determines which stations to return, based on unique station IDs. Matches GTFS station IDs.</param> /// <param name="byStartDate">If specified, yields events with a start date before the one specified (excludes events that don’t begin until on or after the specified point in the future).</param> /// <param name="recentDays">If specified, yields events that have started within x number of days before today (excludes events that began further in the past than the specified number of days).</param> /// <returns></returns> public string ExecuteXml(bool? activeOnly = null, bool? accessibility = null, bool? planned = null, string routeIds = null, string stationIds = null, DateTime? byStartDate = null, int? recentDays = null) { var parameters = new List<Tuple<string, string>>(); parameters.AddIfNotNull(activeOnly, new Tuple<string, string>("activeonly", activeOnly.GetValueOrDefault().ToString())); parameters.AddIfNotNull(accessibility, new Tuple<string, string>("accessibility", accessibility.GetValueOrDefault().ToString())); parameters.AddIfNotNull(planned, new Tuple<string, string>("planned", planned.GetValueOrDefault().ToString())); parameters.AddIfNotNull(routeIds, new Tuple<string, string>("routeid", routeIds)); parameters.AddIfNotNull(stationIds, new Tuple<string, string>("stationid", stationIds)); parameters.AddIfNotNull(byStartDate, new Tuple<string, string>("bystartdate", byStartDate.ToYYYYMMDD())); parameters.AddIfNotNull(recentDays, new Tuple<string,string>("recentdays", recentDays.GetValueOrDefault().ToString())); var formatter = new QueryStringFormatter(); string queryString = formatter.Format(parameters); string requestUrl = _baseUrl + queryString; var requestExecutor = new HttpRequestor(); string response = requestExecutor.ExecuteGet(requestUrl); return response; }
private List<ContactActionUpdate> UpdateContacts() { List<ContactActionUpdate> updates = new List<ContactActionUpdate>(); foreach (WorkContact contact in _oohSheetContacts.Where(c => c.MatchedContact != null)) { updates.AddIfNotNull(UpdateMobile(contact)); updates.AddIfNotNull(UpdateHomeNumber(contact)); updates.AddIfNotNull(UpdateName(contact)); } return updates; }
private List<ContactActionAdd> CreateNewContacts() { List<ContactActionAdd> newContacts = new List<ContactActionAdd>(); foreach (WorkContact contact in _oohSheetContacts.Where(c => c.MatchedContact == null)) { newContacts.AddIfNotNull(CreateGoogleContact(contact)); } return newContacts; }
/// <summary> /// Converts parameters. /// </summary> protected IParameter[] ConvertParameters(IList<IIocParameter> parameters) { if (parameters == null || parameters.Count == 0) return Empty.Array<IParameter>(); var list = new List<IParameter>(); foreach (var iocParameter in parameters) list.AddIfNotNull(ConvertParameter(iocParameter)); list.Add(new ParameterContainer(parameters)); return list.ToArrayEx(); }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { MenuCommand cmd; IMember member; MemberNode memberNode = owner as MemberNode; if (memberNode != null) { member = memberNode.Member; } else { ClassMemberBookmark bookmark = (ClassMemberBookmark)owner; member = bookmark.Member; } IMethod method = member as IMethod; List<ToolStripItem> list = new List<ToolStripItem>(); bool canGenerateCode = member.DeclaringType.ProjectContent.Language.CodeGenerator != null && !FindReferencesAndRenameHelper.IsReadOnly(member.DeclaringType); if (method == null || !method.IsConstructor && !method.IsOperator) { if (!FindReferencesAndRenameHelper.IsReadOnly(member.DeclaringType) && !(member is IProperty && ((IProperty)member).IsIndexer)) { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.RenameCommand}", Rename); cmd.ShortcutKeys = Keys.Control | Keys.R; cmd.Tag = member; list.Add(cmd); } } if (member != null && member.IsOverride) { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.GoToBaseClassCommand}", GoToBase); cmd.Tag = member; list.Add(cmd); } cmd = new MenuCommand("${res:SharpDevelop.Refactoring.FindReferencesCommand}", FindReferences); cmd.ShortcutKeys = Keys.F12; cmd.Tag = member; list.Add(cmd); list.AddIfNotNull(MakeFindOverridesItem(member)); if (member is IField && member.DeclaringType.ClassType != ClassType.Enum) { IProperty foundProperty = FindReferencesAndRenameHelper.FindProperty(member as IField); if (foundProperty != null) { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.GoToProperty}", GotoTagMember); cmd.Tag = foundProperty; list.Add(cmd); } else { if (canGenerateCode) { if (member.IsReadonly) { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.CreateProperty}", CreateGetter); cmd.Tag = member; list.Add(cmd); } else { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.CreateGetter}", CreateGetter); cmd.Tag = member; list.Add(cmd); cmd = new MenuCommand("${res:SharpDevelop.Refactoring.CreateProperty}", CreateProperty); cmd.Tag = member; list.Add(cmd); } } } } if (member is IProperty) { IProperty property = member as IProperty; if (property.CanSet && canGenerateCode && !property.IsAbstract && property.DeclaringType.ClassType != ClassType.Interface) { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.CreateChangedEvent}", CreateChangedEvent); cmd.Tag = member; list.Add(cmd); } } if (member is IEvent) { if (canGenerateCode && !member.IsAbstract && member.DeclaringType.ClassType != ClassType.Interface) { cmd = new MenuCommand("${res:SharpDevelop.Refactoring.CreateOnEventMethod}", CreateOnEventMethod); cmd.Tag = member; list.Add(cmd); } } return list.ToArray(); }
public ActionResult Edit_Post() { try { string id = !string.IsNullOrWhiteSpace(Request["id"]) ? Request["id"] : string.Empty; string username = !string.IsNullOrWhiteSpace(Request["username"]) ? Request["username"] : string.Empty; string email = !string.IsNullOrWhiteSpace(Request["email"]) ? Request["email"] : string.Empty; string password = !string.IsNullOrWhiteSpace(Request["password"]) ? Request["password"] : string.Empty; string passwordrepeat = !string.IsNullOrWhiteSpace(Request["passwordrepeat"]) ? Request["passwordrepeat"] : string.Empty; bool active = (!string.IsNullOrWhiteSpace(Request["active"]) && Request["active"].Equals("yes")) ? true : false; List<WebUserMessage> ErrorUserMessageList = new List<WebUserMessage>(); //Add New User - Require Username ErrorUserMessageList.AddIfNotNull(Models.AdminUser.SaveValidation.AddNewRequireUsername(Request, id, username)); if (password.Equals(passwordrepeat)) { //Add New User - Require Password ErrorUserMessageList.AddIfNotNull(Models.AdminUser.SaveValidation.AddNewRequirePassword(Request, id, password)); //only continue if no errors if (ErrorUserMessageList.Count == 0) { //if adding new password requires >= 8 characters, capital and lower, and numbers ErrorUserMessageList.AddIfNotNull(Models.AdminUser.SaveValidation.AddNewCheckPasswordStrength(Request, id, password)); //if we reached this point its time to save. if (ErrorUserMessageList.Count == 0) { Chimera.Entities.Admin.AdminUser AdminUser = Models.AdminUser.LoadAdminUserForSaving(id, username, active); string OnSuccessUserMessage = Chimera.Resources.Admin.Website.Controllers.AdminUser.UserMessages.Edit_Saved_Success.Replace("[USERNAME]", AdminUser.Username); //if adding new and no errors set password. if (AdminUser.Id.Equals(ObjectId.Empty)) { AdminUser.Hashed_Password = password; OnSuccessUserMessage = Chimera.Resources.Admin.Website.Controllers.AdminUser.UserMessages.Add_New_Saved_Success.Replace("[USERNAME]", AdminUser.Username); } //setup admin users new role list from the request. AdminUser.RoleList = Models.AdminUser.SaveValidation.SetupAdminUserRolesOnSave(Request, AdminUser.RoleList); //if successfully saved. if (Chimera.DataAccess.AdminUserDAO.Save(AdminUser)) { AddWebUserMessageToSession(Request, OnSuccessUserMessage, SUCCESS_MESSAGE_TYPE); } else { ErrorUserMessageList.Add(new WebUserMessage(Chimera.Resources.Admin.Website.Controllers.AdminUser.UserMessages.Unable_To_Complete_Save_Default_Fail, FAILED_MESSAGE_TYPE)); } } } } else { //add user message to tell them that passwords must repeat ErrorUserMessageList.Add(new WebUserMessage(Chimera.Resources.Admin.Website.Controllers.AdminUser.UserMessages.Add_New_Passwords_Dont_Match_Fail, FAILED_MESSAGE_TYPE)); } if (ErrorUserMessageList.Count > 0) { AddWebUserMessageToSession(Request, ErrorUserMessageList); return RedirectToAction("Edit", "AdminUser", new { id = id }); } } catch (Exception e) { AddWebUserMessageToSession(Request, Chimera.Resources.Admin.Website.Controllers.AdminUser.UserMessages.Unable_To_Complete_Save_Default_Fail, FAILED_MESSAGE_TYPE); CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.AdminUserController.Edit_Post()" + e.Message); } return RedirectToAction("ViewAll", "AdminUser"); }
private KeyValuePair<string, Action<IDataContext>[]> Parse() { var actions = new List<Action<IDataContext>>(); ValidateToken(TokenType.Identifier); _parsingTarget = true; IExpressionNode target = ParsePrimary(); _parsingTarget = false; string targetPath = HandleTargetPath(target.TryGetMemberName(true, false), Context); if (string.IsNullOrEmpty(targetPath)) throw BindingExceptionManager.InvalidExpressionParser(target.ToString(), Tokenizer, Expression); actions.Add(context => context.Add(BindingBuilderConstants.TargetPath, BindingServiceProvider.BindingPathFactory(targetPath))); //Empty source path. IExpressionNode source = IsAnyOf(DelimeterTokens) ? null : ParseExpression(); while (true) { if (Tokenizer.Token == TokenType.Eof || Tokenizer.Token == TokenType.Semicolon) break; ValidateToken(TokenType.Comma); ValidateToken(NextToken(true), TokenType.Identifier); string left = Tokenizer.Value; NextToken(true); var setters = GetBindingBehaviorSetter(left); if (setters != null) { for (int i = 0; i < setters.Count; i++) actions.AddIfNotNull(setters[i]); } } source = Handle(source, true, Context, actions); actions.Add(GetBindingSourceSetter(source)); return new KeyValuePair<string, Action<IDataContext>[]>(targetPath, actions.ToArray()); }
protected IExpressionNode Handle(IExpressionNode expression, bool isPrimary, IDataContext context, List<Action<IDataContext>> actions) { for (int i = 0; i < _handlers.Count; i++) actions.AddIfNotNull(_handlers[i].Handle(ref expression, isPrimary, context)); return expression; }