public void CollectionChangedReplaceDataItemsResultInCollectionChangedForAdapter() { //create a list of dataItem containing urls IEventedList<IDataItem> dataItems = new EventedList<IDataItem>(); var oldUrl = new Url(); var newUrl = new Url(); var dataItem = new DataItem(oldUrl); dataItems.Add(dataItem); //adapter for the list var adapter = new DataItemListAdapter<Url>(dataItems); int callCount = 0; adapter.CollectionChanged += (sender, e) => { callCount++; Assert.AreEqual(NotifyCollectionChangedAction.Replace,e.Action); Assert.AreEqual(adapter, sender); Assert.AreEqual(newUrl, e.Item); //discutable but current eventedlist implementation does this Assert.AreEqual(-1, e.OldIndex); Assert.AreEqual(0, e.Index); }; //action! replace one dataitem with another dataItems[0] = new DataItem(newUrl); Assert.AreEqual(1, callCount); }
private void configureResponse(ResponseFormat expectedFormat) { Request req; var url = new Url { Scheme = "http", Path = "/" }; switch (expectedFormat) { case ResponseFormat.Html: req = new Request("GET", url, null, new Dictionary<string, IEnumerable<string>> { { "Accept", _acceptHtmlHeaders } }, null); break; case ResponseFormat.Json: req = new Request("GET", url, null, new Dictionary<string, IEnumerable<string>> { { "Accept", _acceptJsonHeaders } }, null); break; case ResponseFormat.Xml: req = new Request("GET", url, null, new Dictionary<string, IEnumerable<string>> { { "Accept", _acceptXmlHeaders } }, null); break; default: Assert.Fail("Invalid response format"); return; } _euclidApi.Context = new NancyContext { Request = req }; _euclidApi.Response = _formatter; A.CallTo(() => _formatter.Context).Returns(_euclidApi.Context); }
public bool execute(Url u) { bool res = execute0(u); if ((res == false) && next != null) res = next.execute(u); return res; }
public override bool execute0(Url u) { if (u.getNome().Contains(parte)) return true; else return false; }
protected override ContentItem GetStartPage(Url url) { if (!url.IsAbsolute) return StartPage; Site site = Host.GetSite(url) ?? Host.CurrentSite; return Persister.Get(site.StartPageID); }
public void HandleRequest(Url url, NetworkStream stream) { foreach (IPlugin p in plugins) { p.handleRequest(url, stream); } }
/// <summary> /// Get the contents of a directory. /// </summary> /// <param name="path">Remote relative path.</param> /// <param name="errorHandler">The error handler.</param> /// <returns>The <see cref="Task"/>.</returns> /// <exception cref="NotADirectoryException"></exception> public async Task<ListDirectoryResult> ListDirectory(Url path, Action<HttpStatusCode, string> errorHandler) { var request = new RestRequest(path, Method.GET); var files = await this.Client.ExecuteGetTaskAsync(request); if (files.Headers.All(h => h.Name != "is-directory")) { throw new NotADirectoryException(); } if (files.StatusCode == HttpStatusCode.OK) { return files.Content != null ? ListDirectoryResult.FromResponse(files.Content) : ListDirectoryResult.FromEmptyResponse(); } if (errorHandler != null) { errorHandler(files.StatusCode, files.StatusDescription); } return null; }
/** * init the queues which will be used as link points between the threads */ protected static void InitQueues(String taskId) { System.Console.Write("$$$ Initalizing Requests .. "); _serversQueues = new List<Queue<Url>>(); _feedBackQueue = new Queue<Url>(); for (int serverNum = 0; serverNum < _numWorkers; serverNum++) { _serversQueues.Add(new Queue<Url>()); } // getting seeds if (_operationMode == operationMode_t.Manual) { foreach (string url in _seedList) { Url task = new Url(url, 0, 100, url, 0); _feedBackQueue.Enqueue(task); } } else if (_operationMode == operationMode_t.Auto) { List<String> seeds = StorageSystem.StorageSystem.getInstance().getSeedList(taskId); foreach (string url in seeds) { Url task = new Url(url.Trim(), 0, 100, url.Trim(), 0); _feedBackQueue.Enqueue(task); //System.Console.WriteLine("SEED: " + url); } } System.Console.WriteLine("SUCCESS"); }
/// <summary> /// Download a file. /// </summary> /// <param name="path">Remote relative path of file to download.</param> /// <param name="to">Local absolute path to write the file.</param> /// <param name="errorHandler">The error handler.</param> /// <returns>The <see cref="Task"/>.</returns> /// <exception cref="NotADirectoryException">Si path indique un répertoire.</exception> public async Task DownloadFile(Url path, Url to, Action<HttpStatusCode, string> errorHandler) { if (to == null) throw new ArgumentNullException("to"); var request = new RestRequest(path, Method.GET); var fileBytes = await this.Client.ExecuteGetTaskAsync(request); if (fileBytes.Headers.Any(h => h.Name == "is-directory")) { throw new NotADirectoryException(); } if (fileBytes.StatusCode == HttpStatusCode.OK) { if (!Directory.Exists(to.GetDirectoryName())) { Directory.CreateDirectory(to.GetDirectoryName()); } File.WriteAllText(to.FullPath, fileBytes.Content, Encoding.Default); } else if (errorHandler != null) { errorHandler(fileBytes.StatusCode, fileBytes.StatusDescription); } }
public override bool execute0(Url u) { if ((u.getSize()) < base.GetTamanho()) return true; else return false; }
private static async Task<IEnumerable<string>> GetLocationEmployees(string location) { var request = new Url(BaseUrl).AppendPathSegments("deskplan", location, "employees.xml"); var response = await request.GetStreamAsync(); var xml = XDocument.Load(response); return xml.XPathSelectElements("//User").Select(u => u.Attribute(XName.Get("Name"))?.Value); }
/// <summary> /// Construct an application domain for running a test package /// </summary> /// <param name="package">The TestPackage to be run</param> public AppDomain CreateDomain( TestPackage package ) { AppDomainSetup setup = CreateAppDomainSetup(package); string domainName = "test-domain-" + package.Name; // Setup the Evidence Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence); if (evidence.Count == 0) { Zone zone = new Zone(SecurityZone.MyComputer); evidence.AddHost(zone); Assembly assembly = Assembly.GetExecutingAssembly(); Url url = new Url(assembly.CodeBase); evidence.AddHost(url); Hash hash = new Hash(assembly); evidence.AddHost(hash); } log.Info("Creating AppDomain " + domainName); AppDomain runnerDomain = AppDomain.CreateDomain(domainName, evidence, setup); // Set PrincipalPolicy for the domain if called for in the settings if (_settingsService != null && _settingsService.GetSetting("Options.TestLoader.SetPrincipalPolicy", false)) { runnerDomain.SetPrincipalPolicy(_settingsService.GetSetting( "Options.TestLoader.PrincipalPolicy", PrincipalPolicy.UnauthenticatedPrincipal)); } return runnerDomain; }
public void Check () { ApplicationDirectoryMembershipCondition ad = new ApplicationDirectoryMembershipCondition (); Evidence e = null; Assert.IsFalse (ad.Check (e), "Check (null)"); e = new Evidence (); Assert.IsFalse (ad.Check (e), "Check (empty)"); e.AddHost (new Zone (SecurityZone.MyComputer)); Assert.IsFalse (ad.Check (e), "Check (zone)"); string codebase = Assembly.GetExecutingAssembly ().CodeBase; Url u = new Url (codebase); ApplicationDirectory adir = new ApplicationDirectory (codebase); e.AddHost (u); Assert.IsFalse (ad.Check (e), "Check (url-host)"); // not enough e.AddAssembly (adir); Assert.IsFalse (ad.Check (e), "Check (url-host+adir-assembly)"); e = new Evidence (); e.AddHost (adir); Assert.IsFalse (ad.Check (e), "Check (adir-host)"); // not enough e.AddAssembly (u); Assert.IsFalse (ad.Check (e), "Check (url-assembly+adir-host)"); e = new Evidence (); e.AddHost (u); e.AddHost (adir); Assert.IsTrue (ad.Check (e), "Check (url+adir host)"); // both!! }
public void handleRequest(Url url, NetworkStream stream) { newUrl = (Url)url; DateTime Date = new DateTime(); clientStream = stream; //if (clientStream == null) throw new ArgumentNullException("stream"); string[] split = newUrl.getSplitUrl(); pluginName = newUrl.getPluginName(); if (String.Compare(pluginName, "getTemperature") == 0) { //Console.WriteLine("{0}: handleRequest", pluginName); if (split.Length == 4) { Datum = split[3] + '-' + split[2] + '-' + split[1]; //Date fehler abfragen Date = DateTime.Parse(Datum, System.Globalization.CultureInfo.InvariantCulture); Console.WriteLine("Date: {0}", Date); SearchTemp(Date); } else { Console.WriteLine("Too few Arguments"); } } }
public override bool execute0(Url u) { if (base.GetDate().CompareTo(u.getDate()) < 0) return true; else return false; }
public void Initialization() { Url url = new Url("Deltares", "http://www.deltares.com"); Assert.AreEqual("Deltares", url.Name); Assert.AreEqual("http://www.deltares.com", url.Path); }
public virtual PathData ResolveUrl(Url url) { try { var path = parser.FindPath(url.RemoveDefaultDocument(Url.DefaultDocument).RemoveExtension(observedExtensions)); path.CurrentItem = path.CurrentPage; if (draftRepository.Versions.TryParseVersion(url[PathData.VersionIndexQueryKey], url[PathData.VersionKeyQueryKey], path)) return path; string viewPreferenceParameter = url.GetQuery(WebExtensions.ViewPreferenceQueryString); if (viewPreferenceParameter == WebExtensions.DraftQueryValue && draftRepository.HasDraft(path.CurrentItem)) { var draft = draftRepository.Versions.GetVersion(path.CurrentPage); path.TryApplyVersion(draft, url["versionKey"], draftRepository.Versions); } return path; } catch (Exception ex) { errorHandler.Notify(ex); } return PathData.Empty; }
public void OriginOfGitHubAddressShouldBeGitHubCom() { var address = "https://github.com/FlorianRappl/AngleSharp"; var result = new Url(address); Assert.IsFalse(result.IsInvalid); Assert.AreEqual("https://github.com", result.Origin); }
public Url Add(string longUrl, string id = null, ObjectId userId = default(ObjectId)) { var url = new Url { LongUrl = longUrl, Id = id, UserId = userId, Created = DateTime.UtcNow, ClickCount = 0 }; // Normalize and validate long URL url.LongUrl = new UrlNormalizer().Normalize(url.LongUrl); if (url.LongUrl == null) throw new InvalidUrlException(url.LongUrl); // Generate or validate short ID if (url.Id == null) { url.Id = _idGenerator.Generate(); } else { if (_idGenerator.IsTaken(url.Id)) { throw new IdAlreadyTakenException(url.Id); } } DB.Urls.Insert(url, SafeMode.FSyncTrue); return url; }
public override bool execute0(Url u) { if ((u.gettipo()) != base.GetTipo()) return true; else return false; }
public void Cloning() { Url url = new Url("Deltares", "http://www.deltares.com"); Url urlClone = (Url) url.Clone(); Assert.AreEqual(urlClone.Name,url.Name); Assert.AreEqual(urlClone.Path,url.Path); }
public static string CreateArticle(string type, Geocode geocode, bool debugEnabled, Verbosity verbosity, List<string> fields) { var url = new Url(ArticleServiceBase); url.Append(type); HandleDefaults(url, geocode, debugEnabled, verbosity, fields); return url.ToString(); }
public void CanConvertImplicitlyToString() { Url url = new Url(canonicalUrl1); string url2 = url; Assert.AreEqual(url, url2); }
private SpiderSetting spiderSetting; //关联的Spider配置信息 #endregion Fields #region Constructors /// <summary> /// 构造函数 /// </summary> /// <param name="url">请求的Url</param> /// <param name="responseHeaders">HTTP响应头集合</param> internal RequestContext(SpiderSetting setting, Url url, HttpWebResponse response) { this.spiderSetting = setting; this.requestUrl = url; this.contentType = Content.ContentType.Unknown; this.contentEncoding = Encoding.Default; this.headers = new NameValueCollection(response.Headers); //从Headers[contentType]字符串,如 text/html;charset=gb2312,初始化ContentType和ContentEncoding StringDictionary items = Utils.DetectContentTypeHeader(response.Headers[HttpResponseHeader.ContentType]); this.mime = items["mime"] == null ? "" : items["mime"]; this.charset = items["charset"] == null ? "" : items["charset"]; if (this.mime.StartsWith("text/") || this.mime == "application/x-javascript") { this.contentType = Content.ContentType.Text; } else { this.contentType = Content.ContentType.Binary; } if (this.charset == "") { this.contentEncoding = Encoding.Default; } else { this.contentEncoding = Encoding.GetEncoding(this.charset); } }
/// <summary> /// Generates a map Uri for the given map details /// </summary> /// <param name="mapDetails"></param> /// <returns>Uri of a map image</returns> public Uri GetStaticMap(MapDetails mapDetails) { if (mapDetails == null) throw new ArgumentNullException(nameof(mapDetails)); var url = new Url(GoogleMapsEndPoint); url.SetQueryParam("size", $"{mapDetails.Width}x{mapDetails.Height}"); if (string.IsNullOrEmpty(mapDetails.EncodedPolyline)) { if(mapDetails.Center != null) { url.SetQueryParam("center", $"{mapDetails.Center.Latitude},{mapDetails.Center.Longitude}"); } url.SetQueryParam("zoom", ConvertZoomToRange(mapDetails.Zoom).ToString()); } else { url.SetQueryParam("path", "enc:" + mapDetails.EncodedPolyline); } return new Uri(url, UriKind.Absolute); }
private bool gravahtml(Url u) { try { string path = ""; byte[] stream = new System.Text.UTF8Encoding(true).GetBytes(u.getCode()); FileStream fp; if ((u.getPasta() != null) && (u.getPasta().Length > 0)) { criaestrutura(u.getDominio() + "/" + u.getPasta()); path = u.getDominio() + "\\" + u.getPasta().Replace('/', '\\') + "\\" + u.getFicheiro(); path = path.Replace('?', '-'); fp = File.Create(directorio + path); fp.Write(stream, 0, stream.Length); if (fp != null) resultado = true; fp.Close(); } else { criaestrutura(u.getDominio()); fp = File.Create(directorio + u.getDominio() + "\\" + u.getFicheiro()); fp.Write(stream, 0, stream.Length); if (fp != null) resultado = true; fp.Close(); } return true; } catch { return false; } }
public void Url_UnknownProtocol () { string url = "mono://www.go-mono.com"; Url u = new Url (url); // Fx 2.0 returns the original url, while 1.0/1.1 adds a '/' at it's end Assert.IsTrue (u.Value.StartsWith (url), "mono.Value"); }
public void EqualsReturnsFalseForInequivalentUrl() { var url1 = new Url(canonicalUrl1); var url2 = new Url(canonicalUrl2); Assert.IsFalse(url1.Equals(url2)); }
private static bool CheckRules(Url url) { RulesSection rulesConfig = LoadRules(); if (rulesConfig == null) { throw new ConfigurationErrorsException("Failed to load RulesSection from config."); } foreach (RuleElement rule in rulesConfig.Rules) { if (CheckRule(rule, url)) { RunUrl(url, rule); return true; } } if (RunDefaultApp(url)) { return true; } return false; }
private static Request CreateNancyRequest(HttpContextBase context) { var expectedRequestLength = GetExpectedRequestLength(context.Request.Headers.ToDictionary()); var basePath = context.Request.ApplicationPath; var path = context.Request.Url.AbsolutePath.Substring(basePath.Length); path = string.IsNullOrWhiteSpace(path) ? "/" : path; var nancyUrl = new Url { Scheme = context.Request.Url.Scheme, HostName = context.Request.Url.Host, Port = context.Request.Url.Port, BasePath = basePath, Path = path, Query = context.Request.Url.Query, Fragment = context.Request.Url.Fragment, }; return new Request( context.Request.HttpMethod.ToUpperInvariant(), nancyUrl, RequestStream.FromStream(context.Request.InputStream, expectedRequestLength, true), context.Request.Headers.ToDictionary(), context.Request.UserHostAddress); }
public ActionResult ExternalLogin(string provider, string returnUrl) { // Request a redirect to the external login provider return(new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }))); }
public ActionResult LinkLogin(string provider) { // 외부 로그인 공급자로 리디렉션하도록 요청하여 현재 사용자에 대한 로그인 연결 return(new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId())); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 3 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" ViewData["Title"] = "準批發會員優惠商品管理"; #line default #line hidden #line 6 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" if (ViewBag.HavePrivilege == true) { // 5-1.系統在View【OfferProduct/Index】判斷ViewBag.HavePrivilege=true。 #line default #line hidden BeginContext(209, 77, true); WriteLiteral(" <div class=\"page-header\">\r\n <h2>準批發會員優惠商品管理</h2>\r\n </div>\r\n "); EndContext(); BeginContext(286, 133, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "41eb7dc50f71421aa5ad07dfb3c0b88f", async() => { BeginContext(323, 89, true); WriteLiteral("\r\n <button type=\"submit\" class=\"btn btn-default\" id=\"btnAdd\">新增優惠商品</button>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(419, 14, true); WriteLiteral("\r\n <hr />\r\n"); EndContext(); #line 16 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" // 6.系統在View【OfferProduct/Index】顯示準批發會員優惠商品清單。 #line default #line hidden BeginContext(485, 522, true); WriteLiteral(@" <div class=""container container-fluid""> <table class=""table table-bordered""> <thead> <tr style=""color:gainsboro;background-color:#000000""> <th>商品代碼</th> <th>商品名稱</th> <th>商品圖示</th> <th>商品說明</th> <th>零售價</th> <th>批發價</th> <th>量批價</th> <th></th> </tr> </thead> <tbody> "); EndContext(); #line 32 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" foreach (ProductListViewModel MLVM in Model) { #line default #line hidden BeginContext(1089, 54, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(1144, 14, false); #line 35 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(MLVM.ProductId); #line default #line hidden EndContext(); BeginContext(1158, 35, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1194, 12, false); #line 36 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(MLVM.Product); #line default #line hidden EndContext(); BeginContext(1206, 56, true); WriteLiteral("</td>\r\n <td class=\"item-pic\"><img"); EndContext(); BeginWriteAttribute("src", " src=\"", 1262, "\"", 1350, 1); #line 37 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" WriteAttributeValue("", 1268, Url.Action("GetProductImage", "OfferProduct", new { ProeuctId = MLVM.ProductId }), 1268, 82, false); #line default #line hidden EndWriteAttribute(); BeginWriteAttribute("alt", " alt=\"", 1351, "\"", 1370, 1); #line 37 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" WriteAttributeValue("", 1357, MLVM.Product, 1357, 13, false); #line default #line hidden EndWriteAttribute(); BeginContext(1371, 103, true); WriteLiteral(" class=\"img-responsive\" style=\"max-width:200px;max-height:200px;\" /></td>\r\n <td>"); EndContext(); BeginContext(1475, 23, false); #line 38 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(MLVM.ProductDescription); #line default #line hidden EndContext(); BeginContext(1498, 35, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1534, 10, false); #line 39 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(MLVM.Price); #line default #line hidden EndContext(); BeginContext(1544, 35, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1580, 19, false); #line 40 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(MLVM.SaleLimitPrice); #line default #line hidden EndContext(); BeginContext(1599, 35, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1635, 15, false); #line 41 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(MLVM.OfferPrice); #line default #line hidden EndContext(); BeginContext(1650, 37, true); WriteLiteral("</td>\r\n <td>\r\n"); EndContext(); BeginContext(1853, 252, true); WriteLiteral(" <a class=\"btn btn-default btn-delete\" role=\"button\"><span class=\"glyphicon glyphicon-trash\" aria-hidden=\"true\" title=\"刪除\"></span></a>\r\n </td>\r\n </tr>\r\n <tr></tr>\r\n"); EndContext(); #line 48 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" } #line default #line hidden BeginContext(2124, 52, true); WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n"); EndContext(); #line 52 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" //Model #line default #line hidden BeginContext(2191, 528, true); WriteLiteral(@" <div id=""add-one"" class=""modal fade bs-example-modal-lg"" tabindex=""-1"" role=""dialog""> <div class=""modal-dialog modal-lg""> <div class=""modal-content""> <div class=""modal-header""> <button type=""button"" class=""close"" data-dismiss=""modal""><span aria-hidden=""true"">×</span><span class=""sr-only"">Close</span></button> <h4 class=""modal-title"">新增/修改優惠商品</h4> </div> <div class=""modal-body""> "); EndContext(); BeginContext(2719, 1370, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "e2269326399e4bd3ab9e693c8df9fea3", async() => { BeginContext(2845, 1237, true); WriteLiteral(@" <div class=""form-horizontal""> <div class=""form-group row""> <label for=""ProductId"" class=""col-xs-2 control-label"">商品代碼</label> <div class=""col-xs-4""><input type=""text"" name=""ProductId"" id=""ProductId"" class=""form-control"" /></div> <label for=""Product"" class=""col-xs-2 control-label"">商品名稱</label> <div class=""col-xs-4""><input type=""text"" name=""Product"" id=""Product"" class=""form-control"" /></div> </div> <div class=""form-group row""> <label for="""" class=""col-xs-2 control-label""></label> <div class=""col-xs-8""> <button type=""button"" class=""btn btn-default"" data-dismiss=""modal"">取消</button> <button type=""submit"" id=""CreateSubmit"" class=""btn btn"); WriteLiteral("-primary\">新增</button>\r\n </div>\r\n <div class=\"col-xs-2\"></div>\r\n </div>\r\n </div>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(4089, 22, true); WriteLiteral("\r\n "); EndContext(); BeginContext(4111, 1389, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "94d330b55b45497d996d148f3d7bb8dc", async() => { BeginContext(4234, 1259, true); WriteLiteral(@" <div class=""form-horizontal""> <div class=""form-group row""> <label for=""ProductIdEdit"" class=""col-xs-2 control-label"">商品代碼</label> <div class=""col-xs-4""><input type=""text"" name=""ProductIdEdit"" id=""ProductIdEdit"" class=""form-control"" /></div> <label for=""ProductEdit"" class=""col-xs-2 control-label"">商品名稱</label> <div class=""col-xs-4""><input type=""text"" name=""ProductEdit"" id=""ProductEdit"" class=""form-control"" /></div> </div> <div class=""form-group row""> <label for="""" class=""col-xs-2 control-label""></label> <div class=""col-xs-8""> <button type=""button"" class=""btn btn-default"" data-dismiss=""modal"">取消</button> <button type=""submit"" id=""Edit"); WriteLiteral("Submit\" class=\"btn btn-primary\">修改</button>\r\n </div>\r\n <div class=\"col-xs-2\"></div>\r\n </div>\r\n </div>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_7.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_7); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_8); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(5500, 74, true); WriteLiteral("\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n"); EndContext(); DefineSection("scripts", async() => { BeginContext(5597, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(6080, 8, true); WriteLiteral(" "); EndContext(); BeginContext(6088, 44, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "819457c67f4f4bc68099495932b688cf", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_9); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(6132, 10, true); WriteLiteral("\r\n "); EndContext(); BeginContext(6142, 44, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "182dac97e43b4673a8fe2a6036ab4c58", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_10); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(6186, 135, true); WriteLiteral("\r\n <script>\r\n\r\n $(function () {\r\n OfferProductfunction({\r\n DeleteOfferProductUrl: \'"); EndContext(); BeginContext(6322, 48, false); #line 118 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" Write(Url.Action("DeleteOfferProduct", "OfferProduct")); #line default #line hidden EndContext(); BeginContext(6370, 64, true); WriteLiteral("\'\r\n });\r\n });\r\n </script>\r\n "); EndContext(); } ); #line 122 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" } else { // 5-1a.系統在View【Member/Index】判斷ViewBag.HavePrivilege=false。 // 5-1a-1.系統顯示"無此權限"。 #line default #line hidden BeginContext(6542, 66, true); WriteLiteral(" <div class=\"page-header\">\r\n <h2>無此權限</h2>\r\n </div>\r\n"); EndContext(); #line 131 "C:\Users\a5772\Desktop\1.6\YunQi\YunQiERP\Views\OfferProduct\Index.cshtml" } #line default #line hidden }
public ActionResult LinkLogin(string provider) { // 请求重定向至外部登录提供程序,以链接当前用户的登录名 return(new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId())); }
/// <summary>Gets the url to the edit interface.</summary> /// <returns>The url to the edit interface.</returns> public virtual string GetManagementInterfaceUrl() { return(Url.ResolveTokens(ManagementInterfaceUrl + "/")); }
/// <summary>Gets the url to the edit interface.</summary> /// <returns>The url to the edit interface.</returns> public virtual string GetEditInterfaceUrl(ViewPreference preference = ViewPreference.Published) { return(Url.ResolveTokens(EditInterfaceUrl).ToUrl().AppendViewPreference(preference, defaultViewPreference)); }
private async Task SendConfirmation(ApplicationUser user, string email, string requestScheme) { var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.EmailConfirmationLink(user.Id, code, requestScheme); await _emailSender.SendEmailConfirmationAsync(email, callbackUrl); }
/// <summary> /// 获取统一下单地址 /// </summary> public string GetOrderUrl() { return Url.Combine( GatewayUrl, "pay/unifiedorder" ); }
public ActionResult Put(LeaveMessageCommand dto) { if (Regex.Match(dto.Content, CommonHelper.BanRegex).Length > 0) { return(ResultData(null, false, "您提交的内容包含敏感词,被禁止发表,请检查您的内容后尝试重新提交!")); } dto.Content = dto.Content.Trim().Replace("<p><br></p>", string.Empty); if (dto.Content.RemoveHtmlTag().Trim().Equals(HttpContext.Session.Get <string>("msg"))) { return(ResultData(null, false, "您刚才已经发表过一次留言了!")); } var msg = dto.Mapper <LeaveMessage>(); if (Regex.Match(dto.Content, CommonHelper.ModRegex).Length <= 0) { msg.Status = Status.Pended; } msg.PostDate = DateTime.Now; var user = HttpContext.Session.Get <UserInfoDto>(SessionKey.UserInfo); if (user != null) { msg.NickName = user.NickName; msg.QQorWechat = user.QQorWechat; msg.Email = user.Email; if (user.IsAdmin) { msg.Status = Status.Pended; msg.IsMaster = true; } } msg.Content = dto.Content.HtmlSantinizerStandard().ClearImgAttributes(); msg.Browser = dto.Browser ?? Request.Headers[HeaderNames.UserAgent]; msg.IP = ClientIP; msg.Location = msg.IP.GetIPLocation().Split("|").Where(s => !int.TryParse(s, out _)).ToHashSet().Join("|"); msg = LeaveMessageService.AddEntitySaved(msg); if (msg == null) { return(ResultData(null, false, "留言发表失败!")); } HttpContext.Session.Set("msg", msg.Content.RemoveHtmlTag().Trim()); var email = CommonHelper.SystemSettings["ReceiveEmail"]; var content = System.IO.File.ReadAllText(HostEnvironment.WebRootPath + "/template/notify.html").Replace("{{title}}", "网站留言板").Replace("{{time}}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")).Replace("{{nickname}}", msg.NickName).Replace("{{content}}", msg.Content); if (msg.Status == Status.Pended) { if (!msg.IsMaster) { MessageService.AddEntitySaved(new InternalMessage() { Title = $"来自【{msg.NickName}】的新留言", Content = msg.Content, Link = Url.Action("Index", "Msg", new { cid = msg.Id }, Request.Scheme) }); } #if !DEBUG if (msg.ParentId == 0) { //新评论,只通知博主 BackgroundJob.Enqueue(() => CommonHelper.SendMail(CommonHelper.SystemSettings["Domain"] + "|博客新留言:", content.Replace("{{link}}", Url.Action("Index", "Msg", new { cid = msg.Id }, Request.Scheme)), email)); } else { //通知博主和上层所有关联的评论访客 var pid = LeaveMessageService.GetParentMessageIdByChildId(msg.Id); var emails = LeaveMessageService.GetSelfAndAllChildrenMessagesByParentId(pid).Select(c => c.Email).Append(email).Except(new[] { msg.Email }).ToHashSet(); string link = Url.Action("Index", "Msg", new { cid = msg.Id }, Request.Scheme); foreach (var s in emails) { BackgroundJob.Enqueue(() => CommonHelper.SendMail($"{CommonHelper.SystemSettings["Domain"]}{CommonHelper.SystemSettings["Title"]} 留言回复:", content.Replace("{{link}}", link), s)); } } #endif return(ResultData(null, true, "留言发表成功,服务器正在后台处理中,这会有一定的延迟,稍后将会显示到列表中!")); } BackgroundJob.Enqueue(() => CommonHelper.SendMail(CommonHelper.SystemSettings["Domain"] + "|博客新留言(待审核):", content.Replace("{{link}}", Url.Action("Index", "Msg", new { cid = msg.Id }, Request.Scheme)) + "<p style='color:red;'>(待审核)</p>", email)); return(ResultData(null, true, "留言发表成功,待站长审核通过以后将显示到列表中!")); }
public override void Execute() { #line 3 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" ViewBag.Title = "View Required Education"; var EntityDisplayNameReflector = ModelReflector.Entities.FirstOrDefault(p => p.Name == "T_RequiredEducation"); var EntityDisplayName = EntityDisplayNameReflector != null ? EntityDisplayNameReflector.DisplayName : "Required Education"; #line default #line hidden WriteLiteral("\r\n<script>\r\n $(document).ready(function () {\r\n\t\t\t if ($.cookie(\'"); #line 10 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(User.JavaScriptEncodedName); #line default #line hidden #line 10 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Model.Id); #line default #line hidden WriteLiteral("\' + \'TabCookie\') != null) {\r\n\t\t\t\t$(\'a[href=\"#\' + $.cookie(\'"); #line 11 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(User.JavaScriptEncodedName); #line default #line hidden #line 11 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Model.Id); #line default #line hidden WriteLiteral("\' + \'TabCookie\') + \'\"]\').click();\r\n\t\t\t }\r\n });\r\n</script>\r\n"); #line 15 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (!string.IsNullOrEmpty(ViewBag.T_RequiredEducationIsHiddenRule)) { #line default #line hidden #line 18 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.Raw(ViewBag.T_RequiredEducationIsHiddenRule)); #line default #line hidden #line 18 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" ; } #line default #line hidden WriteLiteral("\r\n"); #line 21 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (!string.IsNullOrEmpty(ViewBag.T_RequiredEducationIsGroupsHiddenRule)) { #line default #line hidden #line 24 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.Raw(ViewBag.T_RequiredEducationIsGroupsHiddenRule)); #line default #line hidden #line 24 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" ; } #line default #line hidden WriteLiteral("\r\n"); #line 27 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (!string.IsNullOrEmpty(ViewBag.T_RequiredEducationIsSetValueUIRule)) { #line default #line hidden #line 30 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.Raw(ViewBag.T_RequiredEducationIsSetValueUIRule)); #line default #line hidden #line 30 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" ; } #line default #line hidden WriteLiteral("\r\n<div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"col-lg-12\""); WriteLiteral(">\r\n <h1"); WriteLiteral(" class=\"page-title\""); WriteLiteral(">\r\n <i"); WriteLiteral(" class=\"glyphicon glyphicon-hand-down text-primary\""); WriteLiteral("></i> "); #line 36 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(EntityDisplayName); #line default #line hidden WriteLiteral(" <i"); WriteLiteral(" class=\"glyphicon glyphicon-chevron-right small\""); WriteLiteral("></i> <span>View</span>\r\n </h1>\r\n <h2"); WriteLiteral(" class=\"text-primary\""); WriteLiteral("><span"); WriteLiteral(" id=\"HostingEntityDisplayValue\""); WriteLiteral(">"); #line 38 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.DisplayFor(model => model.DisplayValue)); #line default #line hidden WriteLiteral("</span>\r\n\t\t\t<div"); WriteLiteral(" class=\"btn-group pull-right fixactionbut\""); WriteLiteral(">\r\n <button"); WriteLiteral(" data-toggle=\"dropdown\""); WriteLiteral(" class=\"btn btn-xs dropdown-toggle btn-default pull-right\""); WriteLiteral(">\r\n Action\r\n <span"); WriteLiteral(" class=\"caret\""); WriteLiteral("> </span>\r\n </button>\r\n\t\t\t<ul"); WriteLiteral(" class=\"dropdown-menu pull-left\""); WriteLiteral("> \r\n\t\t\t\t<li>\r\n"); #line 46 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 46 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanEdit("T_RequiredEducation")) { #line default #line hidden WriteLiteral(" <a"); WriteAttribute("href", Tuple.Create(" href=\"", 1928), Tuple.Create("\"", 2207) #line 48 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 1935), Tuple.Create <System.Object, System.Int32>(Url.Action("Edit", "T_RequiredEducation", new { id = Model.Id, UrlReferrer = Request.Url, AssociatedType = ViewData["AssociatedType"], HostingEntityName = @Convert.ToString(ViewData["HostingEntity"]), HostingEntityID = @Convert.ToString(ViewData["HostingEntityID"]) }, null) #line default #line hidden , 1935), false) ); WriteLiteral("><i"); WriteLiteral(" class=\"glyphicon glyphicon-edit\""); WriteLiteral("></i> Edit</a>\r\n"); #line 49 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral(" </li> \r\n\t\t\t\t<li>\r\n"); #line 52 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 52 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanDelete("T_RequiredEducation")) { #line default #line hidden WriteLiteral(" <a"); WriteAttribute("href", Tuple.Create(" href=\"", 2445), Tuple.Create("\"", 2727) #line 54 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 2452), Tuple.Create <System.Object, System.Int32>(Url.Action("Delete", "T_RequiredEducation", new { id = Model.Id, UrlReferrer = Request.Url, AssociatedType = ViewData["AssociatedType"], HostingEntityName = @Convert.ToString(ViewData["HostingEntity"]), HostingEntityID = @Convert.ToString(ViewData["HostingEntityID"]) }, null) #line default #line hidden , 2452), false) ); WriteLiteral("><i"); WriteLiteral(" class=\"glyphicon glyphicon-remove-sign\""); WriteLiteral("></i> Delete</a>\r\n"); #line 55 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral(" </li>\r\n <li"); WriteLiteral(" class=\"divider\""); WriteLiteral(" style=\"clear:both\""); WriteLiteral("></li>\r\n <li"); WriteLiteral(" class=\"dropdown-submenu pull-left\""); WriteLiteral(">\r\n\t<a"); WriteLiteral(" tabindex=\"-1\""); WriteLiteral(" href=\"#\""); WriteLiteral(" style=\"margin-bottom:10px;\""); WriteLiteral(">Find Matching</a>\r\n <ul"); WriteLiteral(" class=\"dropdown-menu pull-left\""); WriteLiteral(">\r\n<li>\r\n\t\t<a"); WriteAttribute("href", Tuple.Create(" href=\"", 3051), Tuple.Create("\"", 3158) #line 62 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3058), Tuple.Create <System.Object, System.Int32>(Url.Action("FindFSearch", "T_Position", new { sourceEntity = "T_RequiredEducation", id = Model.Id }, null) #line default #line hidden , 3058), false) ); WriteLiteral(">Position</a>\r\n</li>\r\n<li>\r\n\t\t<a"); WriteAttribute("href", Tuple.Create(" href=\"", 3191), Tuple.Create("\"", 3299) #line 65 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3198), Tuple.Create <System.Object, System.Int32>(Url.Action("FindFSearch", "T_Education", new { sourceEntity = "T_RequiredEducation", id = Model.Id }, null) #line default #line hidden , 3198), false) ); WriteLiteral(">Education</a>\r\n</li>\r\n</ul>\r\n</li>\r\n\t\t\t</ul>\r\n</div>\r\n\t\t</h2>\r\n </div>\r\n <" + "!-- /.col-lg-12 -->\r\n</div>\r\n<div"); WriteLiteral(" class=\"tabbable responsive\""); WriteLiteral(">\r\n <ul"); WriteLiteral(" class=\"nav nav-tabs\""); WriteLiteral(">\r\n\t <li"); WriteLiteral(" class=\"active\""); WriteLiteral("><a"); WriteLiteral(" href=\"#Details\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 3515), Tuple.Create("\"", 3580) , Tuple.Create(Tuple.Create("", 3525), Tuple.Create("ClearTabCookie(\'", 3525), true) #line 77 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3541), Tuple.Create <System.Object, System.Int32>(User.JavaScriptEncodedName #line default #line hidden , 3541), false) #line 77 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3568), Tuple.Create <System.Object, System.Int32>(Model.Id #line default #line hidden , 3568), false) , Tuple.Create(Tuple.Create("", 3577), Tuple.Create("\');", 3577), true) ); WriteLiteral(" data-toggle=\"tab\""); WriteLiteral(">Details</a></li>\r\n\t\t <li "); #line 78 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(!User.CanView("JournalEntry")?"style=display:none;":""); #line default #line hidden WriteLiteral("><a"); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 3685), Tuple.Create("\"", 3987) , Tuple.Create(Tuple.Create("", 3695), Tuple.Create("LoadTab(\'JournalEntryToT_RequiredEducationRelation\',\'", 3695), true) #line 78 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3748), Tuple.Create <System.Object, System.Int32>(User.JavaScriptEncodedName #line default #line hidden , 3748), false) #line 78 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3775), Tuple.Create <System.Object, System.Int32>(Model.Id #line default #line hidden , 3775), false) , Tuple.Create(Tuple.Create("", 3784), Tuple.Create("\',\'", 3784), true) #line 78 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" , Tuple.Create(Tuple.Create("", 3787), Tuple.Create <System.Object, System.Int32>(Url.Action("Index", "JournalEntry", new { RenderPartial = true, HostingEntity = "T_RequiredEducation", HostingEntityID = @Model.Id, AssociatedType = "JournalEntry", TabToken = DateTime.Now.Ticks }) #line default #line hidden , 3787), false) , Tuple.Create(Tuple.Create("", 3985), Tuple.Create("\')", 3985), true) ); WriteLiteral(" href=\"#JournalEntryToT_RequiredEducationRelation\""); WriteLiteral(" data-toggle=\"tab\""); WriteLiteral(">Required Education Journal</a></li>\r\n </ul>\r\n\t <div"); WriteLiteral(" class=\"tab-content\""); WriteLiteral(">\r\n\t\t <div"); WriteLiteral(" class=\"tab-pane fade in active\""); WriteLiteral(" id=\"Details\""); WriteLiteral(">\r\n\t\t\t\t <div"); WriteLiteral(" class=\"panel panel-default AppForm\""); WriteLiteral(">\r\n\t\t\t\t\t<div"); WriteLiteral(" class=\"panel-body\""); WriteLiteral(">\r\n \r\n\t\t\t<div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n\t\t\t\t<div"); WriteLiteral(" class=\"col-sm-12 col-md-12 col-xs-12\""); WriteLiteral(">\r\n\t\t\t<div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n"); #line 88 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanView("T_RequiredEducation", "T_RoleCodeRequiredEducationID")) { #line default #line hidden WriteLiteral("<div"); WriteLiteral(" class=\'col-sm-6 col-md-6 col-xs-12\'"); WriteLiteral(" id=\"dvT_RoleCodeRequiredEducation\""); WriteLiteral(">\r\n\t<div"); WriteLiteral(" class=\'form-group\'"); WriteLiteral(" >\r\n\t\t<label"); WriteLiteral(" class=\"col-sm-5 col-md-5 col-xs-12\""); WriteLiteral(">"); #line 92 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.DisplayNameFor(model => model.T_RoleCodeRequiredEducationID)); #line default #line hidden WriteLiteral("</label>\r\n\t\t<div"); WriteLiteral(" class=\"input-group col-sm-7 col-md-7 col-xs-12\""); WriteLiteral(">\r\n"); #line 94 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 94 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (Model.t_rolecoderequirededucation != null && !string.IsNullOrEmpty(Model.t_rolecoderequirededucation.DisplayValue)) { #line default #line hidden WriteLiteral("\t\t <p"); WriteLiteral(" class=\"viewlabel\""); WriteLiteral(">\r\n"); WriteLiteral("\t\t"); #line 97 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.ActionLink(Html.DisplayFor(model => model.t_rolecoderequirededucation.DisplayValue).ToString(), "Details", "T_RoleCode", new { Id = Html.DisplayFor(model => model.t_rolecoderequirededucation.Id).ToString() }, null)); #line default #line hidden WriteLiteral("\r\n\t\t</p>\r\n"); #line 99 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral("\t\t</div>\r\n\t</div>\r\n</div>\r\n"); #line 103 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden #line 104 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanView("T_RequiredEducation", "T_RequiredEducationSOCCodeID")) { #line default #line hidden WriteLiteral("<div"); WriteLiteral(" class=\'col-sm-6 col-md-6 col-xs-12\'"); WriteLiteral(" id=\"dvT_RequiredEducationSOCCode\""); WriteLiteral(">\r\n\t<div"); WriteLiteral(" class=\'form-group\'"); WriteLiteral(" >\r\n\t\t<label"); WriteLiteral(" class=\"col-sm-5 col-md-5 col-xs-12\""); WriteLiteral(">"); #line 108 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.DisplayNameFor(model => model.T_RequiredEducationSOCCodeID)); #line default #line hidden WriteLiteral("</label>\r\n\t\t<div"); WriteLiteral(" class=\"input-group col-sm-7 col-md-7 col-xs-12\""); WriteLiteral(">\r\n"); #line 110 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 110 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (Model.t_requirededucationsoccode != null && !string.IsNullOrEmpty(Model.t_requirededucationsoccode.DisplayValue)) { #line default #line hidden WriteLiteral("\t\t <p"); WriteLiteral(" class=\"viewlabel\""); WriteLiteral(">\r\n"); WriteLiteral("\t\t"); #line 113 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.ActionLink(Html.DisplayFor(model => model.t_requirededucationsoccode.DisplayValue).ToString(), "Details", "T_SocCode", new { Id = Html.DisplayFor(model => model.t_requirededucationsoccode.Id).ToString() }, null)); #line default #line hidden WriteLiteral("\r\n\t\t</p>\r\n"); #line 115 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral("\t\t</div>\r\n\t</div>\r\n</div>\r\n"); #line 119 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden #line 120 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanView("T_RequiredEducation", "T_RequiredEducationEducationLevelID")) { #line default #line hidden WriteLiteral("<div"); WriteLiteral(" class=\'col-sm-6 col-md-6 col-xs-12\'"); WriteLiteral(" id=\"dvT_RequiredEducationEducationLevel\""); WriteLiteral(">\r\n\t<div"); WriteLiteral(" class=\'form-group\'"); WriteLiteral(" >\r\n\t\t<label"); WriteLiteral(" class=\"col-sm-5 col-md-5 col-xs-12\""); WriteLiteral(">"); #line 124 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.DisplayNameFor(model => model.T_RequiredEducationEducationLevelID)); #line default #line hidden WriteLiteral("</label>\r\n\t\t<div"); WriteLiteral(" class=\"input-group col-sm-7 col-md-7 col-xs-12\""); WriteLiteral(">\r\n"); #line 126 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 126 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (Model.t_requirededucationeducationlevel != null && !string.IsNullOrEmpty(Model.t_requirededucationeducationlevel.DisplayValue)) { #line default #line hidden WriteLiteral("\t\t <p"); WriteLiteral(" class=\"viewlabel\""); WriteLiteral(">\r\n"); WriteLiteral("\t\t"); #line 129 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.ActionLink(Html.DisplayFor(model => model.t_requirededucationeducationlevel.DisplayValue).ToString(), "Details", "T_EducationLevel", new { Id = Html.DisplayFor(model => model.t_requirededucationeducationlevel.Id).ToString() }, null)); #line default #line hidden WriteLiteral("\r\n\t\t</p>\r\n"); #line 131 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral("\t\t</div>\r\n\t</div>\r\n</div>\r\n"); #line 135 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden #line 136 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanView("T_RequiredEducation", "T_Description")) { #line default #line hidden WriteLiteral("<div"); WriteLiteral(" class=\'col-sm-6 col-md-6 col-xs-12\'"); WriteLiteral(" id=\"dvT_Description\""); WriteLiteral(">\r\n\t<div"); WriteLiteral(" class=\'form-group\'"); WriteLiteral(" title=\"Education Details\""); WriteLiteral(">\r\n\t\t<label"); WriteLiteral(" class=\"col-sm-5 col-md-5 col-xs-12\""); WriteLiteral(">"); #line 140 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.DisplayNameFor(model => model.T_Description)); #line default #line hidden WriteLiteral("</label>\r\n\t\t<div"); WriteLiteral(" class=\"input-group col-sm-7 col-md-7 col-xs-12\""); WriteLiteral(">\r\n\t\t<p"); WriteLiteral(" class=\"viewlabel\""); WriteLiteral(">"); #line 142 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Model.T_Description); #line default #line hidden WriteLiteral("</p>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n"); #line 146 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral("\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n\t\t\t\t<div"); WriteLiteral(" class=\"col-md-12 col-sm-12 col-xs-12\""); WriteLiteral(">\r\n"); WriteLiteral("\t\t\t\t\t"); #line 154 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.ActionLink("Back", "Cancel", new { UrlReferrer = Request.UrlReferrer }, new { @class = "btn btn-default btn-sm pull-left formbuttonfix" })); #line default #line hidden WriteLiteral("\r\n"); #line 155 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 155 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanEdit("T_RequiredEducation")) { #line default #line hidden #line 157 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" Write(Html.ActionLink("Edit", "Edit", new { id = Model.Id, AssociatedType = ViewData["AssociatedType"], HostingEntityName = @Convert.ToString(ViewData["HostingEntity"]), HostingEntityID = @Convert.ToString(ViewData["HostingEntityID"]) }, new { @class = "btn btn-primary btn-sm pull-left formbuttonfix" })); #line default #line hidden #line 157 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" } #line default #line hidden WriteLiteral("\t\t\t\t</div>\r\n\t\t\t</div> \r\n\t</div> \r\n<div"); WriteLiteral(" class=\"tab-pane fade in\""); WriteLiteral(" id=\"JournalEntryToT_RequiredEducationRelation\""); WriteLiteral(">\r\n"); #line 163 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" #line default #line hidden #line 163 "..\..\Views\T_RequiredEducation\DetailsContent.cshtml" if (User.CanView("JournalEntry")) { // Html.RenderAction("Index", "JournalEntry", new { RenderPartial = true, HostingEntity = "T_RequiredEducation", HostingEntityID = @Model.Id, AssociatedType = "JournalEntry" }); } #line default #line hidden WriteLiteral(" </div>\r\n\t</div> <!-- /tab-content --><br />\r\n\r\n<br/>\r\n</div>\r\n \r\n"); }
public ActionResult ExternalLogin(string provider, string returnUrl) { // Request a redirect to the external login provider return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { loginProvider = provider, ReturnUrl = returnUrl }), this.AuthenticationManager); }
public ActionResult ExternalLogin(string provider, string returnUrl) { return(new ExternalLoginResult(provider, Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl }))); }
public async Task<IActionResult> SeNames(DataSourceRequest command, UrlRecordListModel model) { var urlRecords = await _urlRecordService.GetAllUrlRecords(model.SeName, command.Page - 1, command.PageSize); var items = new List<UrlRecordModel>(); foreach (var x in urlRecords) { //language string languageName; if (String.IsNullOrEmpty(x.LanguageId)) { languageName = _localizationService.GetResource("Admin.System.SeNames.Language.Standard"); } else { var language = await _languageService.GetLanguageById(x.LanguageId); languageName = language != null ? language.Name : "Unknown"; } //details URL string detailsUrl = ""; var entityName = x.EntityName != null ? x.EntityName.ToLowerInvariant() : ""; switch (entityName) { case "blogpost": detailsUrl = Url.Action("Edit", "Blog", new { id = x.EntityId }); break; case "category": detailsUrl = Url.Action("Edit", "Category", new { id = x.EntityId }); break; case "manufacturer": detailsUrl = Url.Action("Edit", "Manufacturer", new { id = x.EntityId }); break; case "product": detailsUrl = Url.Action("Edit", "Product", new { id = x.EntityId }); break; case "newsitem": detailsUrl = Url.Action("Edit", "News", new { id = x.EntityId }); break; case "topic": detailsUrl = Url.Action("Edit", "Topic", new { id = x.EntityId }); break; case "vendor": detailsUrl = Url.Action("Edit", "Vendor", new { id = x.EntityId }); break; case "course": detailsUrl = Url.Action("Edit", "Course", new { id = x.EntityId }); break; case "knowledgebasecategory": detailsUrl = Url.Action("EditCategory", "Knowledgebase", new { id = x.EntityId }); break; case "knowledgebasearticle": detailsUrl = Url.Action("EditArticle", "Knowledgebase", new { id = x.EntityId }); break; default: break; } items.Add(new UrlRecordModel { Id = x.Id, Name = x.Slug, EntityId = x.EntityId, EntityName = x.EntityName, IsActive = x.IsActive, Language = languageName, DetailsUrl = detailsUrl }); } var gridModel = new DataSourceResult { Data = items, Total = urlRecords.TotalCount }; return Json(gridModel); }
/// <summary> /// 附件管理列表 /// </summary> /// <param name="id">公共模型ID</param> /// <param name="dir">目录(类型)</param> /// <returns></returns> public ActionResult FileManagerJson(int?id, string dir) { EUWeb.Areas.Member.Models.AttachmentManagerViewModel _attachmentViewModel; IQueryable <Attachment> _attachments; //id为null,表示是公共模型id为null,此时查询数据库中没有跟模型对应起来的附件列表(以上传,但上传的文章……还未保存) if (id == null) { _attachments = attachmentService.FindList(null, User.Identity.Name, dir); } //id不为null,返回指定模型id和id为null(新上传的)附件了列表 else { _attachments = attachmentService.FindList((int)id, User.Identity.Name, dir, true); } //循环构造AttachmentManagerViewModel var _attachmentList = new List <EUWeb.Areas.Member.Models.AttachmentManagerViewModel>(_attachments.Count()); foreach (var _attachment in _attachments) { _attachmentViewModel = new EUWeb.Areas.Member.Models.AttachmentManagerViewModel() { datetime = _attachment.UploadDate.ToString("yyyy-MM-dd HH:mm:ss"), filetype = _attachment.Extension, has_file = false, is_dir = false, is_photo = _attachment.Type.ToLower() == "image" ? true : false, filename = Url.Content(_attachment.FilePath) }; FileInfo _fileInfo = new FileInfo(Server.MapPath(_attachment.FilePath)); _attachmentViewModel.filesize = (int)_fileInfo.Length; _attachmentList.Add(_attachmentViewModel); } return(Json(new { moveup_dir_path = "", current_dir_path = "", current_url = "", total_count = _attachmentList.Count, file_list = _attachmentList }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 上传附件 /// </summary> /// <returns></returns> public ActionResult Upload() { var _uploadConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~").GetSection("UploadConfig") as EUWeb.Models.Config.UploadConfig; //文件最大限制 int _maxSize = _uploadConfig.MaxSize; //保存路径 string _savePath; //文件路径 string _fileParth = "~/" + _uploadConfig.Path + "/"; //文件名 string _fileName; //扩展名 string _fileExt; //文件类型 string _dirName; //允许上传的类型 Hashtable extTable = new Hashtable(); extTable.Add("image", _uploadConfig.ImageExt); extTable.Add("flash", _uploadConfig.FileExt); extTable.Add("media", _uploadConfig.MediaExt); extTable.Add("file", _uploadConfig.FileExt); //上传的文件 HttpPostedFileBase _postFile = Request.Files["imgFile"]; if (_postFile == null) { return(Json(new { error = '1', message = "请选择文件" })); } _fileName = _postFile.FileName; _fileExt = Path.GetExtension(_fileName).ToLower(); //文件类型 _dirName = Request.QueryString["dir"]; if (string.IsNullOrEmpty(_dirName)) { _dirName = "image"; } if (!extTable.ContainsKey(_dirName)) { return(Json(new { error = 1, message = "目录类型不存在" })); } //文件大小 if (_postFile.InputStream == null || _postFile.InputStream.Length > _maxSize) { return(Json(new { error = 1, message = "文件大小超过限制" })); } //检查扩展名 if (string.IsNullOrEmpty(_fileExt) || Array.IndexOf(((string)extTable[_dirName]).Split(','), _fileExt.Substring(1).ToLower()) == -1) { return(Json(new { error = 1, message = "不允许上传此类型的文件。 \n只允许" + ((String)extTable[_dirName]) + "格式。" })); } _fileParth += _dirName + "/" + DateTime.Now.ToString("yyyy-MM") + "/"; _savePath = Server.MapPath(_fileParth); //检查上传目录 if (!Directory.Exists(_savePath)) { Directory.CreateDirectory(_savePath); } string _newFileName = DateTime.Now.ToString("yyyyMMdd_hhmmss") + _fileExt; _savePath += _newFileName; _fileParth += _newFileName; //保存文件 _postFile.SaveAs(_savePath); //保存数据库记录 Attachment attachment = new Attachment() { Extension = _fileExt.Substring(1), FilePath = _fileParth, Owner = User.Identity.Name, UploadDate = DateTime.Now, Type = _dirName }; attachmentService.Add(attachment); return(Json(new { error = 0, url = Url.Content(_fileParth) })); }
public ActionResult ExternalLogin(string provider, string returnUrl) { // Solicitar redireccionamiento al proveedor de inicio de sesión externo return(new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }))); }
public ActionResult ExternalLogin(string provider, string returnUrl) { // Solicitar um redirecionamento para o provedor de logon externo return(new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }))); }
public ActionResult ExternalLogin(string provider, string returnUrl) { // Запрос перенаправления к внешнему поставщику входа return(new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }))); }
public ActionResult LinkLogin(string provider) { // Żądaj przekierowania do dostawcy logowania zewnętrznego w celu połączenia logowania bieżącego użytkownika return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId()); }
public async Task <IActionResult> Login(LoginInputModel model, string button) { // check if we are in the context of an authorization request var context = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl); // the user clicked the "cancel" button if (button != "login") { if (context != null) { // if the user cancels, send a result back into IdentityServer as if they // denied the consent (even if this client does not require consent). // this will send back an access denied OIDC error response to the client. await _interaction.GrantConsentAsync(context, ConsentResponse.Denied); // we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null if (await _clientStore.IsPkceClientAsync(context.ClientId)) { // if the client is PKCE then we assume it's native, so this change in how to // return the response is for better UX for the end user. return(View("Redirect", new RedirectViewModel { RedirectUrl = model.ReturnUrl })); } return(Redirect(model.ReturnUrl)); } else { // since we don't have a valid context, then we just go back to the home page return(Redirect("~/")); } } if (ModelState.IsValid) { var result = await _signInManager.PasswordSignInAsync(model.Username, model.Password, model.RememberLogin, lockoutOnFailure : true); if (result.Succeeded) { var user = await _userManager.FindByNameAsync(model.Username); await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id, user.UserName)); if (context != null) { if (await _clientStore.IsPkceClientAsync(context.ClientId)) { // if the client is PKCE then we assume it's native, so this change in how to // return the response is for better UX for the end user. return(View("Redirect", new RedirectViewModel { RedirectUrl = model.ReturnUrl })); } // we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null return(Redirect(model.ReturnUrl)); } // request for a local page if (Url.IsLocalUrl(model.ReturnUrl)) { return(Redirect(model.ReturnUrl)); } else if (string.IsNullOrEmpty(model.ReturnUrl)) { return(Redirect("~/")); } else { // user might have clicked on a malicious link - should be logged throw new Exception("invalid return URL"); } } await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials")); ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage); } // something went wrong, show form with error var vm = await BuildLoginViewModelAsync(model); return(View(vm)); }
public async Task<ActionResult> Register(RegisterViewModel model) { ActionResult rtnResult; if (ModelState.IsValid) { // Initiate variables to check for valid passwords char[] pwTest = model.Password.ToCharArray(); string capLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string lowLetters = capLetters.ToLower(); string symbols = "!@#$%^&*"; string numbers = "1234567890"; int capCount = 0; int lowCount = 0; int symbolCount = 0; int numberCount = 0; // Increment counters for all necessary characters for(int i = 0; i < pwTest.Length; i++) { if(capLetters.Contains(pwTest[i])) { capCount++; } if (lowLetters.Contains(pwTest[i])) { lowCount++; } if(symbols.Contains(pwTest[i])) { symbolCount++; } if(numbers.Contains(pwTest[i])) { numberCount++; } } // If any counter is == 0, password is invalid if(capCount == 0 || lowCount == 0 || symbolCount == 0 || numberCount == 0) { ModelState.AddModelError("", "Passwords must have at least one non letter or digit character. Passwords must have at least one digit ('0'-'9'). Passwords must have at least one uppercase ('A'-'Z')."); return View(model); } // Check if email is already in database var userTest = await UserManager.FindByEmailAsync(model.Email); if(userTest != null) { ModelState.AddModelError("", "Email is already registered"); return View(model); } var user = new ApplicationUser { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, UserName = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Account Confirmation", callbackUrl); rtnResult = View("ResendConfirmationEmail"); } else { rtnResult = View("Error"); } AddErrors(result); } else { rtnResult = View(); } // If we got this far, something failed, redisplay form return rtnResult; }
public ActionResult LinkLogin(string provider) { // Request a redirect to the external login provider to link a login for the current user return(new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId())); }
public override void Execute() { #line 9 "..\..\Translation\Views\SyncInstance.cshtml" CultureInfo culture = ViewBag.Culture; ViewBag.Title = TranslationMessage.Synchronize0In1.NiceToString().FormatWith(Model.Type.NiceName(), culture.DisplayName); int totalInstances = ViewBag.TotalInstances; if (Model.Instances.Count < totalInstances) { ViewBag.Title = ViewBag.Title + " [{0}/{1}]".FormatWith(Model.Instances.Count, totalInstances); } #line default #line hidden WriteLiteral("\r\n\r\n"); #line 22 "..\..\Translation\Views\SyncInstance.cshtml" Write(Html.ScriptsJs("~/Translation/resources/" + CultureInfo.CurrentCulture.Name + ".js")); #line default #line hidden WriteLiteral("\r\n"); #line 23 "..\..\Translation\Views\SyncInstance.cshtml" Write(Html.ScriptCss("~/Translation/Content/Translation.css")); #line default #line hidden WriteLiteral("\r\n\r\n"); #line 25 "..\..\Translation\Views\SyncInstance.cshtml" if (Model.Instances.IsEmpty()) { #line default #line hidden WriteLiteral(" <h2>"); #line 27 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationMessage._0AlreadySynchronized.NiceToString().FormatWith(@Model.Type.NiceName())); #line default #line hidden WriteLiteral("</h2> \r\n"); #line 28 "..\..\Translation\Views\SyncInstance.cshtml" } else { #line default #line hidden WriteLiteral(" <h2>"); #line 31 "..\..\Translation\Views\SyncInstance.cshtml" Write(ViewBag.Title); #line default #line hidden WriteLiteral("</h2>\r\n"); #line 32 "..\..\Translation\Views\SyncInstance.cshtml" using (Html.BeginForm((TranslatedInstanceController c) => c.SaveSync(Signum.Engine.Basics.TypeLogic.GetCleanName(Model.Type), culture.Name))) { #line default #line hidden WriteLiteral(" <table"); WriteLiteral(" id=\"results\""); WriteLiteral(" style=\"width: 100%; margin: 0px\""); WriteLiteral(" class=\"st\""); WriteLiteral(" \r\n data-feedback=\""); #line 36 "..\..\Translation\Views\SyncInstance.cshtml" Write(Url.Action("Feedback", "Translation")); #line default #line hidden WriteLiteral("\""); WriteLiteral(" \r\n data-culture=\""); #line 37 "..\..\Translation\Views\SyncInstance.cshtml" Write(culture.Name); #line default #line hidden WriteLiteral("\""); WriteLiteral(">\r\n"); #line 38 "..\..\Translation\Views\SyncInstance.cshtml" #line default #line hidden #line 38 "..\..\Translation\Views\SyncInstance.cshtml" foreach (InstanceChanges instance in Model.Instances) { #line default #line hidden WriteLiteral(" <thead>\r\n <tr>\r\n <th"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 42 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationMessage.Instance.NiceToString()); #line default #line hidden WriteLiteral("</th>\r\n <th"); WriteLiteral(" class=\"titleCell\""); WriteLiteral(">"); #line 43 "..\..\Translation\Views\SyncInstance.cshtml" Write(Html.Href(Navigator.NavigateRoute(instance.Instance), instance.Instance.ToString())); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n"); #line 46 "..\..\Translation\Views\SyncInstance.cshtml" foreach (var route in instance.RouteConflicts.OrderBy(a => a.Key.ToString())) { var propertyString = route.Key.ToString(); #line default #line hidden WriteLiteral(" <tr>\r\n <th"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 51 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationMessage.Property.NiceToString()); #line default #line hidden WriteLiteral("\r\n </th>\r\n <th>"); #line 53 "..\..\Translation\Views\SyncInstance.cshtml" Write(propertyString); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n"); #line 55 "..\..\Translation\Views\SyncInstance.cshtml" foreach (var mc in route.Value) { #line default #line hidden WriteLiteral(" <tr>\r\n <td"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 58 "..\..\Translation\Views\SyncInstance.cshtml" Write(mc.Key.Name); #line default #line hidden WriteLiteral("</td>\r\n <td"); WriteLiteral(" class=\"monospaceCell\""); WriteLiteral(">\r\n"); #line 60 "..\..\Translation\Views\SyncInstance.cshtml" #line default #line hidden #line 60 "..\..\Translation\Views\SyncInstance.cshtml" if (mc.Key.Equals(TranslatedInstanceLogic.DefaultCulture)) { string originalName = TranslatedInstanceLogic.DefaultCulture.Name + "#" + instance.Instance.Key() + "#" + propertyString; #line default #line hidden WriteLiteral(" <textarea"); WriteAttribute("name", Tuple.Create(" name=\"", 2545), Tuple.Create("\"", 2565) #line 63 "..\..\Translation\Views\SyncInstance.cshtml" , Tuple.Create(Tuple.Create("", 2552), Tuple.Create <System.Object, System.Int32>(originalName #line default #line hidden , 2552), false) ); WriteLiteral(" style=\"display:none\""); WriteLiteral(" >"); #line 63 "..\..\Translation\Views\SyncInstance.cshtml" Write(mc.Value.Original); #line default #line hidden WriteLiteral("</textarea>\r\n"); #line 64 "..\..\Translation\Views\SyncInstance.cshtml" } #line default #line hidden WriteLiteral("\r\n"); #line 66 "..\..\Translation\Views\SyncInstance.cshtml" #line default #line hidden #line 66 "..\..\Translation\Views\SyncInstance.cshtml" if (mc.Value.OldOriginal != null) { #line default #line hidden WriteLiteral(" <pre>"); #line 68 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationClient.Diff(mc.Value.OldOriginal, mc.Value.Original)); #line default #line hidden WriteLiteral("</pre>\r\n"); #line 69 "..\..\Translation\Views\SyncInstance.cshtml" } else if (TranslatedInstanceLogic.RouteType(route.Key.Route).Value == TranslateableRouteType.Html) { #line default #line hidden WriteLiteral(" <pre>"); #line 72 "..\..\Translation\Views\SyncInstance.cshtml" Write(mc.Value.Original); #line default #line hidden WriteLiteral("</pre>\r\n"); #line 73 "..\..\Translation\Views\SyncInstance.cshtml" } else { #line default #line hidden WriteLiteral(" <pre>"); #line 76 "..\..\Translation\Views\SyncInstance.cshtml" Write(mc.Value.Original); #line default #line hidden WriteLiteral("</pre> \r\n"); #line 77 "..\..\Translation\Views\SyncInstance.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n </tr>\r\n"); #line 80 "..\..\Translation\Views\SyncInstance.cshtml" } #line default #line hidden WriteLiteral(" <tr>\r\n <td"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 82 "..\..\Translation\Views\SyncInstance.cshtml" Write(culture.Name); #line default #line hidden WriteLiteral("</td>\r\n <td"); WriteLiteral(" class=\"monospaceCell\""); WriteLiteral(">\r\n"); #line 84 "..\..\Translation\Views\SyncInstance.cshtml" #line default #line hidden #line 84 "..\..\Translation\Views\SyncInstance.cshtml" var translations = route.Value.Where(kvp => kvp.Value.OldTranslation != null) .Select(kvp => new SelectListItem { Text = "old translation - " + kvp.Value.OldTranslation, Value = kvp.Value.OldTranslation }) .Concat(route.Value.Select(kvp => new SelectListItem { Text = "from " + kvp.Key + " - " + kvp.Value.AutomaticTranslation, Value = kvp.Value.AutomaticTranslation })) .ToList(); string elementName = culture.Name + "#" + instance.Instance.Key() + "#" + propertyString; if (translations.Count() == 1) { #line default #line hidden WriteLiteral(" <textarea"); WriteAttribute("name", Tuple.Create(" name=\"", 4082), Tuple.Create("\"", 4112) #line 93 "..\..\Translation\Views\SyncInstance.cshtml" , Tuple.Create(Tuple.Create("", 4089), Tuple.Create <System.Object, System.Int32>(elementName #line default #line hidden , 4089), false) , Tuple.Create(Tuple.Create("", 4103), Tuple.Create("_original", 4103), true) ); WriteLiteral(" style=\"display:none\""); WriteLiteral(" disabled=\"disabled\""); WriteLiteral(">"); #line 93 "..\..\Translation\Views\SyncInstance.cshtml" Write(translations.First().Value); #line default #line hidden WriteLiteral("</textarea>\r\n"); WriteLiteral(" <textarea"); WriteAttribute("name", Tuple.Create(" name=\"", 4228), Tuple.Create("\"", 4247) #line 94 "..\..\Translation\Views\SyncInstance.cshtml" , Tuple.Create(Tuple.Create("", 4235), Tuple.Create <System.Object, System.Int32>(elementName #line default #line hidden , 4235), false) ); WriteLiteral(" style=\"width:90%\""); WriteLiteral(" data-original=\""); #line 94 "..\..\Translation\Views\SyncInstance.cshtml" Write(translations.First().Value); #line default #line hidden WriteLiteral("\""); WriteLiteral(">"); #line 94 "..\..\Translation\Views\SyncInstance.cshtml" Write(translations.First().Value); #line default #line hidden WriteLiteral("</textarea>\r\n"); #line 95 "..\..\Translation\Views\SyncInstance.cshtml" if (TranslationClient.Translator is ITranslatorWithFeedback) { #line default #line hidden WriteLiteral(" <button"); WriteLiteral(" class=\"rememberChange\""); WriteLiteral(">"); #line 97 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationJavascriptMessage.RememberChange.NiceToString()); #line default #line hidden WriteLiteral("</button>\r\n"); #line 98 "..\..\Translation\Views\SyncInstance.cshtml" } } else { if (translations.Count() > 1 && translations.Select(a => a.Value).Distinct().Count() == 1) { translations.First().Selected = true; translations.Insert(0, new SelectListItem { Value = "", Text = "-" }); } else { translations.Insert(0, new SelectListItem { Value = "", Text = "-", Selected = true }); } #line default #line hidden #line 112 "..\..\Translation\Views\SyncInstance.cshtml" Write(Html.SafeDropDownList(elementName, translations)); #line default #line hidden #line 112 "..\..\Translation\Views\SyncInstance.cshtml" ; #line default #line hidden WriteLiteral(" <a"); WriteLiteral(" href=\"#\""); WriteLiteral(" class=\"edit\""); WriteLiteral(">"); #line 113 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationMessage.Edit.NiceToString()); #line default #line hidden WriteLiteral("</a>\r\n"); #line 114 "..\..\Translation\Views\SyncInstance.cshtml" } #line default #line hidden WriteLiteral("\r\n </td>\r\n </tr>\r\n"); #line 118 "..\..\Translation\Views\SyncInstance.cshtml" } } #line default #line hidden WriteLiteral(" </table>\r\n"); WriteLiteral(" <input"); WriteLiteral(" type=\"submit\""); WriteAttribute("value", Tuple.Create(" value=\"", 5506), Tuple.Create("\"", 5553) #line 121 "..\..\Translation\Views\SyncInstance.cshtml" , Tuple.Create(Tuple.Create("", 5514), Tuple.Create <System.Object, System.Int32>(TranslationMessage.Save.NiceToString() #line default #line hidden , 5514), false) ); WriteLiteral(" />\r\n"); #line 122 "..\..\Translation\Views\SyncInstance.cshtml" } } #line default #line hidden WriteLiteral("\r\n<script>\r\n $(function () {\r\n"); WriteLiteral(" "); #line 127 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationClient.Module["editAndRemember"](TranslationClient.Translator is ITranslatorWithFeedback)); #line default #line hidden WriteLiteral("\r\n"); WriteLiteral(" "); #line 128 "..\..\Translation\Views\SyncInstance.cshtml" Write(TranslationClient.Module["fixTextAreas"]()); #line default #line hidden WriteLiteral("\r\n });\r\n</script>\r\n"); }
public void UploadFilesInFolder(ClientContext context, Web web, ShContentFolder contentFolder, bool incrementalUpload) { Log.Info("Uploading files from contentfolder " + contentFolder.FolderName); string uploadTargetFolder; Folder rootFolder; web.Lists.EnsureSiteAssetsLibrary(); context.Load(web.Lists); context.ExecuteQuery(); if (!string.IsNullOrEmpty(contentFolder.ListUrl)) { context.Load(web, w => w.ServerRelativeUrl); context.ExecuteQuery(); var listUrl = Url.Combine(web.ServerRelativeUrl, contentFolder.ListUrl); rootFolder = web.GetFolderByServerRelativeUrl(listUrl); context.Load(rootFolder); context.ExecuteQuery(); uploadTargetFolder = Url.Combine(listUrl, contentFolder.FolderUrl); } else if (!string.IsNullOrEmpty(contentFolder.ListName)) { var assetLibrary = web.Lists.GetByTitle(contentFolder.ListName); context.Load(assetLibrary, l => l.Title, l => l.RootFolder); context.ExecuteQuery(); rootFolder = assetLibrary.RootFolder; uploadTargetFolder = Url.Combine(assetLibrary.RootFolder.ServerRelativeUrl, contentFolder.FolderUrl); } else { Log.ErrorFormat("You need to specify either ListName or ListUrl for the Content Folder {0}", contentFolder.FolderName); return; } var configRootFolder = Path.Combine(_contentDirectoryPath, contentFolder.FolderName); EnsureTargetFolder(context, web, rootFolder.ServerRelativeUrl, contentFolder.FolderUrl, uploadTargetFolder); EnsureAllContentFolders(context, web, configRootFolder, uploadTargetFolder); List <ShFileProperties> filePropertiesCollection = null; if (!string.IsNullOrEmpty(contentFolder.PropertiesFile)) { var propertiesFilePath = Path.Combine(configRootFolder, contentFolder.PropertiesFile); var filePersistanceProvider = new FilePersistanceProvider <List <ShFileProperties> >(propertiesFilePath); filePropertiesCollection = filePersistanceProvider.Load(); } context.Load(context.Site, site => site.ServerRelativeUrl); context.Load(context.Web, w => w.ServerRelativeUrl, w => w.Language); context.ExecuteQuery(); String[] excludedFileExtensions = { }; if (!string.IsNullOrEmpty(contentFolder.ExcludeExtensions)) { excludedFileExtensions = contentFolder.ExcludeExtensions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } var files = Directory.GetFiles(configRootFolder, "*", SearchOption.AllDirectories) .Where(file => !excludedFileExtensions.Contains(Path.GetExtension(file).ToLower())).ToList(); if (incrementalUpload) { files = files.Where(f => !LastUpload.ContainsKey(contentFolder.FolderName) || new FileInfo(f).LastWriteTimeUtc > LastUpload[contentFolder.FolderName]).ToList(); } int filesUploaded = 0; foreach (string filePath in files) { UploadAndPublishSingleFile(context, web, configRootFolder, contentFolder, uploadTargetFolder, rootFolder, filePropertiesCollection, filePath); filesUploaded++; } if (filesUploaded == 0) { Log.Info("No files updated since last upload."); } else { Log.InfoFormat("{0} file(s) uploaded", filesUploaded); } if (LastUpload.ContainsKey(contentFolder.FolderName)) { LastUpload[contentFolder.FolderName] = DateTime.UtcNow; } else { LastUpload.Add(contentFolder.FolderName, DateTime.UtcNow); } }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 5 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" ViewData["Title"] = "List"; Layout = "~/Views/Shared/_Layout.cshtml"; #line default #line hidden BeginContext(197, 596, true); WriteLiteral(@"<nav class=""breadcrumb""><i class=""Hui-iconfont""></i> 首页 <span class=""c-gray en"">></span> 系统管理 <span class=""c-gray en"">></span> 角色管理 <a id=""btn_refresh"" class=""btn btn-success radius r"" style=""line-height:1.6em;margin-top:3px"" href=""javascript:location.replace(location.href);"" title=""刷新""><i class=""Hui-iconfont""></i></a></nav> <div class=""page-container""> <div class=""text-c""> 日期范围: <input type=""text"" onfocus=""WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })"" id=""datemin"" name=""datemin"" class=""input-text Wdate"" style=""width:120px;"""); EndContext(); BeginWriteAttribute("value", " value=\"", 793, "\"", 817, 1); #line 13 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 801, ViewBag.datemin, 801, 16, false); #line default #line hidden EndWriteAttribute(); BeginContext(818, 196, true); WriteLiteral(" />\r\n -\r\n <input type=\"text\" onfocus=\"WdatePicker({ minDate:\'#F{$dp.$D(\\\'datemin\\\')}\',maxDate:\'%y-%M-%d\' })\" id=\"datemax\" name=\"datemax\" class=\"input-text Wdate\" style=\"width:120px;\""); EndContext(); BeginWriteAttribute("value", " value=\"", 1014, "\"", 1038, 1); #line 15 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 1022, ViewBag.datemax, 1022, 16, false); #line default #line hidden EndWriteAttribute(); BeginContext(1039, 120, true); WriteLiteral(" />\r\n <input type=\"text\" class=\"input-text\" style=\"width:250px\" placeholder=\"角色编号、名称\" id=\"keyword\" name=\"keyword\""); EndContext(); BeginWriteAttribute("value", " value=\"", 1159, "\"", 1183, 1); #line 16 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 1167, ViewBag.keyword, 1167, 16, false); #line default #line hidden EndWriteAttribute(); BeginContext(1184, 411, true); WriteLiteral(@" /> <button type=""submit"" class=""btn btn-success radius"" id=""search"" name=""search"" onclick=""$.mainu.search()""><i class=""Hui-iconfont""></i> 找查</button> </div> <div class=""cl pd-5 bg-1 bk-gray mt-20""> <span class=""l""> <a href=""javascript:;"" onclick=""$.mainu.deleteBatch()"" class=""btn btn-danger radius""><i class=""Hui-iconfont""></i> 批量删除</a> <a"); EndContext(); BeginWriteAttribute("href", " href=\"", 1595, "\"", 1621, 1); #line 22 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 1602, Url.Action("list"), 1602, 19, false); #line default #line hidden EndWriteAttribute(); BeginContext(1622, 113, true); WriteLiteral(" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 角色列表</a>\r\n <a href=\"javascript:;\""); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 1735, "\"", 1786, 4); WriteAttributeValue("", 1745, "$.mainu.add(\'新增角色\',", 1745, 19, true); WriteAttributeValue(" ", 1764, "\'", 1765, 2, true); #line 23 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 1766, Url.Action("add"), 1766, 18, false); #line default #line hidden WriteAttributeValue("", 1784, "\')", 1784, 2, true); EndWriteAttribute(); BeginContext(1787, 159, true); WriteLiteral(" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 新增角色</a>\r\n </span>\r\n <span class=\"r\" onclick=\"$.mainu.dayin()\">共有数据:<strong>"); EndContext(); BeginContext(1947, 13, false); #line 25 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(ViewBag.Count); #line default #line hidden EndContext(); BeginContext(1960, 624, true); WriteLiteral(@"</strong> 条</span> </div> <div class=""mt-20""> <table class=""table table-border table-bordered table-hover table-bg table-sort""> <thead> <tr class=""text-c""> <th width=""25""><input type=""checkbox"" name="""" value=""""></th> <th width=""80"">角色编号</th> <th width=""80"">角色名称</th> <th width="""">描述</th> <th width=""70"">状态</th> <th width=""120"">操作时间</th> <th width=""120"">操作</th> </tr> </thead> <tbody> "); EndContext(); #line 41 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" if (Model != null) { foreach (var m in Model) { #line default #line hidden BeginContext(2709, 109, true); WriteLiteral(" <tr class=\"text-c\">\r\n <td><input type=\"checkbox\" name=\"id\""); EndContext(); BeginWriteAttribute("value", " value=\"", 2818, "\"", 2835, 1); #line 46 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 2826, m.RoleID, 2826, 9, false); #line default #line hidden EndWriteAttribute(); BeginContext(2836, 40, true); WriteLiteral("></td>\r\n <td>"); EndContext(); BeginContext(2878, 54, false); #line 47 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(Html.Raw(Utility.Highlight(m.RoleID, ViewBag.keyword))); #line default #line hidden EndContext(); BeginContext(2933, 39, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(2974, 56, false); #line 48 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(Html.Raw(Utility.Highlight(m.RoleName, ViewBag.keyword))); #line default #line hidden EndContext(); BeginContext(3031, 54, true); WriteLiteral("</td>\r\n <td class=\"text-l\">"); EndContext(); BeginContext(3086, 8, false); #line 49 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(m.Remark); #line default #line hidden EndContext(); BeginContext(3094, 57, true); WriteLiteral("</td>\r\n <td class=\"td-status\">"); EndContext(); BeginContext(3153, 146, false); #line 50 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(m.State.HasValue ? Html.Raw("<span class='label label-success radius'>启用</span>") : Html.Raw("<span class='label label-defaunt radius'>停用</span>")); #line default #line hidden EndContext(); BeginContext(3300, 39, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(3341, 77, false); #line 51 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(m.CreateDate.HasValue ? m.CreateDate.Value.ToString("yyyy-MM-dd HH:mm") : "-"); #line default #line hidden EndContext(); BeginContext(3419, 59, true); WriteLiteral("</td>\r\n <td class=\"td-manage\">\r\n"); EndContext(); #line 53 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" if (m.State.ToBool()) { #line default #line hidden BeginContext(3569, 111, true); WriteLiteral(" <a title=\"停用\" href=\"javascript:;\" class=\"ml-5\" style=\"text-decoration:none\""); EndContext(); BeginWriteAttribute("onClick", " onClick=\"", 3680, "\"", 3720, 3); WriteAttributeValue("", 3690, "$.mainu.stop(this,\'", 3690, 19, true); #line 55 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 3709, m.RoleID, 3709, 9, false); #line default #line hidden WriteAttributeValue("", 3718, "\')", 3718, 2, true); EndWriteAttribute(); BeginContext(3721, 9, true); WriteLiteral(">停用</a>\r\n"); EndContext(); #line 56 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" } else { #line default #line hidden BeginContext(3838, 111, true); WriteLiteral(" <a title=\"启用\" href=\"javascript:;\" class=\"ml-5\" style=\"text-decoration:none\""); EndContext(); BeginWriteAttribute("onClick", " onClick=\"", 3949, "\"", 3990, 3); WriteAttributeValue("", 3959, "$.mainu.start(this,\'", 3959, 20, true); #line 59 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 3979, m.RoleID, 3979, 9, false); #line default #line hidden WriteAttributeValue("", 3988, "\')", 3988, 2, true); EndWriteAttribute(); BeginContext(3991, 9, true); WriteLiteral(">启用</a>\r\n"); EndContext(); #line 60 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" } #line default #line hidden BeginContext(4035, 65, true); WriteLiteral(" <a title=\"编辑\" href=\"javascript:;\""); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 4100, "\"", 4178, 4); WriteAttributeValue("", 4110, "$.mainu.add(\'新增角色\',", 4110, 19, true); WriteAttributeValue(" ", 4129, "\'", 4130, 2, true); #line 61 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 4131, Url.Action("edit",new { roleid = m.RoleID }), 4131, 45, false); #line default #line hidden WriteAttributeValue("", 4176, "\')", 4176, 2, true); EndWriteAttribute(); BeginContext(4179, 116, true); WriteLiteral(" class=\"ml-5\" style=\"text-decoration:none\">编辑</a>\r\n <a title=\"删除\" href=\"javascript:;\""); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 4295, "\"", 4337, 3); WriteAttributeValue("", 4305, "$.mainu.delete(this,\'", 4305, 21, true); #line 62 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" WriteAttributeValue("", 4326, m.RoleID, 4326, 9, false); #line default #line hidden WriteAttributeValue("", 4335, "\')", 4335, 2, true); EndWriteAttribute(); BeginContext(4338, 117, true); WriteLiteral(" class=\"ml-5\" style=\"text-decoration:none\">删除</a>\r\n </td>\r\n </tr>\r\n"); EndContext(); #line 65 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" } } #line default #line hidden BeginContext(4497, 120, true); WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n</div>\r\n<div class=\"pt-30\" style=\"width:100%; height:60px;\"></div>\r\n"); EndContext(); DefineSection("scripts", async() => { BeginContext(4696, 34, true); WriteLiteral("\r\n <!--请在下方写此页面业务相关的脚本-->\r\n "); EndContext(); BeginContext(4730, 92, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "a2a28f54b1c94ae4be98036e5eb83178", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(4822, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(4828, 101, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "ba7f6856a0244edbb1f81e4c6e9eb8ee", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(4929, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(4935, 81, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9336cd40cb3a41cb8416e961c0b3e562", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(5016, 1731, true); WriteLiteral(@" <script type=""text/javascript""> (function ($) { $.mainu = { init: function () { $('.table-sort').dataTable({ ""aaSorting"": [[5, ""desc""]],//默认第几个排序 ""bStateSave"": true,//状态保存 ""aoColumnDefs"": [ { ""orderable"": false, ""aTargets"": [0, 6] }// 制定列不参与排序 ], ""aLengthMenu"": [10, 25, 50, 100] }); }, search: function () { $dateMin = $(""input[name='datemin']"").val(); $dateMax = $(""input[name='datemax']"").val(); $keyword = $(""input[name='keyword']"").val(); if ($keyword == """") { if ($dateMin == """" || $dateMax == """") { layer.alert('日期范围不能空', { icon: 5 }); return; } "); WriteLiteral(@" } var url = ""?datemin="" + $dateMin + ""&datemax="" + $dateMax + ""&keyword="" + $keyword + """"; window.location.href = url; }, add: function (title, url) { var index = layer.open({ type: 2, title: title, content: url }); layer.full(index); }, stop: function (obj, id) { layer.confirm('确认要停用吗?', function (index) { $.ajax({ type: 'POST', url: '"); EndContext(); BeginContext(6748, 25, false); #line 120 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(Url.Action("UpdateState")); #line default #line hidden EndContext(); BeginContext(6773, 1472, true); WriteLiteral(@"', data: { roleId: id, state: false }, dataType: 'json', success: function (result) { var state = result.state; var message = result.message; if (state == ""success"") { $(obj).parents(""tr"").find("".td-manage"").prepend('<a title=""启用"" href=""javascript:;"" class=""ml-5"" style=""text-decoration:none"" onClick=""$.mainu.start(this,\'' + id + '\')"">启用</a>'); $(obj).parents(""tr"").find("".td-status"").html('<span class=""label label-defaunt radius"">已停用</span>'); $(obj).remove(); layer.msg('已停用!', { icon: 5, time: 3000 }); } else { layer.msg(message, { icon: 5, time: 3000 }); } "); WriteLiteral(@" }, error: function (data) { console.log(data.msg); } }); }); }, start: function (obj, id) { layer.confirm('确认要启用吗?', function (index) { $.ajax({ type: 'POST', url: '"); EndContext(); BeginContext(8246, 25, false); #line 145 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(Url.Action("UpdateState")); #line default #line hidden EndContext(); BeginContext(8271, 1472, true); WriteLiteral(@"', data: { roleId: id, state: true }, dataType: 'json', success: function (result) { var state = result.state; var message = result.message; if (state == ""success"") { $(obj).parents(""tr"").find("".td-manage"").prepend('<a title=""已停用"" href=""javascript:;"" class=""ml-5"" style=""text-decoration:none"" onClick=""$.mainu.stop(this,\'' + id + '\')"">停用</a>'); $(obj).parents(""tr"").find("".td-status"").html('<span class=""label label-success radius"">已启用</span>'); $(obj).remove(); layer.msg('已启用!', { icon: 6, time: 3000 }); } else { layer.msg(message, { icon: 5, time: 3000 }); } "); WriteLiteral(@" }, error: function (data) { console.log(data.msg); } }); }); }, delete: function (obj, id) { layer.confirm('确认要删除吗?', function (index) { $.ajax({ type: 'POST', url: '"); EndContext(); BeginContext(9744, 20, false); #line 170 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(Url.Action("delete")); #line default #line hidden EndContext(); BeginContext(9764, 1726, true); WriteLiteral(@"', data: { roleId: id }, dataType: 'json', success: function (result) { var state = result.state; var message = result.message; if (state == ""success"") { $(obj).parents(""tr"").remove(); layer.msg('已删除!', { icon: 1, time: 1000 }); } else { layer.msg(message, { icon: 5, time: 1000 }); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { if (XMLHttpRequest.status != 200) { layer.alert(""系统错误!"", { icon: 5 }); } } }); "); WriteLiteral(@" }); }, deleteBatch: function () { layer.confirm('确认要删除吗?', function (index) { var arrId = []; $(""input:checkbox[name='id']:checked"").each(function () { //alert($(this).val()); arrId.push($(this).val()); }); if (arrId.length == 0) { layer.msg('请选择需要删除日志!', { icon: 5, time: 2000 }); return; } $.ajax({ type: 'POST', url: '"); EndContext(); BeginContext(11491, 25, false); #line 204 "E:\Projects\CTMS\CTMS.Web\Views\SysRole\List.cshtml" Write(Url.Action("deletebatch")); #line default #line hidden EndContext(); BeginContext(11516, 1145, true); WriteLiteral(@"', data: { arrRoleId: arrId }, dataType: 'json', success: function (result) { var state = result.state; //错误代码 var message = result.message; //错误说明 if (state == ""success"") { window.location.replace(location.href); } else { layer.msg(message, { icon: 5, time: 1000 }); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { if (XMLHttpRequest.status != 200) { layer.alert(""系统错误!"", { icon: 5 }); } } }); }); } "); WriteLiteral(" };\r\n $(function () {\r\n $.mainu.init();\r\n });\r\n })(jQuery);\r\n </script>\r\n"); EndContext(); } ); BeginContext(12664, 2, true); WriteLiteral("\r\n"); EndContext(); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(38, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(138, 2, true); WriteLiteral("\r\n"); EndContext(); #line 6 "C:\Users\leode\Source\Workspaces\TempLittleBook\LittleBook\Views\Shared\_LoginPartial.cshtml" if (SignInManager.IsSignedIn(User)) { #line default #line hidden BeginContext(181, 4, true); WriteLiteral(" "); EndContext(); BeginContext(185, 546, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "7e3c21b012b342d0a9274f387ca1906d", async() => { BeginContext(350, 86, true); WriteLiteral("\r\n <ul class=\"nav navbar-nav navbar-right\">\r\n <li>\r\n "); EndContext(); BeginContext(436, 112, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "258ff3104393473ca5b2af33b7729838", async() => { BeginContext(507, 6, true); WriteLiteral("Hello "); EndContext(); BeginContext(514, 29, false); #line 11 "C:\Users\leode\Source\Workspaces\TempLittleBook\LittleBook\Views\Shared\_LoginPartial.cshtml" Write(UserManager.GetUserName(User)); #line default #line hidden EndContext(); BeginContext(543, 1, true); WriteLiteral("!"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("Identity"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-area", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("/Account/Manage/Index"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-page", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("Manage"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __tagHelperExecutionContext.AddHtmlAttribute("title", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(548, 176, true); WriteLiteral("\r\n </li>\r\n <li>\r\n <button type=\"submit\" class=\"btn btn-link navbar-btn navbar-link\">Logout</button>\r\n </li>\r\n </ul>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("Identity"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Area = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-area", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Area, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("/Account/Logout"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Page = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-page", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Page, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); if (__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-returnUrl", "Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 8 "C:\Users\leode\Source\Workspaces\TempLittleBook\LittleBook\Views\Shared\_LoginPartial.cshtml" WriteLiteral(Url.Page("/Index", new { area = "" })); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-returnUrl", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("post"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("method", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("logoutForm"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __tagHelperExecutionContext.AddHtmlAttribute("id", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("navbar-right"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(731, 2, true); WriteLiteral("\r\n"); EndContext(); #line 18 "C:\Users\leode\Source\Workspaces\TempLittleBook\LittleBook\Views\Shared\_LoginPartial.cshtml" } else { #line default #line hidden BeginContext(745, 58, true); WriteLiteral(" <ul class=\"nav navbar-nav navbar-right\">\r\n <li>"); EndContext(); BeginContext(803, 64, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "b3441622a5094cd3bb4a2683d5175126", async() => { BeginContext(855, 8, true); WriteLiteral("Register"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("Identity"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-area", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("/Account/Register"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-page", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(867, 19, true); WriteLiteral("</li>\r\n <li>"); EndContext(); BeginContext(886, 58, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "d0c94543f1024b6392f173ab06b214f9", async() => { BeginContext(935, 5, true); WriteLiteral("Login"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("Identity"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-area", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); WriteLiteral("/Account/Login"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-page", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(944, 18, true); WriteLiteral("</li>\r\n </ul>\r\n"); EndContext(); #line 25 "C:\Users\leode\Source\Workspaces\TempLittleBook\LittleBook\Views\Shared\_LoginPartial.cshtml" } #line default #line hidden }
public async Task <IActionResult> OnPostConfirmationAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); // Get the information about the user from the external login provider var info = await _signInManager.GetExternalLoginInfoAsync(); if (info == null) { ErrorMessage = "Error loading external login information during confirmation."; return(RedirectToPage("./Login", new { ReturnUrl = returnUrl })); } if (ModelState.IsValid) { var user = new ExpenseAppUser { UserName = Input.Email, Email = Input.Email }; var result = await _userManager.CreateAsync(user); if (result.Succeeded) { result = await _userManager.AddLoginAsync(user, info); if (result.Succeeded) { _logger.LogInformation("User created an account using {Name} provider.", info.LoginProvider); var userId = await _userManager.GetUserIdAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { area = "Identity", userId = userId, code = code }, protocol: Request.Scheme); await _emailSender.SendEmailAsync(Input.Email, "Confirm your email", $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); // If account confirmation is required, we need to show the link if we don't have a real email sender if (_userManager.Options.SignIn.RequireConfirmedAccount) { return(RedirectToPage("./RegisterConfirmation", new { Email = Input.Email })); } await _signInManager.SignInAsync(user, isPersistent : false, info.LoginProvider); return(LocalRedirect(returnUrl)); } } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } ProviderDisplayName = info.ProviderDisplayName; ReturnUrl = returnUrl; return(Page()); }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); if (ModelState.IsValid) { var user = new User { UserName = Input.Email, Email = Input.Email, Created = DateTime.Now, Updated = DateTime.Now }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); result = await _userManager.AddToRoleAsync(user, "User"); result = await _userManager.AddToRoleAsync(user, "Staff"); var isFirstUser = await _userManager.Users.CountAsync() == 1; if (isFirstUser) { result = await _userManager.AddToRoleAsync(user, "Admin"); result = await _userManager.AddToRoleAsync(user, "Moderator"); var activationToken = await _userManager.GenerateEmailConfirmationTokenAsync(user); await _userManager.ConfirmEmailAsync(user, activationToken); } if (result.Succeeded) { if (isFirstUser) { await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { userId = user.Id, code = code }, protocol: Request.Scheme); await _emailHelper.SendAdminConfirmationEmail(Input.Email, callbackUrl); StatusMessage = new StatusMessageWithType("Success", "Confirmation email sent. Please check your email.", "info"); return(Page()); } } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 3 "C:\Users\dell\Desktop\.net core Project\Dummy Project\CourseEnquiry\CourseEnquiry\Pages\UserRoles\UserRoles_ListCrudRedirect.cshtml" ViewData["Title"] = "List of User Roles"; #line default #line hidden BeginContext(121, 2, true); WriteLiteral("\r\n"); EndContext(); DefineSection("AdditionalCss", async() => { BeginContext(147, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(153, 56, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "04043c9ff08e4c2f8fb8182a541975c2", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(209, 2, true); WriteLiteral("\r\n"); EndContext(); } ); BeginContext(214, 2, true); WriteLiteral("\r\n"); EndContext(); DefineSection("AdditionalJavaScript", async() => { BeginContext(247, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(253, 88, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "61e2c5beda724e1aad7e734ccf038683", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.Src = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); #line 12 "C:\Users\dell\Desktop\.net core Project\Dummy Project\CourseEnquiry\CourseEnquiry\Pages\UserRoles\UserRoles_ListCrudRedirect.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion = true; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-append-version", __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(341, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(347, 82, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "30a3671ca806460b914527e580976676", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.Src = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); #line 13 "C:\Users\dell\Desktop\.net core Project\Dummy Project\CourseEnquiry\CourseEnquiry\Pages\UserRoles\UserRoles_ListCrudRedirect.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion = true; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-append-version", __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(429, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(435, 81, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c72a410efe75415588703b44a062d862", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.Src = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); #line 14 "C:\Users\dell\Desktop\.net core Project\Dummy Project\CourseEnquiry\CourseEnquiry\Pages\UserRoles\UserRoles_ListCrudRedirect.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion = true; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-append-version", __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(516, 2975, true); WriteLiteral(@" <script type=""text/javascript""> var urlAndMethod = '/UserRoles/UserRoles_ListCrudRedirect'; function editFormatter(cellvalue, options, rowObject) { return cellvalue; } function deleteFormatter(cellvalue, options, rowObject) { return cellvalue; } $(function () { $('#list-grid').jqGrid({ url: '/UserRoles/UserRoles_ListCrudRedirect?handler=GridData', datatype: 'json', mtype: 'GET', colNames: ['User Role Id','User Id','Role Id','Status', '', ''], colModel: [ { name: 'UserRoleId', index: 'UserRoleId', align: 'right' }, { name: 'UserId', index: 'UserId', align: 'right' }, { name: 'RoleId', index: 'RoleId', align: 'right' }, { name: 'Status', index: 'Status', align: 'center', formatter: 'checkbox' }, { name: 'editoperat"); WriteLiteral(@"ion', index: 'editoperation', align: 'center', width: 40, sortable: false , formatter: editFormatter }, { name: 'deleteoperation', index: 'deleteoperation', align: 'center', width: 40, sortable: false , formatter: deleteFormatter }, ], pager: $('#list-pager'), rowNum: 10, pageable: true, autoencode: true, jsonReader: { page: ""d.page"" }, rowList: [5, 10, 20, 50], sortname: 'UserRoleId', sortorder: ""asc"", viewrecords: true, caption: 'List of User Roles', height: '100%', width: '1200', gridComplete: function () { var ids = jQuery(""#list-grid"").jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var currentid = ids[i]; "); WriteLiteral(@" editLink = ""<a href='/UserRoles/UserRoles_Update?id="" + currentid + ""&returnUrl=/UserRoles/UserRoles_ListCrudRedirect'><img src='/images/Edit.gif' style='border:none;' /></a>""; deleteLink = ""<a href='#' onclick=\""deleteItem('"" + currentid + ""')\""><img src='/images/Delete.png' style='border:none;' /></a>""; jQuery(""#list-grid"").jqGrid('setRowData', ids[i], { editoperation: editLink }); jQuery(""#list-grid"").jqGrid('setRowData', ids[i], { deleteoperation: deleteLink }); } } }); }); // rename the page parameter to _page because asp.net core razor's page model // does not recognize the page parameter when passed $.extend(jQuery.jgrid.defaults, { prmNames: { page: ""_page"" } }); </script> "); EndContext(); } ); BeginContext(3494, 6, true); WriteLiteral("\r\n<h2>"); EndContext(); BeginContext(3501, 17, false); #line 80 "C:\Users\dell\Desktop\.net core Project\Dummy Project\CourseEnquiry\CourseEnquiry\Pages\UserRoles\UserRoles_ListCrudRedirect.cshtml" Write(ViewData["Title"]); #line default #line hidden EndContext(); BeginContext(3518, 182, true); WriteLiteral("</h2>\r\n<br /><br />\r\n<div id=\"errorConfirmationDialog\"></div>\r\n<div id=\"errorDialog\"></div>\r\n\r\n<a href=\"/UserRoles/UserRoles_Add?returnUrl=/UserRoles/UserRoles_ListCrudRedirect\"><img"); EndContext(); BeginWriteAttribute("src", " src=\"", 3700, "\"", 3738, 1); #line 85 "C:\Users\dell\Desktop\.net core Project\Dummy Project\CourseEnquiry\CourseEnquiry\Pages\UserRoles\UserRoles_ListCrudRedirect.cshtml" WriteAttributeValue("", 3706, Url.Content("~/images/Add.gif"), 3706, 32, false); #line default #line hidden EndWriteAttribute(); BeginContext(3739, 242, true); WriteLiteral(" alt=\"Add New UserRoles\" style=\"border: none;\" /></a> <a href=\"/UserRoles/UserRoles_Add?returnUrl=/UserRoles/UserRoles_ListCrudRedirect\">Add New UserRoles</a>\r\n<br /><br />\r\n\r\n<table id=\"list-grid\"></table>\r\n<div id=\"list-pager\"></div>\r\n"); EndContext(); }
public async Task <IActionResult> Callback() { // read external identity from the temporary cookie var result = await HttpContext.AuthenticateAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme); if (result?.Succeeded != true) { throw new Exception("External authentication error"); } // retrieve return URL var returnUrl = result.Properties.Items["returnUrl"] ?? "~/"; // check if we are in the context of an authorization request var context = await _interaction.GetAuthorizationContextAsync(returnUrl); // lookup our user and external provider info var(user, provider, providerUserId, claims) = await FindUserFromExternalProvider(result); if (user == null) { // this might be where you might initiate a custom workflow for user registration // in this sample we don't show how that would be done, as our sample implementation // simply auto-provisions new external user var email = claims.FirstOrDefault(a => a.Type == ClaimTypes.Email); var firstname = claims.FirstOrDefault(a => a.Type == ClaimTypes.GivenName); var surname = claims.FirstOrDefault(a => a.Type == ClaimTypes.Surname); var phone = claims.FirstOrDefault(a => a.Type == ClaimTypes.MobilePhone); var dob = claims.FirstOrDefault(a => a.Type == ClaimTypes.DateOfBirth); var gender = claims.FirstOrDefault(a => a.Type == ClaimTypes.Gender); if (email == null) { return(BadRequest("Please setup an email for this account")); } user = new User { Email = email.Value, NormalizedEmail = email.Value.ToUpper(), UserName = email.Value, NormalizedUserName = email.Value.ToUpper(), SecurityStamp = Guid.NewGuid().ToString(), HasPassword = false }; var umResult = await _identityService.UserManager.CreateAsync(user); if (umResult.Succeeded) { user = await _identityService.UserManager.FindByEmailAsync(user.Email); await _identityService.UserManager.AddToRoleAsync(user, "user"); foreach (var c in claims) { await _identityService.UserManager.AddClaimAsync(user, c); } var userLoginInfo = new UserLoginInfo(provider, providerUserId, email.Value); await _identityService.UserManager.AddLoginAsync(user, userLoginInfo); await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); // only set explicit expiration here if user chooses "remember me". // otherwise we rely upon expiration configured in cookie middleware. AuthenticationProperties props = null; props = new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration) }; // issue authentication cookie with subject ID and username await HttpContext.SignInAsync(user.Id.ToString(), user.UserName, props); if (context != null) { if (await _clientStore.IsPkceClientAsync(context.ClientId)) { // if the client is PKCE then we assume it's native, so this change in how to // return the response is for better UX for the end user. return(View("Redirect", new RedirectViewModel { RedirectUrl = returnUrl })); } // we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null return(Redirect(returnUrl)); } // request for a local page if (Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } else if (string.IsNullOrEmpty(returnUrl)) { return(Redirect("~/")); } else { // user might have clicked on a malicious link - should be logged throw new Exception("invalid return URL"); } } } // this allows us to collect any additonal claims or properties // for the specific prtotocols used and store them in the local auth cookie. // this is typically used to store data needed for signout from those protocols. var additionalLocalClaims = new List <Claim>(); var localSignInProps = new AuthenticationProperties(); ProcessLoginCallbackForOidc(result, additionalLocalClaims, localSignInProps); ProcessLoginCallbackForWsFed(result, additionalLocalClaims, localSignInProps); ProcessLoginCallbackForSaml2p(result, additionalLocalClaims, localSignInProps); // issue authentication cookie for user await _events.RaiseAsync(new UserLoginSuccessEvent(provider, providerUserId, user.Id.ToString(), user.Email)); await HttpContext.SignInAsync(user.Id.ToString(), user.Email, provider, localSignInProps, additionalLocalClaims.ToArray()); // delete temporary cookie used during external authentication await HttpContext.SignOutAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme); if (context != null) { if (await _clientStore.IsPkceClientAsync(context.ClientId)) { // if the client is PKCE then we assume it's native, so this change in how to // return the response is for better UX for the end user. return(View("Redirect", new RedirectViewModel { RedirectUrl = returnUrl })); } } return(Redirect(returnUrl)); }