public void SubmitForm(NavigationEntity navigationEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { if (service.IQueryable().Count(t => t.F_EnCode.Equals(navigationEntity.F_EnCode) && !t.F_Id.Equals(keyValue)) > 0) { throw new Exception("修改失败!操作的对象编号已存在。"); } navigationEntity.Modify(keyValue); service.Update(navigationEntity); } else { if (service.IQueryable().Count(t => t.F_EnCode.Equals(navigationEntity.F_EnCode)) > 0) { throw new Exception("添加失败!操作的对象编号已存在。"); } if (navigationEntity.F_DeleteMark == null) { navigationEntity.F_DeleteMark = false; } navigationEntity.Create(); service.Insert(navigationEntity); } }
protected NavigationEntity FillNavigationEntity(DbDataReader reader, ref int at, bool includeActivity = false, NavigationEntity entity = null) { if (entity == null) { entity = new NavigationEntity(); } object value; entity.FromActivityId = reader.GetGuid(at++); entity.ToActivityId = reader.GetGuid(at++); entity.OwnActivityId = reader.GetGuid(at++); entity.FlowId = reader.GetGuid(at++); entity.Graph = reader.GetString(at++); entity.Name = reader.GetString(at++); entity.InstanceType = reader.GetString(at++); entity.NextDealerId = (value = reader.GetValue(at)) == DBNull.Value ? null : value.ToString(); at++; entity.NextDealerName = (value = reader.GetValue(at)) == DBNull.Value ? null : value.ToString(); at++; entity.CreateTime = reader.GetDateTime(at++); if (includeActivity) { entity.ToActivityEntity = FillActivityEntity(reader, ref at); Guid?fromId = (value = reader.GetValue(at)) == DBNull.Value ? null : new Nullable <Guid>((Guid)value); if (fromId != null) { entity.FromActivityEntity = FillActivityEntity(reader, ref at); } } return(entity); }
public bool InsertNavigation(NavigationEntity entity, ITransaction trans = null) { using var cmd = this.CreateCommand(trans as DbTransaction, InsertNavigationSql); NavigationAllValues(entity, cmd); TraceCommand(cmd); return(cmd.ExecuteNonQuery() == 1); }
public override WidgetPart Display(WidgetBase widget, ControllerContext controllerContext) { var currentWidget = widget as NavigationWidget; var navs = ServiceLocator.Current.GetInstance <INavigationService>().Get(new DataFilter().OrderBy("DisplayOrder", OrderType.Ascending)) .Where(m => m.Status == (int)RecordStatus.Active).ToList(); string path = "~" + controllerContext.HttpContext.Request.Path.ToLower(); NavigationEntity current = null; int length = 0; foreach (var navigationEntity in navs) { if (navigationEntity.Url.IsNotNullAndWhiteSpace() && path.StartsWith(navigationEntity.Url.ToLower()) && length < navigationEntity.Url.Length) { current = navigationEntity; length = navigationEntity.Url.Length; } } if (current != null) { current.IsCurrent = true; } if (currentWidget.RootID.IsNullOrEmpty() || currentWidget.RootID == "root") { currentWidget.RootID = "#"; } return(widget.ToWidgetPart(new NavigationWidgetViewModel(navs, currentWidget))); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { var currentWidget = widget as NavigationWidget; var navs = _navigationService.GetAll() .Where(m => m.Status == (int)RecordStatus.Active).OrderBy(m => m.DisplayOrder).ToList(); string path = "~" + actionContext.RouteData.GetPath(); NavigationEntity current = null; int length = 0; foreach (var navigationEntity in navs) { if (navigationEntity.Url.IsNotNullAndWhiteSpace() && path.StartsWith(navigationEntity.Url.ToLower()) && length < navigationEntity.Url.Length) { current = navigationEntity; length = navigationEntity.Url.Length; } } if (current != null) { current.IsCurrent = true; } if (currentWidget.RootID.IsNullOrEmpty() || currentWidget.RootID == "root") { currentWidget.RootID = "#"; } return(widget.ToWidgetViewModelPart(new NavigationWidgetViewModel(navs, currentWidget))); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { var currentWidget = widget as NavigationWidget; var navs = _navigationService.Get() .Where(m => m.Status == (int)RecordStatus.Active).OrderBy(m => m.DisplayOrder).ToList(); if (actionContext is ActionExecutedContext) { string path = actionContext.HttpContext.Request.Path.Value.ToLower(); NavigationEntity current = null; int length = 0; IUrlHelper urlHelper = ((actionContext as ActionExecutedContext).Controller as Controller).Url; foreach (var navigationEntity in navs) { if (navigationEntity.Url.IsNotNullAndWhiteSpace() && path.StartsWith(urlHelper.PathContent(navigationEntity.Url).ToLower()) && length < navigationEntity.Url.Length) { current = navigationEntity; length = navigationEntity.Url.Length; } } if (current != null) { current.IsCurrent = true; } } if (currentWidget.RootID.IsNullOrEmpty() || currentWidget.RootID == "root") { currentWidget.RootID = "#"; } return(widget.ToWidgetViewModelPart(new NavigationWidgetViewModel(navs, currentWidget))); }
protected NavigationEntity FillNavigationRuntimeFields(DbDataReader reader, ref int at, bool includeActivity = false, NavigationEntity entity = null) { if (entity == null) { entity = new NavigationEntity(); } object value; entity.FromActivityId = reader.GetGuid(at++); entity.ToActivityId = reader.GetGuid(at++); entity.ParentActivityId = reader.GetGuid(at++); entity.FlowId = reader.GetGuid(at++); entity.Name = reader.GetString(at++); entity.NavigatorType = reader.GetString(at++); entity.CreateTime = reader.GetDateTime(at++); if (includeActivity) { entity.ToActivityEntity = FillActivityRuntimeFields(reader, ref at); Guid?fromId = (value = reader.GetValue(at)) == DBNull.Value ? null : new Nullable <Guid>((Guid)value); if (fromId != null) { entity.FromActivityEntity = FillActivityRuntimeFields(reader, ref at); } } return(entity); }
public ActionResult index(string id, int pageIndex = 1) { //分类实体 NavigationEntity navigationEntity = navigationApp.GetForm(a => a.F_EnCode.Equals(id, StringComparison.OrdinalIgnoreCase)); if (navigationEntity != null && !string.IsNullOrEmpty(navigationEntity.F_Id)) { ViewBag.NavigationEntity = navigationEntity; } //获取相关的分类 if (navigationApp.ExistChild(navigationEntity.F_Id)) { ViewBag.NavigationList = navigationApp.GetChildList(navigationEntity.F_Id, false); } else { ViewBag.NavigationList = navigationApp.GetChildList(navigationEntity.F_ParentId, false); } //相关推荐专题 ViewBag.SpecialList = specialApp.GetSpecialList(navigationEntity.F_Id, true); //文章 string arrNav = navigationApp.GetChildList(navigationEntity.F_Id, true).Select(a => a.F_Id).ToJson(",").TrimStart('[').TrimEnd(']').Replace("\"", "'"); IPagedList <ArticleEntity> ArticleList = articleApp.getMvcPageDataList(a => arrNav.Contains(a.F_NavID), a => a.F_CreatorTime, pageIndex, 10); if (ArticleList.Count == 0) { ArticleList = articleApp.getMvcPageDataList(a => a.F_NavID == navigationEntity.F_Id, a => a.F_SortCode, 1, 10); } //相关专题 ViewBag.RecommandSpecialList = specialApp.GetSpecialList(navigationEntity.F_Id); return(View(ArticleList)); }
void NavigationRecordValues(NavigationEntity entity, DbCommand cmd) { cmd.Parameters.Add(this.CreateParameter(entity.NextDealerId, "@nDealerId", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NextDealerName, "@nDealerName", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NextInputs, "@nInputs", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.PrevResults, "@prevResults", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.Graph, "@graph", DbType.String)); }
public async Task <bool> InsertNavigationAsync(NavigationEntity entity, ITransaction trans) { using var cmd = await this.CreateCommandAsync(trans as DbTransaction, InsertNavigationSql); NavigationAllValues(entity, cmd); TraceCommand(cmd); return(await cmd.ExecuteNonQueryAsync() == 1); }
/// <summary> setups the sync logic for member _navigation</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncNavigation(IEntityCore relatedEntity) { if (_navigation != relatedEntity) { DesetupSyncNavigation(true, true); _navigation = (NavigationEntity)relatedEntity; this.PerformSetupSyncRelatedEntity(_navigation, new PropertyChangedEventHandler(OnNavigationPropertyChanged), "Navigation", MonoSoftware.MonoX.DAL.RelationClasses.StaticNavigationLocalizationRelations.NavigationEntityUsingNavigationIdStatic, true, new string[] { }); } }
public IActionResult RegisterNavigation(NavigationEntity navigation) { var result = _operations.Register(navigation); if (result >= 1) { return(Ok(result)); } else { return(NoContent()); } }
public override RouteData GetRouteData(HttpContextBase httpContext) { var virtualPath = httpContext.Request.AppRelativeCurrentExecutionFilePath + httpContext.Request.PathInfo;//获取相对路径 //~/mingrenmingyan/154564654654/page-3 virtualPath = virtualPath.Substring(2).Trim('/'); if (!Validate.IsArticleUrl(virtualPath)) { return(null); } //mingrenmingyan/154564654654 string[] virtualPathStr = virtualPath.Split('/'); var PageIndex = "1"; var ArticleId = ""; var NavName = ""; if (virtualPathStr.Length == 3) { NavName = virtualPathStr[0].Trim(); ArticleId = virtualPathStr[1].Trim(); PageIndex = virtualPathStr[2].Split('-').Last(); } else if (virtualPathStr.Length == 2) { NavName = virtualPathStr[0].Trim(); ArticleId = virtualPathStr[1].Trim(); } else { return(null); } NavigationEntity navigationEntity = navigationApp.GetEntityByEnCode(NavName, a => a.F_EnabledMark == true); ArticleEntity articleEntity = articleApp.GetFormByEnCode(ArticleId); if (navigationEntity == null || !Validate.IsGuid(navigationEntity.F_Id) || articleEntity == null || !Validate.IsGuid(articleEntity.F_Id) || !articleEntity.F_NavID.Equals(navigationEntity.F_Id, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentNullException("Article"); } var data = new RouteData(this, new MvcRouteHandler());//声明一个RouteData,添加相应的路由值 data.Values.Add("controller", "Articles"); data.Values.Add("action", "index"); data.Values.Add("id", articleEntity.F_EnCode); data.Values.Add("pageIndex", PageIndex); return(data);//返回这个路由值将调用NavigationController.Index(Navigation.CategoeyID)方法。匹配终止 }
void NavigationValues(NavigationEntity entity, DbCommand cmd) { cmd.Parameters.Add(this.CreateParameter(entity.FromActivityId, "@fromId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.ToActivityId, "@toId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.OwnActivityId, "@ownId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.FlowId, "@flowId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.Graph, "@graph", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.Name, "@name", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.InstanceType, "@instType", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NextDealerId, "@nDealerId", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NextDealerName, "@nDealerName", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.Value, "@value", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.CreateTime, "@createTime", DbType.DateTime)); }
protected NavigationEntity FillNavigationRecordFields(DbDataReader reader, ref int at, NavigationEntity entity = null) { if (entity == null) { entity = new NavigationEntity(); } object value; entity.NextDealerId = (value = reader.GetValue(at++)) == DBNull.Value?null:value.ToString(); entity.NextDealerName = (value = reader.GetValue(at++)) == DBNull.Value ? null : value.ToString(); entity.NextInputs = (value = reader.GetValue(at++)) == DBNull.Value ? null : value.ToString(); entity.PrevResults = (value = reader.GetValue(at++)) == DBNull.Value ? null : value.ToString(); entity.Graph = (value = reader.GetValue(at++)) == DBNull.Value ? null : value.ToString(); return(entity); }
void NavigationRuntimeValues(NavigationEntity entity, DbCommand cmd) { cmd.Parameters.Add(this.CreateParameter(entity.FromActivityId, "@fromId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.ToActivityId, "@toId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.ParentActivityId, "@ownId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.FlowId, "@flowId", DbType.Guid)); cmd.Parameters.Add(this.CreateParameter(entity.Name, "@name", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NavigatorType, "@instType", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.CreateTime, "@createTime", DbType.DateTime)); cmd.Parameters.Add(this.CreateParameter(entity.NextDealerId, "@nDealerId", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NextDealerName, "@nDealerName", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.NextInputs, "@nInputs", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.PrevResults, "@prevResults", DbType.String)); cmd.Parameters.Add(this.CreateParameter(entity.Graph, "@graph", DbType.String)); }
public PartialViewResult AboutRecommend(string NavId) { NavigationEntity navigationEntity = navApp.GetForm(a => a.F_EnCode.Equals(NavId, StringComparison.OrdinalIgnoreCase)); if (navigationEntity != null && !string.IsNullOrEmpty(navigationEntity.F_Id)) { ViewBag.NavigationEntity = navigationEntity; } string arrNav = navApp.GetChildList(navigationEntity.F_Id, true).Select(a => a.F_Id).ToJson(",").TrimStart('[').TrimEnd(']').Replace("\"", "'"); //网友推荐 ViewBag.RecommandArticle = articleApp.GetList(arrNav, "", "", " F_LikeCount DESC,F_CreatorTime DESC ", 10); //排行榜 ViewBag.RankArticle = articleApp.GetList(arrNav, "", "", " F_ReadCount DESC,F_CreatorTime DESC ", 10); return(PartialView()); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { var currentWidget = widget as NavigationWidget; var navs = _navigationService.Get() .Where(m => m.Status == (int)RecordStatus.Active).OrderBy(m => m.DisplayOrder).ToList(); string path = null; if (ApplicationContext.As <CMSApplicationContext>().IsDesignMode) { var layout = actionContext.HttpContext.GetLayout(); if (layout != null && layout.Page != null) { path = layout.Page.Url.Replace("~/", "/"); } } else if (actionContext is ActionExecutedContext) { path = (actionContext as ActionExecutedContext).RouteData.GetPath(); } if (path != null) { NavigationEntity current = null; int length = 0; foreach (var navigationEntity in navs) { if (navigationEntity.Url.IsNotNullAndWhiteSpace() && path.IndexOf((navigationEntity.Url ?? "").Replace("~/", "/").Replace(".html", string.Empty), StringComparison.OrdinalIgnoreCase) == 0 && length < navigationEntity.Url.Length) { current = navigationEntity; length = navigationEntity.Url.Length; } } if (current != null) { current.IsCurrent = true; } } if (currentWidget.RootID.IsNullOrEmpty() || currentWidget.RootID == "root") { currentWidget.RootID = "#"; } return(widget.ToWidgetViewModelPart(new NavigationWidgetViewModel(navs, currentWidget))); }
public void DeveRegistrarNovaNavegacao() { var faker = new Faker(); string nome = faker.Random.Word(); //Teste viagem futura var data = faker.Date.Future(50); var navigation = new NavigationEntity(); navigation.TravelName = nome; navigation.Date = data; Assert.Equal(nome, navigation.TravelName); Assert.Equal(data, navigation.Date); Dispose(); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { var ArticleId = values["id"] as string; var Page = values["pageIndex"]; if (values["pageIndex"] != null) { Page = values["pageIndex"].ToString(); } if (Page == null) { Page = "1"; } //请求不是NavigationController发起的,不是我们要处理的请求,返回null if (!values.ContainsKey("controller") || !values["controller"].ToString().Equals("Articles", StringComparison.OrdinalIgnoreCase)) { return(null); } //请求不是NavigationController.Index(string id)发起的,不是我们要处理的请求,返回null if (!values.ContainsKey("action") || !values["action"].ToString().Equals("Index", StringComparison.OrdinalIgnoreCase)) { return(null); } ArticleEntity articleEntity = articleApp.GetFormByEnCode(ArticleId); if (articleEntity == null || !Validate.IsGuid(articleEntity.F_Id)) { throw new ArgumentNullException("Article"); } NavigationEntity navigationEntity = navigationApp.GetForm(articleEntity.F_NavID); var path = navigationEntity.F_EnCode + "/" + articleEntity.F_EnCode.Trim();//生成URL if (Page + "" != "1") { path = path + "/page-" + Page; } return(new VirtualPathData(this, path.ToLowerInvariant())); }
protected NavigationLocalizationEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if (SerializationHelper.Optimization != SerializationOptimization.Fast) { _language = (LanguageEntity)info.GetValue("_language", typeof(LanguageEntity)); if (_language != null) { _language.AfterSave += new EventHandler(OnEntityAfterSave); } _navigation = (NavigationEntity)info.GetValue("_navigation", typeof(NavigationEntity)); if (_navigation != null) { _navigation.AfterSave += new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
public PartialViewResult Header() { var gushiEntity = navApp.GetEntityByEnCode("gushi", a => a.F_EnabledMark == true); List <NavigationEntity> NavgushiList = navApp.GetChildList(gushiEntity.F_Id, false).Where(a => a.F_IsNav == true).ToList(); foreach (NavigationEntity item in NavgushiList) { NavigationEntity ParentNav = navApp.GetForm(item.F_ParentId); if (ParentNav.F_Id == gushiEntity.F_Id) { item.PatentEnCode = ""; } else { item.PatentEnCode = ParentNav.F_EnCode; } } ViewBag.Navgushi = NavgushiList; var wenxueEntity = navApp.GetEntityByEnCode("wenxue", a => a.F_EnabledMark == true); ViewBag.Navwenxue = navApp.GetChildList(wenxueEntity.F_Id, false).Where(a => a.F_IsNav == true).ToList(); return(PartialView()); }
void Start() { match_manager = GameObject.FindGameObjectWithTag("MatchManager").GetComponent <MatchManager>(); navigation_entity = gameObject.GetComponent <NavigationEntity>(); }
public override object Display(WidgetDisplayContext widgetDisplayContext) { var currentWidget = widgetDisplayContext.Widget as NavigationWidget; var actionContext = widgetDisplayContext.ActionContext; var navs = _navigationService.Get() .Where(m => m.Status == (int)RecordStatus.Active).OrderBy(m => m.DisplayOrder).ToList(); string path = null; IUrlHelper urlHelper = null; if (ApplicationContext.As <CMSApplicationContext>().IsDesignMode) { var layout = widgetDisplayContext.PageLayout; if (layout != null && layout.Page != null) { path = layout.Page.Url.Replace("~/", "/"); } } else if (actionContext is ActionExecutedContext) { path = (actionContext as ActionExecutedContext).HttpContext.Request.Path.Value.Replace(".html", string.Empty); urlHelper = ((actionContext as ActionExecutedContext).Controller as Controller).Url; } if (urlHelper == null && (actionContext is ActionExecutedContext)) { urlHelper = ((actionContext as ActionExecutedContext).Controller as Controller).Url; } if (path != null) { NavigationEntity current = null; int length = 0; foreach (var navigationEntity in navs) { string url = (navigationEntity.Url ?? "~/").Replace(".html", string.Empty); if (urlHelper != null) { url = urlHelper.Content(url); } else { url = url.Replace("~/", "/"); } if (path.IndexOf(url, StringComparison.OrdinalIgnoreCase) == 0 && length < url.Length) { current = navigationEntity; length = url.Length; } } if (current != null) { current.IsCurrent = true; } } if (currentWidget.RootID.IsNullOrEmpty() || currentWidget.RootID == "root") { currentWidget.RootID = "#"; } return(new NavigationWidgetViewModel(navs, currentWidget)); }
public NavigationViewModel(IEnumerable <NavigationEntity> navs, NavigationEntity nav) { _navs = navs; Current = nav; }
public ActionResult SubmitNavForm(NavigationEntity navigationEntity, string keyValue) { navApp.SubmitForm(navigationEntity, keyValue); return(Success("操作成功。")); }
/// <summary> Removes the sync logic for member _navigation</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncNavigation(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_navigation, new PropertyChangedEventHandler(OnNavigationPropertyChanged), "Navigation", MonoSoftware.MonoX.DAL.RelationClasses.StaticNavigationLocalizationRelations.NavigationEntityUsingNavigationIdStatic, true, signalRelatedEntity, "NavigationLocalizations", resetFKFields, new int[] { (int)NavigationLocalizationFieldIndex.NavigationId }); _navigation = null; }
void NavigationAllValues(NavigationEntity entity, DbCommand cmd) { this.NavigationRuntimeValues(entity, cmd); this.NavigationRecordValues(entity, cmd); }